use of com.serotonin.m2m2.vo.permission.PermissionDetails in project ma-modules-public by infiniteautomation.
the class UserRestController method getUserPermissions.
@ApiOperation(value = "Get User Permissions Information for all users", notes = "", response = PermissionDetails.class, responseContainer = "Array")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Ok", response = PermissionDetails.class), @ApiResponse(code = 403, message = "User does not have access", response = ResponseEntity.class) })
@RequestMapping(method = RequestMethod.GET, produces = { "application/json" }, value = "/permissions")
public ResponseEntity<List<PermissionDetails>> getUserPermissions(HttpServletRequest request) {
RestProcessResult<List<PermissionDetails>> result = new RestProcessResult<List<PermissionDetails>>(HttpStatus.OK);
User currentUser = this.checkUser(request, result);
if (result.isOk()) {
List<PermissionDetails> ds = new ArrayList<>();
for (User user : UserDao.instance.getActiveUsers()) {
PermissionDetails deets = Permissions.getPermissionDetails(currentUser, null, user);
if (deets != null)
ds.add(deets);
}
return result.createResponseEntity(ds);
}
return result.createResponseEntity();
}
use of com.serotonin.m2m2.vo.permission.PermissionDetails in project ma-modules-public by infiniteautomation.
the class UserRestController method getUserPermissions.
@ApiOperation(value = "Get User Permissions Information for all users, exclude provided groups in query", notes = "", response = PermissionDetails.class, responseContainer = "Array")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Ok", response = PermissionDetails.class), @ApiResponse(code = 403, message = "User does not have access", response = ResponseEntity.class) })
@RequestMapping(method = RequestMethod.GET, produces = { "application/json" }, value = "/permissions/{query}")
public ResponseEntity<List<PermissionDetails>> getUserPermissions(@ApiParam(value = "Query of permissions to show as already added", required = true, allowMultiple = false) @PathVariable String query, HttpServletRequest request) {
RestProcessResult<List<PermissionDetails>> result = new RestProcessResult<List<PermissionDetails>>(HttpStatus.OK);
User currentUser = this.checkUser(request, result);
if (result.isOk()) {
List<PermissionDetails> ds = new ArrayList<>();
for (User user : UserDao.instance.getActiveUsers()) {
PermissionDetails deets = Permissions.getPermissionDetails(currentUser, query, user);
if (deets != null)
ds.add(deets);
}
return result.createResponseEntity(ds);
}
return result.createResponseEntity();
}
use of com.serotonin.m2m2.vo.permission.PermissionDetails in project ma-core-public by infiniteautomation.
the class BaseDwr method getUserPermissionInfo.
/**
* Power tools for user permissions.
*/
@DwrPermission(user = true)
public List<PermissionDetails> getUserPermissionInfo(String query) {
List<PermissionDetails> ds = new ArrayList<>();
User currentUser = Common.getUser();
for (User user : UserDao.instance.getActiveUsers()) {
PermissionDetails deets = Permissions.getPermissionDetails(currentUser, query, user);
if (deets != null)
ds.add(deets);
}
return ds;
}
Aggregations