Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added v2.3 UI steps to add a the rule

...

Code Block
//get back to normal data
gsh 13% delMember("stem:a", "test.subject.0");
true

//subject0 should not be there
gsh 15% addMember("stem:a", "test.subject.0");
true

//subject1 is ok
gsh 16% addMember("stem:a", "test.subject.1");
true

//subject2 has a disabled date already, and shouldnt be touched
gsh 17% addMember("stem:a", "test.subject.2");
true

gsh 18% addMember("stem:b", "test.subject.1");
true
gsh 20% subject1 = SubjectFinder.findById("test.subject.1", true);
subject: id='test.subject.1' type='person' source='jdbc' name='my name is test.subject.1'
gsh 21% subject2 = SubjectFinder.findById("test.subject.2", true);
subject: id='test.subject.2' type='person' source='jdbc' name='my name is test.subject.2'
gsh 22% member1 = MemberFinder.findBySubject(grouperSession, subject1, false);
member: id='test.subject.1' type='person' source='jdbc' uuid='328d340a9d6d4774af8d12c1a6753d8e'
gsh 23% member2 = MemberFinder.findBySubject(grouperSession, subject2, false);
member: id='test.subject.2' type='person' source='jdbc' uuid='8f039afe4adf4770ad5ade263031f558'

//set disabled date for subject2
gsh 24% membership = groupA.getImmediateMembership(Group.getDefaultList(), member2, true, true);
edu.internet2.middleware.grouper.Membership: Membership[createTime=1285559733570,creatorUuid=7a06fd612353403dafe003630a5205a7,depth=0,listName=members,listType=list,memberUuid=8f039afe4adf4770ad5ade263031f558,groupId=9c1f128179d444c6970499e1a274dfa4,type=immediate,uuid=d3508dd616954915be37a6bbb2cdbce9:65d65d4d43d049358ca5348e81a6a1a3]
gsh 26% membership.setDisabledTime(new java.sql.Timestamp(System.currentTimeMillis() + (3 * 24 * 60 * 60 * 1000)));
gsh 27% GrouperDAOFactory.getFactory().getMembership().update(membership);

//run the daemon
gsh 28% status = GrouperLoader.runOnceByJobName(grouperSession, GrouperLoaderType.GROUPER_RULES);
loader ran successfully: Ran rules daemon, changed 0 records

//all groups should still have the members
gsh 29% hasMember("stem:a", "test.subject.0");
true
gsh 30% hasMember("stem:a", "test.subject.1");
true
gsh 31% hasMember("stem:a", "test.subject.2");
true

//the first one has 7 day forward disabled date
gsh 32% membership = groupA.getImmediateMembership(Group.getDefaultList(), member0, true, true);
edu.internet2.middleware.grouper.Membership: Membership[createTime=1285559719988,creatorUuid=7a06fd612353403dafe003630a5205a7,depth=0,listName=members,listType=list,memberUuid=090557f1838d40c4b594234632d82dae,groupId=9c1f128179d444c6970499e1a274dfa4,type=immediate,uuid=6d4e0e55ad7d496785a5d4df522fbbab:65d65d4d43d049358ca5348e81a6a1a3]
gsh 33% membership.getDisabledTime()
java.sql.Timestamp: 2010-10-03 23:58:37.904

//second one is ok, has no disabled date
gsh 34% membership = groupA.getImmediateMembership(Group.getDefaultList(), member1, true, true);
edu.internet2.middleware.grouper.Membership: Membership[createTime=1285559728869,creatorUuid=7a06fd612353403dafe003630a5205a7,depth=0,listName=members,listType=list,memberUuid=328d340a9d6d4774af8d12c1a6753d8e,groupId=9c1f128179d444c6970499e1a274dfa4,type=immediate,uuid=64ed8f25035d475490f774bd798910a0:65d65d4d43d049358ca5348e81a6a1a3]
gsh 35% membership.getDisabledTime()

//subject2 should keep the old disabled date, 3 days in future
gsh 36% membership = groupA.getImmediateMembership(Group.getDefaultList(), member2, true, true);
edu.internet2.middleware.grouper.Membership: Membership[createTime=1285559733570,creatorUuid=7a06fd612353403dafe003630a5205a7,depth=0,listName=members,listType=list,memberUuid=8f039afe4adf4770ad5ade263031f558,groupId=9c1f128179d444c6970499e1a274dfa4,type=immediate,uuid=d3508dd616954915be37a6bbb2cdbce9:65d65d4d43d049358ca5348e81a6a1a3]
gsh 37% membership.getDisabledTime()
java.sql.Timestamp: 2010-09-29 23:58:07.517
gsh 38%

Steps to add the rule via the UI ( Likely requires Wheel level access )

Assume there is a "source group" and a "target group". (The groups can be anywhere in Grouper.)

When a Membership is removed from "source group" the rule should add a membership to "target group" and set the new Membership to expire in 7 days. (Note: This date will be reset every time the user is removed from the "source group". )

  • Navigate to the "target group" in the UI.
  • Assign Attribute: etc:attribute:rules:rule to the group ( with the "More actions" button/menu, and the "Attribute assignments" menu item, then the "+ Assign attribute" button and paste in to the 'Attribute name:' field)
  • Add meta data assignments to that attribute ( Find the attribute "rule" in the list and click on the "Actions" button on that row in the "Choose action" column and select the "Add metatdata Assignment") for each of the following additional attributes. The order that you add these in does not matter. (much) You can also choose to add all the attribute then add all the data values as a "second pass" too. 
  • Add metadata assignment: etc:attribute:rules:ruleActAsSubjectSourceId
    • Add value ="g:isa"  ( Add values by clicking on the "Actions" button at the end of the new row then select "Add value". Next set the value into the 'Value to add' and click the 'Submit' button to be send back to the Assigned Attributes table.)
  • Add metadata assignment: etc:attribute:rules:ruleActAsSubjectId
    • Add value ="GrouperSystem"  ( Add values by clicking on the "Actions" button ...)
  • Add metadata assignment: etc:attribute:rules:ruleCheckType
    • Add value ="membershipRemove" ( Add values by clicking on the "Actions" button ...)
  • Add metadata assignment: etc:attribute:rules:ruleCheckOwnerName
    • Add value ="<full path to the source group (example: userFolders:testUser:aGroup )>"  ( Add values by clicking on the "Actions" button ...)
  • Add metadata assignment: etc:attribute:rules:ruleThenEnum
    • Add value ="assignMembershipDisabledDaysForOwnerGroupId" ( Add values by clicking on the "Actions" button ...)
  • Add metadata assignment: etc:attribute:rules:ruleThenEnumArg0
    • Add value ="<int days in future to disable membership>" ( Add values by clicking on the "Actions" button ...)
  • Add metadata assignment: etc:attribute:rules:ruleThenEnumArg1
    • Add value ="<T = create membership if it does not exits, F= don't create>" ( Add values by clicking on the "Actions" button ...)

If you did everything properly the system will add an additional metatdata assignment of etc:attribute:rules:ruleValid with a value of "T". ( Or it will be set to an error message to help you figure out where the problem is. (smile) ) Until the value is "T" the rule will not be effective.

a