Can't get custom defined attributes using PUMA SPI - Websphere

This is a discussion on Can't get custom defined attributes using PUMA SPI - Websphere ; Description: When we try to get custom attributes from objects with custom objectclasses from LDAP, method PumaProfile.getAttributes( , ) return Map, without that attributes. But when we try to search principal by attributes (PumaLocator.findGroupsByAttribute( , ) ), we get non ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Can't get custom defined attributes using PUMA SPI

  1. Can't get custom defined attributes using PUMA SPI

    Description:

    When we try to get custom attributes from objects with custom objectclasses from LDAP, method PumaProfile.getAttributes(, ) return Map, without that attributes. But when we try to search principal by attributes (PumaLocator.findGroupsByAttribute(, ) ), we get non empty list, with correct result.

    Environment:

    WebSphere AS 6.0.2.15
    WebSphere Portal 5.1.0.4
    SunOne DS 5.2.p4

    Code:

    javax.naming.Context ctx = new javax.naming.InitialContext();
    PortletServiceHome psh = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
    if (psh != null) {
    PumaHome service = (PumaHome) psh.getPortletService(PumaHome.class);
    PumaLocator pl = service.getLocator(request);
    PumaController pc = service.getController(request);
    PumaController pp = service.getController(request);
    List groups = pl.findGroupsByAttribute("myattribute", "value");
    if (groups.size > 0) {
    // If we specified correct search criteria result.size() not equals zero
    Group group = (Group) groups.get(0);
    List attrNames = new ArrayList();
    attrNames.add("myattribute");
    Map attrs = pp.getAttributes(group, attrNames);
    String value = attrs.get("myattribute");
    // Variable "value" allways equals null
    }
    }

    Ldap schema:

    attributeTypes: ( 1.3.6.1.4.1.9052.1.2.1.1.1 NAME 'myattribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'user
    defined' )
    objectClasses: ( 1.3.6.1.4.1.9052.1.2.1.2.8 NAME 'myobjectclass' SUP groupofuniquenames STRUCTURAL MUST myattribute X-ORIGIN 'user defined' )

    WMM configuration:

    wmmAttributes.xml:
    applicableMemberTypes="Group"
    dataType="String"
    valueLength="10"
    multiValued="false"/>

    wmmLDAPServerAttributes.xml:
    pluginAttributeName="myattribute"
    applicableMemberTypes="Group"
    dataType="String"
    valueLength="10"
    multiValued="false"/>

    wmm.xml:
    rdnAttrTypes="cn"
    objectClassesForRead="groupOfUniqueNames;myobjectclass"
    objectClassesForWrite="groupOfUniqueNames;myobjectclass"
    searchBases="ou=groups,dc=ru"/>

  2. mistake in post

    In my post ldap right ldap schema:
    attributeTypes: ( 1.3.6.1.4.1.9052.1.2.1.1.1 NAME 'myattribute' SYNTAX
    1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )

    This not solution, this only fix for post.


  3. Re: Can't get custom defined attributes using PUMA SPI

    Hi,
    I am trying to set values for the attributes stored in LADatabase.Its a
    JSR 168 portlet.
    I went through some of the examples and the SPI.

    There were 3 PumaHome classes. I just wanted to know which one should i
    use?

    com.ibm.portal.um.PumaHome
    or
    com.ibm.portal.portlet.service.PortletService.Puma Home

    In which cases the above two classes are used?

    Can we use com.ibm.portal.um.PumaHome in jsr 168 portlet?

    In the below code can we do
    com.ibm.portal.um.PumaHome service = (com.ibm.portal.um.PumaHome)
    psh.getPortletService(com.ibm.portal.um.PumaHome.c lass);

    Thanks Prashant

    fatroom@gmail.com wrote:
    > Description:
    >
    > When we try to get custom attributes from objects with custom objectclasses from LDAP, method PumaProfile.getAttributes(, ) return Map, without that attributes. But when we try to search principal by attributes (PumaLocator.findGroupsByAttribute(, ) ), we get non empty list, with correct result.
    >
    > Environment:
    >
    > WebSphere AS 6.0.2.15
    > WebSphere Portal 5.1.0.4
    > SunOne DS 5.2.p4
    >
    > Code:
    >
    > javax.naming.Context ctx = new javax.naming.InitialContext();
    > PortletServiceHome psh = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
    > if (psh != null) {
    > PumaHome service = (PumaHome) psh.getPortletService(PumaHome.class);
    > PumaLocator pl = service.getLocator(request);
    > PumaController pc = service.getController(request);
    > PumaController pp = service.getController(request);
    > List groups = pl.findGroupsByAttribute("myattribute", "value");
    > if (groups.size > 0) {
    > // If we specified correct search criteria result.size() not equals zero
    > Group group = (Group) groups.get(0);
    > List attrNames = new ArrayList();
    > attrNames.add("myattribute");
    > Map attrs = pp.getAttributes(group, attrNames);
    > String value = attrs.get("myattribute");
    > // Variable "value" allways equals null
    > }
    > }
    >
    > Ldap schema:
    >
    > attributeTypes: ( 1.3.6.1.4.1.9052.1.2.1.1.1 NAME 'myattribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'user
    > defined' )
    > objectClasses: ( 1.3.6.1.4.1.9052.1.2.1.2.8 NAME 'myobjectclass' SUP groupofuniquenames STRUCTURAL MUST myattribute X-ORIGIN 'user defined' )
    >
    > WMM configuration:
    >
    > wmmAttributes.xml:
    > > applicableMemberTypes="Group"
    > dataType="String"
    > valueLength="10"
    > multiValued="false"/>
    >
    > wmmLDAPServerAttributes.xml:
    > > pluginAttributeName="myattribute"
    > applicableMemberTypes="Group"
    > dataType="String"
    > valueLength="10"
    > multiValued="false"/>
    >
    > wmm.xml:
    > > rdnAttrTypes="cn"
    > objectClassesForRead="groupOfUniqueNames;myobjectclass"
    > objectClassesForWrite="groupOfUniqueNames;myobjectclass"
    > searchBases="ou=groups,dc=ru"/>



  4. Re: Can't get custom defined attributes using PUMA SPI

    You should add the attribute to group.minimum.attributes in the file /shared/app/config/services/PumaService.properties.

    Also add it to LDAPGroupMinimumAttributes in wpconfig.properties.

  5. Thumbs up Re: Can't get custom defined attributes using PUMA SPI

    Use the followings:
    import com.ibm.portal.um.User;
    import com.ibm.portal.um.Group;
    import com.ibm.portal.um.Principal;
    import com.ibm.portal.um.PumaProfile;
    import com.ibm.portal.um.PumaLocator;
    import com.ibm.portal.um.PumaController;
    import com.ibm.portal.um.portletservice.PumaHome;
    import com.ibm.portal.um.exceptions.PumaException;
    import com.ibm.portal.um.exceptions.PumaModelException;
    import com.ibm.portal.um.exceptions.PumaSystemException;
    import com.ibm.portal.um.exceptions.PumaAttributeExceptio n;
    import com.ibm.portal.um.exceptions.PumaMissingAccessRigh tsException;
    import com.ibm.portal.portlet.service.PortletServiceUnava ilableException;

    final String PUMA_HOME_NAME = "portletservice/com.ibm.portal.um.portletservice.PumaHome";

    javax.naming.Context ctx = new javax.naming.InitialContext();
    PortletServiceHome psh = (PortletServiceHome) ctx.lookup(PUMA_HOME_NAME);

    PumaHome pumaHome = (PumaHome) psh
    .getPortletService(PumaHome.class);
    PumaProfile pp = pumaHome.getProfile(request);

    List attributesNamesList = pp.getDefinedUserAttributeNames();

    Map userInfo = (Map) pp.getAttributes(
    (com.ibm.portal.um.Principal) user,
    attributesNamesList);

    Regards,
    Anadi KUMAR
    Architecture and R2ds, Channels and Framework, Software Engineer | HSBC Technology and Services - Global Technology
    HSBC Software Development (India)Limited
    GLT 4.0 - Panchshil Tech. Park, Block D, S.No. 19, Hissa 2A/11/2, Yerawada, Pune, 411006.
    India.

    Mobile. +91 99822622054
    Email. anadikumar@hsbc.co.in
    Email. anadikumar@gmail.com

+ Reply to Thread