You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Marina <pp...@yahoo.com> on 2005/02/01 22:26:00 UTC

users/roles/groups creation and saving

Hi!

 I'm trying to find an easy way to add new
users/roles/groups to J2 permanently (using HSQL DB
for now). By that I mean that I want to persist newly
created objects in the DB between upgrades of J2.

Currently, when you update and rebuild J2 from CVs,
for example, you have to run the 'maven quickStart'
goal, otherwise none of the web applications
(/jetspeed, etc.) get deployed into the Tomcat.
Unfortunately, this goal also wipes out your DB clean
and you have to re-create all your custom
users/groups/roles...

After going through this (painful, if you have many
users) exercise a few times, I decided to write my own
version of the populate-default-db.sql - kind of
script.

The problem is that I'm not sure what are dependences
between all tables and it was not that easy to find
what tables changed after you add, say, a new user
since you don't really know which tables you should be
monitoring.

Because of that, I have a few questions:

1. could somebody complete my list of tables that have
to be modified when use create custom users and roles
and want to tie them together?
  So far I have:

  to create a new role:
  PREFS_NODE 
  SECURITY_PRINCIPAL 

  to create a new user and assign the new role to it:
  SECURITY_PRINCIPAL 
  PRINCIPAL_ROLE_ASSOC
  SECURITY_USER_ROLE
  SECURITY_USER_GROUP

  This actually does not work - I guess I missed a few
tables...


2. Is there a way to save a 'snapshot' of a working DB
with all new objects and use that in a new J2
installation?

3. if all else fails, where is the actual data for the
HSQL DB stored? Maybe I could use some kind of 'diff'
on it after I add a new user ...

Thank you!
Marina


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: users/roles/groups creation and saving

Posted by Marina <pp...@yahoo.com>.
David, thanks a lot for your help!

After looking more closely at the HSQL DB scripts and
the populate DB scripts I was able to create a bare
minimum custom script for my portal.

I thought I'd share this with the group on case it
might help somebody to do the same:

Here is a minimal script to create a new user, new
role and assign the role to the user:


