I have a JSP that handles this, using the current JSPWiki
code. It
first checks to ensure that the user is an admin, and then
it allows
that user to create new accounts, delete existing accounts
and change
passwords/e-mail addresses.
The part that creates new accounts is pretty simple - it
consists mainly
of this logic:
WikiContext wikiContext =
WikiContext.findContext(pageContext);
WikiEngine m_engine = wikiContext.getEngine();
UserManager manager = m_engine.getUserManager();
UserProfile profile =
manager.getUserDatabase().newProfile();
profile.setLoginName( loginName );
profile.setEmail( email );
profile.setFullname( fullname );
profile.setPassword( password );
profile.setWikiName( wikiname );
//--check to ensure that new user doesn't
already exist -
NOTE: Skipped for now, but needed
//manager.setUserProfile(wikiSession,profile);
//--Make the changes to the in-memory database
manager.getUserDatabase().save(profile);
//--make the changes to the on-disk database
manager.getUserDatabase().commit();
You should add a check to prevent creating a duplicate user
loginName,
WikiName or FullName.
Erik Bunn wrote:
>
> On Oct 16, 2006, at 13:55 , Terry Steichen wrote:
>
>> Erik Bunn wrote:
>>> Is there any within-JSPWiki way of adding a
user once I've set the
>>> policy to prevent access by anyone but
authenticated users?
>> Presumably you're talking about having an
administrator create user
>> accounts (since a policy that prevents access by
unauthenticated
>> users would obviously prevent users from doing it
themselves)? If
>> so, I can help. Otherwise, I'm not clear what
you're seeking to do.
>
> That would be the case. Is there a way of doing this
with the current
> CVS code?
>
> Thanks,
> //ebu
> _______________________________________________
> Jspwiki-users mailing list
> Jspwiki-users ecyrd.com
> http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
a>
>
_______________________________________________
Jspwiki-users mailing list
Jspwiki-users ecyrd.com
http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
a>
|