Skip to Content.
Sympa Menu

grouper-users - [grouper-users] control on a Framework Attribute in AdminUI

Subject: Grouper Users - Open Discussion List

List archive

[grouper-users] control on a Framework Attribute in AdminUI


Chronological Thread 
  • From: Wallaert-Taquet Brigitte <>
  • To: "" <>
  • Subject: [grouper-users] control on a Framework Attribute in AdminUI
  • Date: Fri, 22 Dec 2017 14:43:17 +0100
  • Ironport-phdr: 9a23:sJwoRxGOLzJfaD3b5FvQh51GYnF86YWxBRYc798ds5kLTJ7yos+wAkXT6L1XgUPTWs2DsrQY07OQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmCexbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOSA5/m/KicJ+gqxUrx29qBFkzI7YfJuYOeZicq7Tf94XQ3dKUMZLVyxGB4Oxd4sAAPAFPeZctYbyuUEOrQenCQeyHuzv0yJIiWHq3aYnzukhCwDG3AMhH9ISrHTbssj+OaAJXuCvzanIwjTDb+9K2Tjj8oTJfAouofWIXb1qb8XR01UvGhjYjlWWqIzlISqZ1uAMs2if6+pvS/+jh3QpqwFruzWiwNonhIfOhoIQ0F/E9CN5zZ4oJd2+SU57f8eoEJ9RtyGeM4t5XN4uT3tmuCYgzLANpJ21fDASxZg52xLTd+GLfo2J7x/iSOqcJDh1iX15dL6ighu+7FSsxvH5W8SxzVpHqjJJnsTCu30CzRDf9NSLR/pn8ku8wzqDyg/e5+FCLEspj6TUMYQhzaQ1lpcLsUTMACv2mELuga+Nc0Uk5vCo5/j6brn8u5+cMY50ih/nPqQqm8y/BeA4PRYTU2SB9+S8zqXv/Uz/QLpUkv07irfVvIzGKcgGo6O0Ag5Y3pom5huwADqqzMkUkHwaIF5ZZB6Kio3kN0zKLfzgCPewmVWskDNlx/DcOb3hB43AIWPZkLfgcrZ96lJcyBYtwtxF6ZNbELUBIPbpVUDvrtzYEgQ0MxGyw+bmFtVxz4ceWWOLAq+dLqzerEWE5uw1I+WUfo8apC79K+Q55/7plXI5lkUdfa603ZsPdn+4BO1qI1iCYXXymNcBCnwHvg4/TOzxlF2CSiBfa2yzX6I6+jE0FpimDYHdSYCxnrCNxjm0EYBLZjMONlfZW3jycJicVu1JdTmfONRJkzoYWKKnRpN7kxyiqUWyn7V9KffM9zddqInuzsNd5uvPmAs0+CAuScmRzjfeYXtzmzY3Tjsy1a1lvQlBw06e3LQwqeZZGt1P+/4BBg0gNJHd0/B3Tc/7XgbIc82VYEugQ8vjBTA1St9ohdEUNRUuU+6+hwzOinL5S4QekKaGUcQ5

Hello,

We use Grouper version 2.3.

We need to control the uniqueness of the value of a attribute named 'nom-liste' on our groups.

This attribute comes with the type put on each group created in NewUI with a Hook.

This attribute 'nom-liste' is filled by adminGrouper via the AdminUI, after the group was first created via NewUI.

I created a new Hook named GroupAttrUpdateHook.java (I take example with AttributeHooksImplExampleEmail.java) that extends AttributeHooks and I put log.

When I fill this attribute (for group 'testbwt3' for example), it seems that the Hook isn't activate. Perhaps AdminUI doesn't accept hook ? Or my Hook need to be modified ?

I join log and extract of my Hook.

Any help is welcome !

Thanks !

--
Logo Université de Lille Sciences et Technologies

Brigitte WALLAERT TAQUET
Ingénieure d'études

Université de Lille - Sciences et Technologies
| www.univ-lille1.fr
Service: CRI Bât. M4 - Bureau 34 59655 Villeneuve d'Ascq
Tél. +33 (0)3 20 33 71 65
2017-12-22 10:38:09,177 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180
2017-12-22 10:38:09,177 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180
2017-12-22 10:38:09,177  INFO attHooks.DeleteAttHooks: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > attributeAssignValuePreInsert()
2017-12-22 10:38:09,179  INFO attHooks.DeleteAttHooks: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > groupId=ec670ffafcc34253b6220dae5a5de862
2017-12-22 10:38:09,180 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180 (3ms)
2017-12-22 10:38:09,180 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180 (3ms)
2017-12-22 10:38:09,190 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181
2017-12-22 10:38:09,190 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181
2017-12-22 10:38:09,196 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181 (6ms)
2017-12-22 10:38:09,196 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181 (6ms)
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182 (1ms)
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182 (1ms)
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183
2017-12-22 10:38:09,201 DEBUG examples.GroupTypeSecurityHook: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > Allowing since cant find rule for groupType: GroupeUdl, adding attribute nom-liste, on group: test_creation_folder:niveau2:niveau3:testbwt3 only have rules for wheel: grouperLoader, grouperGroupMembershipSettings, and groups: empty
2017-12-22 10:38:09,201 DEBUG examples.GroupTypeSecurityHook: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > Allowing since cant find rule for groupType: GroupeUdl, adding attribute nom-liste, on group: test_creation_folder:niveau2:niveau3:testbwt3 only have rules for wheel: grouperLoader, grouperGroupMembershipSettings, and groups: empty
2017-12-22 10:38:09,201 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183 (2ms)
2017-12-22 10:38:09,201 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183 (2ms)
                                           2017-12-22 10:38:09,177 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180