INSERT INTO SECURITY_PRINCIPAL
VALUES(54,'org.apache.jetspeed.security.InternalRolePrincipalImpl',false,true,'/role/dce-admin-role','2005-02-02
15:02:54.171','2005-02-02 15:02:54.171')

INSERT INTO SECURITY_PRINCIPAL
VALUES(56,'org.apache.jetspeed.security.InternalUserPrincipalImpl',false,true,'/user/dce-admin','2005-02-02
15:03:27.624','2005-02-02 15:03:27.64')

INSERT INTO SECURITY_CREDENTIAL
VALUES(53,56,'some_password',0,'org.apache.jetspeed.security.spi.impl.DefaultPasswordCredentialImpl',false,false,true,0,false,'2005-02-02
15:03:27.64','2005-02-02
15:03:27.64',NULL,NULL,'2005-04-03')

INSERT INTO SECURITY_USER_ROLE VALUES(56,54)

// not necessary if you are OK with a default
profiling rule
INSERT INTO PRINCIPAL_RULE_ASSOC
VALUES('dce-admin','page','role-fallback')
INSERT INTO PRINCIPAL_RULE_ASSOC
VALUES('dce-admin','docset','role-fallback')


One question:
Now that I have a basic SQL script to create a new
user, I thought I could use it in a "RegisterPortlet"
where a new user could register himself by typing in
his username/password, and , as a result, the portlet
would execute the SQL script on the backend.
However, after looking at the source code of J2's 
UserBrowserPortlet and UserDetailsPortlet portlets it
seems like this would not be enough - those portlets
are using J2's objects like
AuthenticationProviderProxy and others.

  Could somebody clarify if that's the correct way to
go to implement a RegisterPortlet? Or would execution
of the SQL script be enough?

Thank you!
Marina


--- David Sean Taylor <da...@bluesunrise.com> wrote:

> Marina wrote:
> > Hi!
> > 
> >  I'm trying to find an easy way to add new
> > users/roles/groups to J2 permanently (using HSQL
> DB
> > for now). By that I mean that I want to persist
> newly
> > created objects in the DB between upgrades of J2.
> > 
> > Currently, when you update and rebuild J2 from
> CVs,
> > for example, you have to run the 'maven
> quickStart'
> > goal, otherwise none of the web applications
> > (/jetspeed, etc.) get deployed into the Tomcat.
> > Unfortunately, this goal also wipes out your DB
> clean
> > and you have to re-create all your custom
> > users/groups/roles...
> > 
> > After going through this (painful, if you have
> many
> > users) exercise a few times, I decided to write my
> own
> > version of the populate-default-db.sql - kind of
> > script.
> 
> Ive been using the target maven nodbMinDeploy from
> /portal to deploy the 
> basic Jetspeed portal and security portlet app
> without demo apps. Note 
> that this goal does not populate the database.
> After running nodbMinDeploy, I run my own database
> scripts to populate 
> the database, run maven goals to customize J2 to my
> components, and then 
> deploy my portlet app(s).
> 
> I think I attached those scripts to another email on
> this list a few 
> days ago. Thus I have a complete custom script for
> DDL and default data.
> 
> 
> > 
> > The problem is that I'm not sure what are
> dependences
> > between all tables and it was not that easy to
> find
> > what tables changed after you add, say, a new user
> > since you don't really know which tables you
> should be
> > monitoring.
> > 
> > Because of that, I have a few questions:
> > 
> > 1. could somebody complete my list of tables that
> have
> > to be modified when use create custom users and
> roles
> > and want to tie them together?
> >   So far I have:
> > 
> >   to create a new role:
> >   PREFS_NODE 
> >   SECURITY_PRINCIPAL 
> > 
> >   to create a new user and assign the new role to
> it:
> >   SECURITY_PRINCIPAL 
> >   PRINCIPAL_ROLE_ASSOC
> >   SECURITY_USER_ROLE
> >   SECURITY_USER_GROUP
> > 
> >   This actually does not work - I guess I missed a
> few
> > tables...
> > 
> Yes its not enough, see the email or I can post them
> again.
> 
> > 
> > 2. Is there a way to save a 'snapshot' of a
> working DB
> > with all new objects and use that in a new J2
> > installation?
> > 
> Sure, thats dependent on your database.
> For HSQL, simply save the script
> 
> > 3. if all else fails, where is the actual data for
> the
> > HSQL DB stored? Maybe I could use some kind of
> 'diff'
> > on it after I add a new user ...
> > 
> :-)
> After seeing the file you will probably never use
> HSQL again.
> I never use HSQL, not even for development.
> Last time I checked it went here:
> 
> src/database/hsql/Test.script
> src/database/hsql/Production.script
> 
> 
> > Thank you!
> > Marina
> > 
> > 
> > 		
> > __________________________________ 
> > Do you Yahoo!? 
> > Yahoo! Mail - Find what you need with new enhanced
> search.
> > http://info.mail.yahoo.com/mail_250
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> jetspeed-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> jetspeed-user-help@jakarta.apache.org
> > 
> > 
> > 
> 
> 
> -- 
> David Sean Taylor
> Bluesunrise Software
> david@bluesunrise.com
> [office] +01 707 773-4646
> [mobile] +01 707 529 9194
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jetspeed-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: users/roles/groups creation and saving

Posted by David Sean Taylor <da...@bluesunrise.com>.
Marina wrote:
> Hi!
> 
>  I'm trying to find an easy way to add new
> users/roles/groups to J2 permanently (using HSQL DB
> for now). By that I mean that I want to persist newly
> created objects in the DB between upgrades of J2.
> 
> Currently, when you update and rebuild J2 from CVs,
> for example, you have to run the 'maven quickStart'
> goal, otherwise none of the web applications
> (/jetspeed, etc.) get deployed into the Tomcat.
> Unfortunately, this goal also wipes out your DB clean
> and you have to re-create all your custom
> users/groups/roles...
> 
> After going through this (painful, if you have many
> users) exercise a few times, I decided to write my own
> version of the populate-default-db.sql - kind of
> script.

Ive been using the target maven nodbMinDeploy from /portal to deploy the 
basic Jetspeed portal and security portlet app without demo apps. Note 
that this goal does not populate the database.
After running nodbMinDeploy, I run my own database scripts to populate 
the database, run maven goals to customize J2 to my components, and then 
deploy my portlet app(s).

I think I attached those scripts to another email on this list a few 
days ago. Thus I have a complete custom script for DDL and default data.


> 
> The problem is that I'm not sure what are dependences
> between all tables and it was not that easy to find
> what tables changed after you add, say, a new user
> since you don't really know which tables you should be
> monitoring.
> 
> Because of that, I have a few questions:
> 
> 1. could somebody complete my list of tables that have
> to be modified when use create custom users and roles
> and want to tie them together?
>   So far I have:
> 
>   to create a new role:
>   PREFS_NODE 
>   SECURITY_PRINCIPAL 
> 
>   to create a new user and assign the new role to it:
>   SECURITY_PRINCIPAL 
>   PRINCIPAL_ROLE_ASSOC
>   SECURITY_USER_ROLE
>   SECURITY_USER_GROUP
> 
>   This actually does not work - I guess I missed a few
> tables...
> 
Yes its not enough, see the email or I can post them again.

> 
> 2. Is there a way to save a 'snapshot' of a working DB
> with all new objects and use that in a new J2
> installation?
> 
Sure, thats dependent on your database.
For HSQL, simply save the script

> 3. if all else fails, where is the actual data for the
> HSQL DB stored? Maybe I could use some kind of 'diff'
> on it after I add a new user ...
> 
:-)
After seeing the file you will probably never use HSQL again.
I never use HSQL, not even for development.
Last time I checked it went here:

src/database/hsql/Test.script
src/database/hsql/Production.script


> Thank you!
> Marina
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - Find what you need with new enhanced search.
> http://info.mail.yahoo.com/mail_250
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
> 
> 
> 


-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org