David, thanks a lot, it worked out the way you expected, just
had to do some small changes !
here's the code for exchanging psml files at runtime !

   // replace psml of accepted user with psml of authority user !

   // get current media type
   // TODO hack to determine media type ?
   String mediaType = "html";
   Profile runDataProfile = Profiler.getProfile(rundata);
   if (runDataProfile != null)
    mediaType = runDataProfile.getMediaType();
   
   // get profile of authority user (dummy user)
   String authTemplateUser = 
JetspeedResources.getString("newuser.geoauthority.template", "geoauthority");
   JetspeedUser authUser = (JetspeedUser)JetspeedSecurity.getUser(authTemplateUser);
   ProfileLocator authLocator = Profiler.createLocator();
   authLocator.setUser(authUser);
   authLocator.setMediaType(mediaType);
   Profile authProfile = Profiler.getProfile(authLocator);
   
   // get profile of accepted user, set new psml document and save it 
   ProfileLocator acceptedUserLocator = Profiler.createLocator();
   acceptedUserLocator.setUser(user);
   acceptedUserLocator.setMediaType(mediaType);
   Profile acceptedUserProfile = Profiler.getProfile(acceptedUserLocator);
   acceptedUserProfile.setDocument( authProfile.getDocument() );
   acceptedUserProfile.store();


p.s.: i know the request was some time ago, but i didn't have time
to test it until now and felt like having to confirm the code :)

................................
martin maidhof
[EMAIL PROTECTED]  |  fon: +49-(0)69-759003-14
w e m o v e  d i g i t a l  s o l u t i o n s  ...  http://www.wemove.com


----- Original Message ----- 
From: "David Sean Taylor" <[EMAIL PROTECTED]>
To: "Jetspeed Users List" <[EMAIL PROTECTED]>
Sent: Monday, May 19, 2003 10:03 PM
Subject: Re: how to exchange psml file of an existing user ?


> 
> On Monday, May 19, 2003, at 03:51  AM, Martin Maidhof wrote:
> 
> > Hi,
> >
> > is it possible to exchange an existing psml file of a user
> > with another one. This doesn't have to take place at runtime,
> > when the user is logged in, instead the admin should have the
> > possibility to exchange the psml file (e.g. approve the user
> > and then the user get's another psml file, if not approved,
> > the user keeps his/her initial psml file).
> >
> > Is there such an interface in the Profiler package ?
> > When role merge is enabled, is the users psml file modified
> > when the admin changes his/her role ? (so maybe i can use that).
> >
> > I tried to use role based psmls but then no psml's are copied
> > to the user (is this right ?). So i keep user based psmls with
> > two default user's for the different user types. When a user
> > creates an account first, he get's the psml file copied from
> > the "first" default user. When he is approved by the admin his
> > psml file should be exchanged with the psml file of the "second"
> > default user.
> >
> > Does this make sense ?
> 
> I haven't actually written a test case for this, but it should work 
> like this...
> 
> ProfileLocator myLocator = Profiler.createLocator();
> myLocator.setUser(me);
> ProfileLocator anotherLocator = Profile.createLocator();
> anotherLocator.setUser(some other user);
> ...
> 
> Profile myProfile = getProfile(myLocator);
> Profile anotherProfile = getProfile(anotherLocator);
> myProfile.setDocument( anotherProfile.getDocument() );
> myProfile.store();
> 
> and then just override the appropriate createNewUserAndConfirm action, 
> or possibly the JetspeedSecurity.createUser method depending on your 
> needs
> 
> --
> David Sean Taylor
> Bluesunrise Software
> [EMAIL PROTECTED]
> +01 707 773-4646
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to