/** * @see io.apiman.manager.api.core.IStorageQuery#getPermissions(java.lang.String) */ @Override public Set<PermissionBean> getPermissions(String userId) throws StorageException { refresh(); return this.delegate.getPermissions(userId); }
/** * Loads the current user's permissions into a thread local variable. */ private IndexedPermissions loadPermissions() { String userId = getCurrentUser(); try { return new IndexedPermissions(getQuery().getPermissions(userId)); } catch (StorageException e) { logger.error(Messages.getString("AbstractSecurityContext.ErrorLoadingPermissions") + userId, e); //$NON-NLS-1$ return new IndexedPermissions(new HashSet<>()); } }
/** * Loads the current user's permissions into a thread local variable. */ private IndexedPermissions loadPermissions() { String userId = getCurrentUser(); try { return new IndexedPermissions(getQuery().getPermissions(userId)); } catch (StorageException e) { logger.error(Messages.getString("AbstractSecurityContext.ErrorLoadingPermissions") + userId, e); //$NON-NLS-1$ return new IndexedPermissions(new HashSet<>()); } }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#getApis(java.lang.String) */ @Override public List<ApiSummaryBean> getApis(String userId) { Set<String> permittedOrganizations = new HashSet<>(); try { Set<PermissionBean> permissions = query.getPermissions(userId); for (PermissionBean permission : permissions) { if (permission.getName() == PermissionType.apiView) { permittedOrganizations.add(permission.getOrganizationId()); } } return query.getApisInOrgs(permittedOrganizations); } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#getClients(java.lang.String) */ @Override public List<ClientSummaryBean> getClients(String userId) { Set<String> permittedOrganizations = new HashSet<>(); try { Set<PermissionBean> permissions = query.getPermissions(userId); for (PermissionBean permission : permissions) { if (permission.getName() == PermissionType.clientView) { permittedOrganizations.add(permission.getOrganizationId()); } } return query.getClientsInOrgs(permittedOrganizations); } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#getClients(java.lang.String) */ @Override public List<ClientSummaryBean> getClients(String userId) { Set<String> permittedOrganizations = new HashSet<>(); try { Set<PermissionBean> permissions = query.getPermissions(userId); for (PermissionBean permission : permissions) { if (permission.getName() == PermissionType.clientView) { permittedOrganizations.add(permission.getOrganizationId()); } } return query.getClientsInOrgs(permittedOrganizations); } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IUserResource#getApis(java.lang.String) */ @Override public List<ApiSummaryBean> getApis(String userId) { Set<String> permittedOrganizations = new HashSet<>(); try { Set<PermissionBean> permissions = query.getPermissions(userId); for (PermissionBean permission : permissions) { if (permission.getName() == PermissionType.apiView) { permittedOrganizations.add(permission.getOrganizationId()); } } return query.getApisInOrgs(permittedOrganizations); } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IPermissionsResource#getPermissionsForCurrentUser() */ @Override public UserPermissionsBean getPermissionsForCurrentUser() throws UserNotFoundException { try { String currentUser = securityContext.getCurrentUser(); UserPermissionsBean bean = new UserPermissionsBean(); bean.setUserId(currentUser); bean.setPermissions(query.getPermissions(currentUser)); return bean; } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IPermissionsResource#getPermissionsForCurrentUser() */ @Override public UserPermissionsBean getPermissionsForCurrentUser() throws UserNotFoundException { try { String currentUser = securityContext.getCurrentUser(); UserPermissionsBean bean = new UserPermissionsBean(); bean.setUserId(currentUser); bean.setPermissions(query.getPermissions(currentUser)); return bean; } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IPermissionsResource#getPermissionsForUser(java.lang.String) */ @Override public UserPermissionsBean getPermissionsForUser(String userId) throws UserNotFoundException, NotAuthorizedException { if (!securityContext.isAdmin()) throw ExceptionFactory.notAuthorizedException(); try { UserPermissionsBean bean = new UserPermissionsBean(); bean.setUserId(userId); bean.setPermissions(query.getPermissions(userId)); return bean; } catch (StorageException e) { throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IPermissionsResource#getPermissionsForUser(java.lang.String) */ @Override public UserPermissionsBean getPermissionsForUser(String userId) throws UserNotFoundException, NotAuthorizedException { if (!securityContext.isAdmin()) throw ExceptionFactory.notAuthorizedException(); try { UserPermissionsBean bean = new UserPermissionsBean(); bean.setUserId(userId); bean.setPermissions(query.getPermissions(userId)); return bean; } catch (StorageException e) { throw new SystemErrorException(e); } }
} else { rval.initFromUser(user); Set<PermissionBean> permissions = query.getPermissions(userId); rval.setPermissions(permissions); rval.setAdmin(securityContext.isAdmin());
} else { rval.initFromUser(user); Set<PermissionBean> permissions = query.getPermissions(userId); rval.setPermissions(permissions); rval.setAdmin(securityContext.isAdmin());