Skip to Content.
Sympa Menu

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

Subject: Grouper Users - Open Discussion List

List archive

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


Chronological Thread 
  • From: Wallaert Taquet Brigitte <>
  • To: "Hyzer, Chris" <>
  • Cc: "" <>
  • Subject: Re: [grouper-users] control on a Framework Attribute in AdminUI
  • Date: Thu, 4 Jan 2018 10:59:05 +0100
  • Ironport-phdr: 9a23:9K2TVx0ocyWlLV0ZsmDT+DRfVm0co7zxezQtwd8ZseMVLPad9pjvdHbS+e9qxAeQG9mDsrQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPfglEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLmlTkJNzA5/m/UhMJ/gq1UrxC9qBFkxo7YfJuYOeBicq7Tf94XQ3dKUMZLVyxGB4Oxd4sAAPAFPeZctYbyuUEOrQejDgeyHuzv0yJIiWHq3aYnzukhCwDG3AMhH9ISrHTbssj+OaAPXOCvzanIwjTDb+9K2Tjj8oTHcgouofWIXb1qb8XR01UvGhjYjlWWqIzlISqZ1uAMs2if6+pvS/+jh3QpqwFruzWiwNonhIfOhoIQ0F/E9CN5zZ4oJd2+SU57f8eoEJ9RtyGeM4t5XN4uT3tmuCYgzLANpJ21fDASxZg52xLTd+GLfo2J7x/iSOqcJDh1iX15dL6ighu+7FSsxvH5W8SxzVpHqjJJnsTCu30CzRDf9NSLR/pn8ku8wzqDyg/e5+FCLEspj6TUMYQhzaQ1lpcLsUTMACv2mELuga+Nc0Uk5vCo5/j6brn8u5+cMY50ih/nPqQqm8y/BeA4PRYTU2SB9+S8zqXv/Uz/QLpUkv07irfVvIzGKcgGo6O0Ag5Y3pom5huwADqqzMkUkHwaIF5ZZB6Kio3kN0zKLfzgCPewmVWskDNlx/DcOb3hB43AI2XZkLfgcrZ96lJcyBYtwtxF551bELUBIPbpVUDvrtzYEgQ0MxGyw+bmFtVxz4ceWWOLAq+dLqzerEWE5uw1I+WUfo8apC79K+Q55/7plXI5lkUdfa603ZsPdn+4BO1qI1iCYXXymNcBCnwHvg4/TOzxlF2CSiBfa2yzX6I6+jE0FpimDYHdSYCxnrCNxjm0EYBLZjMONlfZW1f5ZYieH78naDiTOYUpxjkPVamzRpUJ1Aql8hLixrxhaOfY53tLm4jk0Y1K7unXnBwo6XRIBt2A3n3FZXt1kWIUWzJ+iIploEN81kuOl5dxh/hRGMZPz+5PUxl/MZ/Yy+EjTd7oDFGSNuyVQUqrF431SQo6Scg8locD

Hello Chris and every member of this list,

First, I present you my best wishes for 2018 !

So, I modified grouper.properties but the Hook doesn't fire.
So, I modified my code to extends AttributeAssignValueHooks insteed of
AttributeHooks (cf GroupAttrUpdateHook.java) and simplify the code. Now, it fire.

But unlike in the NewUI when an hook is declenched (cf anotherHook-BestMsg-NewUI.jpg), I obtain a bad message after validation (cf screen-AdminUI.jpg and error-AdminUI.jpg).  Perhaps something to do to obtain a better message in AdminUI ?

Thanks !
Brigitte

