3030import io .swagger .annotations .Api ;
3131import io .swagger .annotations .ApiImplicitParam ;
3232import io .swagger .annotations .ApiOperation ;
33+ import org .apache .shiro .authz .annotation .RequiresRoles ;
3334import org .springframework .beans .factory .annotation .Autowired ;
3435import org .springframework .validation .annotation .Validated ;
3536import org .springframework .web .bind .annotation .PathVariable ;
3839import org .springframework .web .bind .annotation .RequestMethod ;
3940import org .springframework .web .bind .annotation .RestController ;
4041
42+ import static org .apache .inlong .manager .pojo .user .UserRoleCode .INLONG_ADMIN ;
43+
4144/**
4245 * Inlong package control layer
4346 */
@@ -51,13 +54,15 @@ public class PackageController {
5154
5255 @ RequestMapping (value = "/package/save" , method = RequestMethod .POST )
5356 @ ApiOperation (value = "Save inlong package" )
57+ @ RequiresRoles (INLONG_ADMIN )
5458 public Response <Integer > save (@ Validated (SaveValidation .class ) @ RequestBody PackageRequest request ) {
5559 String operator = LoginUserUtils .getLoginUser ().getName ();
5660 return Response .success (packageService .save (request , operator ));
5761 }
5862
5963 @ RequestMapping (value = "/package/update" , method = RequestMethod .POST )
6064 @ ApiOperation (value = "Update inlong package" )
65+ @ RequiresRoles (INLONG_ADMIN )
6166 public Response <Boolean > update (@ Validated (UpdateValidation .class ) @ RequestBody PackageRequest request ) {
6267 return Response .success (packageService .update (request , LoginUserUtils .getLoginUser ().getName ()));
6368 }
@@ -77,6 +82,7 @@ public Response<PageResult<PackageResponse>> listByCondition(@RequestBody Packag
7782
7883 @ RequestMapping (value = "/package/delete/{id}" , method = RequestMethod .DELETE )
7984 @ ApiOperation (value = "Delete package config" )
85+ @ RequiresRoles (INLONG_ADMIN )
8086 public Response <Boolean > delete (@ PathVariable Integer id ) {
8187 return Response .success (packageService .delete (id , LoginUserUtils .getLoginUser ().getName ()));
8288 }
0 commit comments