use of com.infiniteautomation.mango.rest.latest.model.permissions.PermissionDefinitionModel in project ma-modules-public by infiniteautomation.
the class PermissionsRestController method update.
@ApiOperation(value = "Update all of a Permission's Roles", notes = "If no roles are supplied then all existing assigned roles are removed")
@RequestMapping(method = RequestMethod.PUT, value = "/{name}")
public PermissionDefinitionModel update(@PathVariable String name, @ApiParam(value = "Permission", required = true) @RequestBody(required = true) PermissionDefinitionModel model) {
PermissionDefinition def = ModuleRegistry.getPermissionDefinition(name);
if (def == null) {
throw new NotFoundRestException();
}
MangoPermission permission = model.getPermission() != null ? model.getPermission().getPermission() : null;
service.update(permission, def);
return new PermissionDefinitionModel(def);
}
Aggregations