Search in sources :

Example 1 with PermissionDefinitionModel

use of com.serotonin.m2m2.web.mvc.rest.v1.model.PermissionDefinitionModel in project ma-modules-public by infiniteautomation.

the class PermissionsRestController method listPermissions.

@ApiOperation(value = "List permissions and their system setting keys")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<List<PermissionDefinitionModel>> listPermissions() {
    List<PermissionDefinitionModel> permissions = new ArrayList<>();
    permissions.add(new PermissionDefinitionModel(SystemSettingsDao.PERMISSION_DATASOURCE, "systemSettings.permissions.datasourceManagement"));
    for (PermissionDefinition def : ModuleRegistry.getDefinitions(PermissionDefinition.class)) {
        permissions.add(new PermissionDefinitionModel(def));
    }
    return new ResponseEntity<>(permissions, HttpStatus.OK);
}
Also used : PermissionDefinitionModel(com.serotonin.m2m2.web.mvc.rest.v1.model.PermissionDefinitionModel) PermissionDefinition(com.serotonin.m2m2.module.PermissionDefinition) ResponseEntity(org.springframework.http.ResponseEntity) ArrayList(java.util.ArrayList) ApiOperation(com.wordnik.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PermissionDefinition (com.serotonin.m2m2.module.PermissionDefinition)1 PermissionDefinitionModel (com.serotonin.m2m2.web.mvc.rest.v1.model.PermissionDefinitionModel)1 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)1 ArrayList (java.util.ArrayList)1 ResponseEntity (org.springframework.http.ResponseEntity)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1