public AuthzGroup getSiteRealm(String siteId) { AuthzGroup siteRealm = null; try { siteRealm = AuthzGroupService.getAuthzGroup("/site/" + siteId); } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } return siteRealm; }
AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); if (role != null) AuthzGroup realmEdit = AuthzGroupService.getAuthzGroup(realmId); realmEdit.addMember(user.getId(), role.getId(), true, false); AuthzGroupService.save(realmEdit);
public List getWorksiteRoles(String siteId) { List roles = new ArrayList(); try { AuthzGroup siteRealm = AuthzGroupService.getAuthzGroup("/site/" + siteId); for (Iterator i = siteRealm.getRoles().iterator(); i.hasNext();) { Role sakaiRole = (Role) i.next(); roles.add(convertRole(sakaiRole, siteRealm)); } } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } return roles; }
/** * @param siteId * @return list of agents that are participants in the given siteId */ public List getWorksiteAgents(String siteId) { List users = new ArrayList(); List participants = new ArrayList(); String realmId = "/site/" + siteId; try { AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); users.addAll(getDirectoryService().getUsers(realm.getUsers())); Collections.sort(users); for (int i = 0; i < users.size(); i++) { User user = (User) users.get(i); participants.add(morphAgent(user)); } } catch (GroupNotDefinedException e) { logger.warn("" + realmId); } return participants; }
public Agent getRealmRole(String roleName, String realmId) { try { AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); Role role = realm.getRole(roleName); return convertRole(role, realm); } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } }
public Agent getWorksiteRole(String roleName, String siteId) { try { AuthzGroup siteRealm = AuthzGroupService.getAuthzGroup("/site/" + siteId); Role sakaiRole = siteRealm.getRole(roleName); return convertRole(sakaiRole, siteRealm); } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } }
AuthzGroup realm = AuthzGroupService.getAuthzGroup(siteId);
public List getWorksiteRoles(PermissionsEdit edit) { try { AuthzGroup siteRealm = AuthzGroupService.getAuthzGroup("/site/" + edit.getSiteId()); Set roles = siteRealm.getRoles(); List returned = new ArrayList(); returned.addAll(siteRealm.getRoles()); return returned; } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } }
try AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); users.addAll(UserDirectoryService.getUsers(realm.getUsers())); Collections.sort(users);
protected Agent getRole(String username) throws IdUnusedException { String roleName; String siteId; int pos = username.lastIndexOf('/'); siteId = username.substring(0, pos); roleName = username.substring(pos + 1); Role role = null; AuthzGroup realm = null; try { realm = AuthzGroupService.getAuthzGroup(siteId); } catch (GroupNotDefinedException e) { throw new IdUnusedException (e.getId()); } if (realm != null) role = realm.getRole(roleName); if (role == null || realm == null) { return null; } return convertRole(role, realm); }
AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId);
public List getWorksiteRoles(String worksiteId) { List returned = new ArrayList(); try { AuthzGroup siteRealm = AuthzGroupService.getAuthzGroup("/site/" + worksiteId); Role role = siteRealm.getUserRole(getSakaiUser().getId()); if (role != null) { returned.add(getSecurityBase().convertRole(role, siteRealm)); } } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } return returned; }
protected PermissionsEdit fillPermissionsInternal(PermissionsEdit edit, Id qualifier, boolean readOnly) { try { AuthzGroup siteRealm = AuthzGroupService.getAuthzGroup("/site/" + edit.getSiteId()); Set roles = siteRealm.getRoles(); for (Iterator i = roles.iterator(); i.hasNext();) { Role role = (Role) i.next(); Agent currentRole = getAgentManager().getWorksiteRole(role.getId(), edit.getSiteId()); List authzs = getAuthzManager().getAuthorizations(currentRole, null, qualifier); for (Iterator j = authzs.iterator(); j.hasNext();) { Authorization authz = (Authorization) j.next(); edit.getPermissions().add(new Permission(currentRole, authz.getFunction(), readOnly)); } } } catch (GroupNotDefinedException e) { logger.error("", e); throw new OspException(e); } return edit; }