private boolean isUserInGroup(String groupId, String agentId) { String realmId = "/site/" + siteId + "/group/" + groupId; boolean isMember = false; try { AuthzGroup group = authzGroupService.getAuthzGroup(realmId); if (group.getUserRole(agentId) != null) isMember = true; } catch (Exception e) { return false; // this isn't a group } return isMember; }
Iterator<String> it = groups.iterator(); while (it.hasNext()) { AuthzGroup group = authzGroupService.getAuthzGroup(it.next()); group.removeMember(id); authzGroupService.save(group);
private boolean isUserInGroup(String groupId, String agentId) { String realmId = "/site/" + siteId + "/group/" + groupId; boolean isMember = false; try { AuthzGroup group = authzGroupService.getAuthzGroup(realmId); if (group.getUserRole(agentId) != null) isMember = true; } catch (Exception e) { return false; // this isn't a group } return isMember; }
public boolean checkMembership(String siteId) { boolean isMember = false; try{ String realmName = "/site/" + siteId; AuthzGroup siteAuthzGroup = authzGroupService.getAuthzGroup(realmName); if (siteAuthzGroup.getUserRole(AgentFacade.getAgentString()) != null) isMember = true; } catch(Exception e) { log.error(e.getMessage(), e); } return isMember; }
public boolean checkMembership(String siteId) { boolean isMember = false; try{ String realmName = "/site/" + siteId; AuthzGroup siteAuthzGroup = authzGroupService.getAuthzGroup(realmName); if (siteAuthzGroup.getUserRole(AgentFacade.getAgentString()) != null) isMember = true; } catch(Exception e) { log.error(e.getMessage(), e); } return isMember; }
/** * getExternalRealmId * */ private static String getExternalRealmId(String siteId) { String realmId = SiteService.siteReference(siteId); String rv = null; try { AuthzGroup realm = authzGroupService.getAuthzGroup(realmId); rv = realm.getProviderGroupId(); } catch (GroupNotDefinedException e) { log.warn("SiteParticipantHelper.getExternalRealmId: site realm not found " + realmId); } return rv; } // getExternalRealmId
public List<String> getRoleIdsInRealm(String realmId) { AuthzGroup group; try { group = authzGroupService.getAuthzGroup(realmId); List<String> ret = new ArrayList<String>(); Set<Role> roles = group.getRoles(); Iterator<Role> i = roles.iterator(); while (i.hasNext()) { Role role = (Role)i.next(); ret.add(role.getId()); } return ret; } catch (GroupNotDefinedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
public String getRoleForAgentAndSite(String agentString, String siteId) { String role = "anonymous_access"; if (siteId == null) return role; String realmName = "/site/" + siteId; Role userRole=null; try { AuthzGroup siteAuthzGroup = authzGroupService.getAuthzGroup(realmName); if (siteAuthzGroup!=null) userRole = siteAuthzGroup.getUserRole(agentString); if (userRole!=null) role = userRole.getId(); log.debug(realmName + ":" + role); } catch(GroupNotDefinedException e) { log.error("error in:" + this + "-getRoleForAgnetAndSite"); } return role; } /**
AuthzGroup group = authzGroupService.getAuthzGroup(context);
public String getRoleForAgentAndSite(String agentString, String siteId) { String role = "anonymous_access"; if (siteId == null) return role; String realmName = "/site/" + siteId; Role userRole=null; try { AuthzGroup siteAuthzGroup = authzGroupService.getAuthzGroup(realmName); if (siteAuthzGroup!=null) userRole = siteAuthzGroup.getUserRole(agentString); if (userRole!=null) role = userRole.getId(); log.debug(realmName + ":" + role); } catch(GroupNotDefinedException e) { log.error("error in:" + this + "-getRoleForAgnetAndSite"); } return role; } /**
private static String getExternalRealmId(String siteId) { String realmId = SiteService.siteReference(siteId); String rv = null; try { AuthzGroup realm = ComponentManager.get(AuthzGroupService.class).getAuthzGroup(realmId); rv = realm.getProviderGroupId(); } catch (GroupNotDefinedException e) { log.error("SiteParticipantHelper.getExternalRealmId: site realm not found {}", e.getMessage()); } return rv; } // getExternalRealmId
public boolean isRoleAllowedInRealm(String roleId, String realmId, String permission) { try { AuthzGroup group = authzGroupService.getAuthzGroup(realmId); Role role = group.getRole(roleId); return role.isAllowed(permission); } catch (GroupNotDefinedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }
protected boolean checkMaintain(String agentId) { AuthzGroup siteRealm = null; try { siteRealm = getRealmService().getAuthzGroup(getCurrentRealm()); } catch (GroupNotDefinedException e) { throw new RuntimeException("unkown realm", e); } String maintain = siteRealm.getMaintainRole(); return siteRealm.hasRole(agentId, maintain); }
private static String getExternalRealmId(String siteId) { String realmId = SiteService.siteReference(siteId); String rv = null; try { AuthzGroup realm = ComponentManager.get(AuthzGroupService.class).getAuthzGroup(realmId); rv = realm.getProviderGroupId(); } catch (GroupNotDefinedException e) { log.error("SiteParticipantHelper.getExternalRealmId: site realm not found {}", e.getMessage()); } return rv; } // getExternalRealmId
AuthzGroup siteAuthzGroup = authzGroupService.getAuthzGroup(realmName); if (siteAuthzGroup!=null) userRole = siteAuthzGroup.getUserRole(agentString);
/** * {@inheritDoc} * @see org.sakaiproject.content.api.ContentHostingService#getRoleViews(String) */ public Set<String> getRoleViews(final String id) { String ref = getReference(id); LinkedHashSet<String> roleIds = new LinkedHashSet<String>(); AuthzGroup realm = null; try { realm = m_authzGroupService.getAuthzGroup(ref); } catch (GroupNotDefinedException e) { // if there is no authz group then no roles can have been defined. return roleIds; } Set<Role> roles = realm.getRoles(); for (Role role : roles) { if(role.isAllowed(AUTH_RESOURCE_READ)) { roleIds.add(role.getId()); } } return roleIds; }
public Map<String, PollRolePerms> getRoles(String locationReference) { log.debug("Getting permRoles"); Map<String, PollRolePerms> perms = new HashMap<String, PollRolePerms>(); try { AuthzGroup group = authzGroupService.getAuthzGroup(locationReference); Set<Role> roles = group.getRoles(); Iterator<Role> i = roles.iterator(); while (i.hasNext()) { Role role = (Role)i.next(); String name = role.getId(); log.debug("Adding element for " + name); perms.put(name, new PollRolePerms(name, role.isAllowed(PollListManager.PERMISSION_VOTE), role.isAllowed(PollListManager.PERMISSION_ADD), role.isAllowed(PollListManager.PERMISSION_DELETE_OWN), role.isAllowed(PollListManager.PERMISSION_DELETE_ANY), role.isAllowed(PollListManager.PERMISSION_EDIT_OWN), role.isAllowed(PollListManager.PERMISSION_EDIT_ANY) )); } } catch (Exception e) { e.printStackTrace(); } return perms; }
authzGroupService().removeAuthzGroup(authzGroupService().getAuthzGroup(ref));
defaultTemplate = authzService.getAuthzGroup(TEMPLATE_PREFIX); } catch (GroupNotDefinedException e) { throw new JobExecutionException("Couldn't find default template: "+ TEMPLATE_PREFIX + " giving up.", e);
defaultTemplate = authzService.getAuthzGroup(TEMPLATE_PREFIX); } catch (GroupNotDefinedException e) { throw new JobExecutionException("Couldn't find default template: "+ TEMPLATE_PREFIX + " giving up.", e);