コード例 #1
0
ファイル: StemPrivilegeWindow.java プロジェクト: NCIP/cagrid
  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;
  }
コード例 #2
0
ファイル: GroupUtils.java プロジェクト: NCIP/cagrid-general
 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);
 }
コード例 #3
0
ファイル: GroupUtils.java プロジェクト: NCIP/cagrid-general
 public static boolean isMember(String identity, GroupI group) throws SubjectNotFoundException {
   Subject subject = SubjectUtils.getSubject(identity);
   return group.hasMember(subject);
 }
コード例 #4
0
ファイル: GroupUtils.java プロジェクト: NCIP/cagrid-general
 public static void removeGroupMember(GroupI group, String identity)
     throws SubjectNotFoundException, InsufficientPrivilegeException, MemberDeleteException {
   Subject subject = SubjectUtils.getSubject(identity);
   group.deleteMember(subject);
 }