How to create/modify a user outside of a portlet ? (WPS 5.1)
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > How to create/modify a user outside of a portlet ? (WPS 5.1)




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-04-06 06:33 AM

Hi all.
I want to use the PUMA API (WPS 5.1) to create/modify users from a stateless
 session bean, but the PUMA SPI javadoc indicates that the getController() m
ethod of PumaHome needs to be passed a ServletRequest. Apparently this API i
s meant to be used only fro
m within a portlet or servlet.
Can anyone help ?





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-04-06 06:34 PM

No ideas ??





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-06 12:31 PM

Have you solved it?





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-06 12:31 PM

Yes and no.
We had to use a workaround, by calling the getController from a servlet inst
ead of from a POJO or Session bean like we wanted.
This means that we send our user data as POST HTTP request to the servlet, a
nd call PUMA from the doPost.
It's not very satisfying as far as architecture goes, but it seems to work.
IBM support tells that they fixed that issue in Portal 6.0, where they added
 a getController method that doesn't require a ServletRequest as a parameter
.





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-06 12:31 PM

Thanks for fast answer.





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-20-06 12:30 AM

The easiest way is invoquing the MemberService EJB. You can do this like tha
t:

public void createUserInGroup(String userName, Map attributes)
throws IOException, WMMException {

Member user = MemberFactory.getInstance(Member.MEMBER_TYPE_PERSON);
String memberDN = "uid=" + userName + "," + BASE_DN;
String memberUniqueId = userName;
MemberIdentifier mi = MemberIdentifierFactory.getInstance(memberDN,
memberUniqueId);
user.setMemberIdentifier(mi);

String pMemberDN = BASE_DN;
String pMemberUniqueId = "";

MemberIdentifier pmi = MemberIdentifierFactory.getInstance(pMemberDN,
pMemberUniqueId);
user.setParentMemberIdentifier(pmi);

Attribute uid = AttributeFactory.getInstance("uid", userName);
user.addAttribute(uid);

Set set = attributes.entrySet();
for (Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
Attribute att = AttributeFactory.getInstance(entry.getKey()
.toString(), entry.getValue());
user.addAttribute(att);
}
mm.createMember(user);
}

where mm is contains a reference of an instance of com.ibm.websphere.wmm.obj
ects.MemberService
which can be obtained as

String jndiPath = "ejb/MemberServiceHome";
String contextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
;
String host = "host.name";
String port = "2811";

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
env.put(Context.PROVIDER_URL, "iiop://" + host + ":" + port);
Context initial = new InitialContext(env);
Object objref = initial.lookup(jndiPath);
MemberServiceHome home = (MemberServiceHome) PortableRemoteObject
.narrow(objref, MemberServiceHome.class);

mm = home.create();


You have to include in the classpath

<portal>/AppServer/lib/namingclient.jar
<portal>/AppServer/lib/naming.jar
<portal>/AppServer/lib/wmm.ejb.jar
<portal>/AppServer/lib/wmm.jar
<portal>/AppServer/lib/j2ee.jar








[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-22-06 06:25 PM

I'm sure what you suggests works, but my main goal is to use only PUBLIC API
s, not undocumented inner APIs that customers are not supposed to call.
We've been using the UserManager object for years to manipulate WMM, but our
 customer wants us to be as standard as possible.





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-22-06 06:25 PM

Thanks. and could you specify what parameters required for user creation?





[ Post a follow-up to this message ]



    Re: How to create/modify a user outside of a portlet ? (WPS 5.1)  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-06 06:23 PM

Hi everyone,
I am currently using Puma in WebSphere 5.1 and I try do a create user with t
he
following code:
"
Name myjndiname = new CompositeName(PumaHome.JNDI_NAME);
PumaHome myHome = (PumaHome) ctx.lookup(myjndiname);
pumaController = myHome.getController(servletRequest);
pumaController.createUser("shortname","ou=People,dc=Organisation,dc=com",att
ributes);
"
where attribute is an HashMap.

This code is called from a servlet deployed on the WebSphere_Portal server i
nstance.

When I am trying to execute the servlet, I am getting the following error:

"java.lang.NullPointerException
at com.ibm.wps.services.puma.PumaServiceWrapperImpl. checkACPermission(PumaS
erviceWrapperImpl
java:205)"

I don't know what is wrong only with the current error message.
Could some one help me with this problem?
Thanks in advance.
Best Regards, Arnaud.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:04 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register