2017-12-22 10:38:09,177 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180
2017-12-22 10:38:09,177  INFO attHooks.DeleteAttHooks: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > attributeAssignValuePreInsert()
2017-12-22 10:38:09,179  INFO attHooks.DeleteAttHooks: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > groupId=ec670ffafcc34253b6220dae5a5de862
2017-12-22 10:38:09,180 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180 (3ms)
2017-12-22 10:38:09,180 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook DeleteAttHooks.attributeAssignValuePreInsert id: TLRZ8180 (3ms)
2017-12-22 10:38:09,190 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181
2017-12-22 10:38:09,190 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181
2017-12-22 10:38:09,196 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181 (6ms)
2017-12-22 10:38:09,196 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GrouperAttributeAssignValueRulesConfigHook.attributeAssignValuePostInsert id: TLRZ8181 (6ms)
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182 (1ms)
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook GroupAttributeNameValidationAttrHook.attributePostInsert id: TLRZ8182 (1ms)
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183
2017-12-22 10:38:09,199 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > START: Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183
2017-12-22 10:38:09,201 DEBUG examples.GroupTypeSecurityHook: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > Allowing since cant find rule for groupType: GroupeUdl, adding attribute nom-liste, on group: test_creation_folder:niveau2:niveau3:testbwt3 only have rules for wheel: grouperLoader, grouperGroupMembershipSettings, and groups: empty
2017-12-22 10:38:09,201 DEBUG examples.GroupTypeSecurityHook: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > Allowing since cant find rule for groupType: GroupeUdl, adding attribute nom-liste, on group: test_creation_folder:niveau2:niveau3:testbwt3 only have rules for wheel: grouperLoader, grouperGroupMembershipSettings, and groups: empty
2017-12-22 10:38:09,201 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183 (2ms)
2017-12-22 10:38:09,201 DEBUG logic.GrouperHooksUtils: < 5094 3A3CE66DDC14570E8CC6EF7A87CE0C30-0015 141e40be943e4c089fe6981eb8cb1994 5094 UDL > END (normal): Hook AttributeSecurityFromTypeHook.attributePostInsert id: TLRZ8183 (2ms)
                                           
public class GroupAttrUpdateHook extends edu.internet2.middleware.grouper.hooks.AttributeHooks {

    private static final Log logger = GrouperUtil.getLog(GroupAttrUpdateHook.class);

    /* pour verifier que le nom de liste donne n a pas deja ete attribue a un autre groupe dans Grouper */
    @SuppressWarnings("unchecked")
    @Override
    public void attributePreUpdate(HooksContext hooksContext, HooksAttributeBean preUpdateBean) {
        logger.info("attributePreUpdate");
        super.attributePreUpdate(hooksContext, preUpdateBean);

        Attribute attributs = preUpdateBean.getAttribute();

        Properties grouperProperties = GrouperConfig.retrieveConfig().properties();
        final String attrNomListe = grouperProperties.getProperty("hooks.groups.typeDefault.nomliste");

//        String groupListeDde = group.getAttributeValue(attrNomListe, false, false);
        // si mise a jour de l attribut pour le mon de la liste alors il faut verifier
        if (StringUtils.equals(attributs.getAttrName(), attrNomListe)) {
            String groupListeDde = attributs.getValue();
            if (!StringUtils.isBlank(groupListeDde)) {
                checkNomListe(groupListeDde, attrNomListe);
            }
        }
    }

 /**
   * <pre>
   * verifie que le nom de liste est unique 
   * </pre>
   * @param groupListeDde is the new nom de liste demande  (changed if update), should not be blank
   */
  static void checkNomListe(final String groupListeDde, final String attrNomListe) {

    try {
      //start session, dont clobber existing session
      GrouperSession grouperSession = GrouperSession.start(SubjectFinder.findRootSubject(), false);
      GrouperSession.callbackGrouperSession(grouperSession, new GrouperSessionHandler() {
        public Object callback(GrouperSession grouperSession)
            throws GrouperSessionException {

           Set<Group> groupes = GroupFinder.findAllByAttribute(grouperSession, attrNomListe, groupListeDde);
           if(groupes != null && groupes.size()>0) {
                throw new HookVeto("","Impossible de donner ce nom de liste :  un groupe utilise " +  groupListeDde + " déjà.");
           }
       return null;
       }
     });
     GrouperSession.stopQuietly(grouperSession);
    } catch (Exception e) {
      throw new RuntimeException("Probleme en controlant le nom de la liste : '" + groupListeDde + "'", e);
    }
}

}

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19.

Top of Page