edu.internet2.middleware.grouper.rules
Class RuleElUtils

java.lang.Object
  extended by edu.internet2.middleware.grouper.rules.RuleElUtils

public class RuleElUtils
extends Object

methods available to EL of rules through the alias: ruleElUtils. Note the methods here are static, and generally should input/output primitives or strings for security reasons

Author:
mchyzer

Constructor Summary
RuleElUtils()
           
 
Method Summary
static boolean addMemberToGroupId(String groupId, String memberId)
          remove a member of a group
static boolean addMemberToGroupName(String groupName, String memberId)
          remove a member of a group
static boolean assignAttributeDefPrivilege(String attributeDefId, String sourceId, String subjectId, String subjectIdentifier, String privilegeNamesCommaSeparated)
          assign attributeDef privileges
static boolean assignGroupPrivilege(String groupId, String sourceId, String subjectId, String subjectIdentifier, String privilegeNamesCommaSeparated)
          assign group privileges
static boolean assignMembershipDisabledDaysForGroupId(String groupId, String memberId, int daysInFuture, boolean addIfNotThere)
          assign a disabled date in the future by X days
static boolean assignPermissionDisabledDaysForAttributeDefId(String attributeDefId, String memberId, int daysInFuture)
          assign a disabled date in the future by X days
static boolean assignStemPrivilege(String stemId, String sourceId, String subjectId, String subjectIdentifier, String privilegeNamesCommaSeparated)
          assign stem privileges
static String formatDate(Date date, String format)
          format a date, default to yyy/MM/dd.
static boolean hasMembershipByGroupId(String groupId, String memberId, String membershipType, String enabled)
           
static boolean removeMemberFromGroupId(String groupId, String memberId)
          remove a member of a group
static boolean removeMemberFromGroupName(String groupName, String memberId)
          remove a member of a group
static RuleVeto veto(String reasonKey, String reason)
          veto this for some reason
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleElUtils

public RuleElUtils()
Method Detail

hasMembershipByGroupId

public static boolean hasMembershipByGroupId(String groupId,
                                             String memberId,
                                             String membershipType,
                                             String enabled)
Parameters:
groupId -
memberId -
membershipType - @see MembershipType, null for all
enabled - null for all, T for only enabled, F for only disabled
Returns:
true if has immediate enabled membership

removeMemberFromGroupId

public static boolean removeMemberFromGroupId(String groupId,
                                              String memberId)
remove a member of a group

Parameters:
groupId -
memberId -
Returns:
true if removed, false if not

removeMemberFromGroupName

public static boolean removeMemberFromGroupName(String groupName,
                                                String memberId)
remove a member of a group

Parameters:
groupName -
memberId -
Returns:
true if removed, false if not

assignGroupPrivilege

public static boolean assignGroupPrivilege(String groupId,
                                           String sourceId,
                                           String subjectId,
                                           String subjectIdentifier,
                                           String privilegeNamesCommaSeparated)
assign group privileges

Parameters:
groupId -
sourceId -
subjectId -
subjectIdentifier -
privilegeNamesCommaSeparated -
Returns:
true if assigned, false if already ther

assignPermissionDisabledDaysForAttributeDefId

public static boolean assignPermissionDisabledDaysForAttributeDefId(String attributeDefId,
                                                                    String memberId,
                                                                    int daysInFuture)
assign a disabled date in the future by X days

Parameters:
attributeDefId -
memberId -
daysInFuture -
Returns:
false if assignments werent there, true if it was

assignMembershipDisabledDaysForGroupId

public static boolean assignMembershipDisabledDaysForGroupId(String groupId,
                                                             String memberId,
                                                             int daysInFuture,
                                                             boolean addIfNotThere)
assign a disabled date in the future by X days

Parameters:
groupId -
memberId -
daysInFuture -
addIfNotThere -
Returns:
false if membership wasnt there, true if it was

veto

public static RuleVeto veto(String reasonKey,
                            String reason)
veto this for some reason

Parameters:
reasonKey -
reason -
Returns:
the exception

assignStemPrivilege

public static boolean assignStemPrivilege(String stemId,
                                          String sourceId,
                                          String subjectId,
                                          String subjectIdentifier,
                                          String privilegeNamesCommaSeparated)
assign stem privileges

Parameters:
stemId -
sourceId -
subjectId -
subjectIdentifier -
privilegeNamesCommaSeparated -
Returns:
true if assigned, false if already ther

assignAttributeDefPrivilege

public static boolean assignAttributeDefPrivilege(String attributeDefId,
                                                  String sourceId,
                                                  String subjectId,
                                                  String subjectIdentifier,
                                                  String privilegeNamesCommaSeparated)
assign attributeDef privileges

Parameters:
attributeDefId -
sourceId -
subjectId -
subjectIdentifier -
privilegeNamesCommaSeparated -
Returns:
true if assigned, false if already ther

formatDate

public static String formatDate(Date date,
                                String format)
format a date, default to yyy/MM/dd. Docs in the Java SimpleDateFormat class.

Parameters:
date -
format -
Returns:
the formatted date
See Also:
SimpleDateFormat

addMemberToGroupId

public static boolean addMemberToGroupId(String groupId,
                                         String memberId)
remove a member of a group

Parameters:
groupId -
memberId -
Returns:
true if removed, false if not

addMemberToGroupName

public static boolean addMemberToGroupName(String groupName,
                                           String memberId)
remove a member of a group

Parameters:
groupName -
memberId -
Returns:
true if removed, false if not