Note :
In grouper_ui.log, I obtain the message :
2018-01-04 10:18:22,486  INFO attHooks.GroupAttrUpdateHook: < 5094 07A2721A02D48C860D35E72207F822EA-0012 f2609840d8df4b5591311da98745eaa5 5094 UDL > GroupAttrUpdateHook()
2018-01-04 10:18:22,487  INFO attHooks.GroupAttrUpdateHook: < 5094 07A2721A02D48C860D35E72207F822EA-0012 f2609840d8df4b5591311da98745eaa5 5094 UDL > attributeAssignValuePreInsert()
2018-01-04 10:18:22,497 DEBUG logic.GrouperHooksUtils: < 5094 07A2721A02D48C860D35E72207F822EA-0012 f2609840d8df4b5591311da98745eaa5 5094 UDL > END (veto): Hook GroupAttrUpdateHook.attributeAssignValuePreInsert id: TMAKCMCU (11ms), veto key: , veto message: Attribut nom-liste:liste-test-bwt deja utilise.
2018-01-04 10:18:22,497 DEBUG logic.GrouperHooksUtils: < 5094 07A2721A02D48C860D35E72207F822EA-0012 f2609840d8df4b5591311da98745eaa5 5094 UDL > END (veto): Hook GroupAttrUpdateHook.attributeAssignValuePreInsert id: TMAKCMCU (11ms), veto key: , veto message: Attribut nom-liste:liste-test-bwt deja utilise.


Le 23/12/2017 à 20:51, Brigitte Wallaert Taquet a écrit :
Hello,

Thanks for response. Yes, I forget the declaration in grouper.properties... Sorry. I will correct this mistake.
Yes, could you please give me the suggestion ?

Thanks !
Merry Christmas !
Brigitte
Le Vendredi 22 Décembre 2017 18:31 CET, "Hyzer, Chris" a écrit:
 
 

Are you configuring it in the grouper.properties?  I might have a suggestion for slightly different code for you if you like…

 

From: [] On Behalf Of Wallaert-Taquet Brigitte
Sent: Friday, December 22, 2017 8:43 AM
To:
Subject: [grouper-users] control on a Framework Attribute in AdminUI

 

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 !

--


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




 


Attachment: anotherHook-BestMsg-NewUI.jpg
Description: JPEG image

Attachment: screen-AdminUI.jpg
Description: JPEG image

Attachment: error-AdminUI.jpg
Description: JPEG image

public class GroupAttrUpdateHook extends edu.internet2.middleware.grouper.hooks.AttributeAssignValueHooks {

    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 attributeAssignValuePreInsert(HooksContext hooksContext, HooksAttributeAssignValueBean preInsertBean) {
        logger.info("GroupAttrUpdateHook()");
        logger.info("attributeAssignValuePreInsert()");
        super.attributeAssignValuePreInsert(hooksContext, preInsertBean);

        // recuperer le groupe en cours
        AttributeAssignValue attributAV = preInsertBean.getAttributeAssignValue();

        // prendre le nom de l attribut parametre dans le fichier de configuration
        Properties grouperProperties = GrouperConfig.retrieveConfig().properties();
        final String attrNomListe = grouperProperties.getProperty("hooks.groups.typeDefault.nomliste");

        // la modification concerne-t-elle l attribut nom de liste ?
        // getExtension retourne une valeur de type : legacyAttribute_nomattribut
        String attrConcerne = attributAV.getAttributeAssign().getAttributeDefName().getExtension();

        // si mise a jour de l attribut pour le mon de la liste alors il faut verifier
        if (StringUtils.contains(attrConcerne, attrNomListe)) {
           String nomListeDde = attributAV.getValueString();
           Set<Group> groupes = GroupFinder.findAllByAttribute(hooksContext.grouperSession().internal_getRootSession(), attrNomListe, nomListeDde);
           if(groupes != null && groupes.size()>0) {
                throw new HookVeto("","Attribut " + attrNomListe + ":" +  nomListeDde + " deja utilise.");
           }
        }
    }
}


  • Re: [grouper-users] control on a Framework Attribute in AdminUI, Wallaert Taquet Brigitte, 01/04/2018

Archive powered by MHonArc 2.6.19.

Top of Page