private String addUpdatePrivilege(boolean wasSelected, boolean selectedNow, Privilege priv) throws Exception { String id = Utils.clean(getIdentity().getText()); Subject subj = SubjectUtils.getSubject(id); if (update) { if (!wasSelected && selectedNow) { try { targetStem.grantPriv(subj, priv); return "GRANTED " + priv.getName() + " privilege."; } catch (Exception e) { FaultUtil.logFault(log, e); throw new Exception("ERROR granting " + priv.getName() + " privilege: " + e.getMessage()); } } else if (wasSelected && !selectedNow) { try { targetStem.revokePriv(subj, priv); return "REVOKED " + priv.getName() + " privilege."; } catch (Exception e) { FaultUtil.logFault(log, e); throw new Exception("ERROR revoking " + priv.getName() + " privilege: " + e.getMessage()); } } } else { if (selectedNow) { try { targetStem.grantPriv(subj, priv); return "GRANTED " + priv.getName() + " privilege."; } catch (Exception e) { FaultUtil.logFault(log, e); throw new Exception("ERROR granting " + priv.getName() + " privilege: " + e.getMessage()); } } } return null; }
public static void addGroupPrivilege(String identity, StemI stem) throws GrantPrivilegeException, InsufficientPrivilegeException, SchemaException, SubjectNotFoundException { Subject subject = SubjectUtils.getSubject(identity); stem.grantPriv(subject, edu.internet2.middleware.grouper.NamingPrivilege.CREATE); }
public static boolean isMember(String identity, GroupI group) throws SubjectNotFoundException { Subject subject = SubjectUtils.getSubject(identity); return group.hasMember(subject); }
public static void removeGroupMember(GroupI group, String identity) throws SubjectNotFoundException, InsufficientPrivilegeException, MemberDeleteException { Subject subject = SubjectUtils.getSubject(identity); group.deleteMember(subject); }