/** * @inheritDoc * @see org.sakaiproject.content.api.GroupAwareEdit#clearRoleAccess() */ public void clearRoleAccess() throws PermissionException { Set<String> roles = getRoleViews(this.m_id); for (String role : roles) { try { setRoleView(this.m_id, role, false); } catch (AuthzPermissionException e) { throw new PermissionException(e.getUser(), e.getFunction(), e.getResource()); } } if (roles.size() > 0) { this.m_accessUpdated = true; } this.m_access = AccessMode.INHERITED; this.m_groups.clear(); }
/** * @inheritDoc * @see org.sakaiproject.content.api.GroupAwareEdit#removeRoleAccess(String) */ public void removeRoleAccess(String roleId) throws InconsistentException, PermissionException { if (roleId == null || roleId.isEmpty()) { throw new InconsistentException("BasicGroupAwareEdit#removeRoleAccess - Must specify a role to remove for content " + this.getReference()); } if (isRoleView(this.m_id, roleId)) { try { setRoleView(this.m_id, roleId, false); } catch (AuthzPermissionException e) { throw new PermissionException(e.getUser(), e.getFunction(), e.getResource()); } this.m_accessUpdated = true; this.m_access = AccessMode.INHERITED; this.m_groups.clear(); } }
/** * @inheritDoc * @see org.sakaiproject.content.api.GroupAwareEdit#addRoleAccess(String) */ public void addRoleAccess(String roleId) throws InconsistentException, PermissionException { if (roleId == null || roleId.isEmpty()) { throw new InconsistentException("BasicGroupAwareEdit#addRoleAccess - Must specify a role to remove for content " + this.getReference()); } if (!this.getInheritedGroups().isEmpty()) { throw new InconsistentException(String.format("BasicGroupAwareEdit#addRoleAccess: could not assign role %s because content %s inherits group access.", roleId, this.getReference())); } if (getInheritedRoleAccessIds().contains(roleId)) { throw new InconsistentException(String.format("BasicGroupAwareEdit#addRoleAccess: could not assign role %s because content %s inherits role access.", roleId, this.getReference())); } if (!(isRoleView(this.m_id, roleId))) { try { setRoleView(this.m_id, roleId, true); } catch (AuthzPermissionException e) { throw new PermissionException(e.getUser(), e.getFunction(), e.getResource()); } this.m_accessUpdated = true; this.m_access = AccessMode.INHERITED; this.m_groups.clear(); } }
/** * @inheritDoc */ public void unjoin(String id) throws IdUnusedException, PermissionException { try { authzGroupService().unjoinGroup(siteReference(id)); } catch (GroupNotDefinedException e) { throw new IdUnusedException(e.getId()); } catch (AuthzPermissionException e) { throw new PermissionException(e.getUser(), e.getFunction(), e.getResource()); } }
throw new PermissionException(e.getUser(), e.getFunction(), e.getResource());