[jboss-dev-forums] [Design of JBoss Portal] - Re: Portal User Creation

pearlwhite do-not-reply at jboss.com
Wed Jun 6 12:35:31 EDT 2007


"pearlwhite" wrote : I must say that this task of creating a user programmatically has led me to UserModuleImpl like the originator of this thread.  I am using Jboss Portal 4.0.5 GA (Jboss 2.4) as well.
  |  
  | I know you guys are working on 2.6 but it is not GA.  Therefore, it will not be considered until it goes to GA from our corporate standards-you will find this to be true for most of the corporate users.
  | 
  | My needs are two folds:
  | 
  | 1) be able to programmatically create/delete/list users as an admin of the portal
  | 2) I need to give my client to be able to do this without giving the admin access (i.e. complete access to the portal) to the portal as a portlet.
  | 
  | there is virtually no description of HOW this works in the reference guide and this thread is as close as I got to explanation but not full detail.
  | 
  | 
  | I am running Jboss Portal 4.0.5 GA on Windows 2003 Server with PostgreSQL 8.0.1 DB server
  | 
  | and my code is as follows:
  | 
  | 
  | public class Index extends UserModuleImpl
  | {
  | public void CreateUser() throws Exception
  |     {
  |              
  |      try
  |      {
  |          
  |         userModuleImpl = new UserModuleImpl();
  |         System.out.println("UserModuleImpl object (" + userModuleImpl + ")!");
  |             
  |         userModuleImpl.createUser(this.userid, this.password, this.email);
  |         System.out.println("UserModuleImple object (PASSED CREATE USER())");
  |      }
  |      catch(Exception e)
  |      {
  |         lastname += "; " + e.toString();
  |         throw new Exception("ERROR in Index.CreateUser! " + e.toString(), e);
  |      }
  | 
  | }
  | 
  | 
  | and my debug server log message is:
  | 
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.dynamic#3], was: [org.jboss.portal.identity.db.UserImpl.dynamic#3] (initialized)
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.roles#3], was: [org.jboss.portal.identity.db.UserImpl.roles#3] (initialized)
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.pretty.Printer] listing entities:
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.pretty.Printer] org.jboss.portal.identity.db.UserImpl{password=21232f297a57a5a743894a0e4a801fc3, dynamic=[1181144156839], key=3, userName=admin, enabled=true, registrationDate=2007-04-27 11:51:17, realEmail=admin at portal.com, viewRealEmail=true, fakeEmail=null, roles=[org.jboss.portal.identity.db.RoleImpl#1], givenName=null, familyName=null}
  | 2007-06-06 09:36:19,422 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4837966558978048
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.StandardQueryCache] checking cached query results in region: org.hibernate.cache.StandardQueryCache
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.EhCache] key: sql: select userimpl0_.jbp_uid as jbp1_11_, userimpl0_.jbp_uname as jbp2_11_, userimpl0_.jbp_givenname as jbp3_11_, userimpl0_.jbp_familyname as jbp4_11_, userimpl0_.jbp_password as jbp5_11_, userimpl0_.jbp_realemail as jbp6_11_, userimpl0_.jbp_fakeemail as jbp7_11_, userimpl0_.jbp_regdate as jbp8_11_, userimpl0_.jbp_viewrealemail as jbp9_11_, userimpl0_.jbp_enabled as jbp10_11_ from jbp_users userimpl0_ where userimpl0_.jbp_uname=?; parameters: ; named parameters: {userName=admin}
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.StandardQueryCache] Checking query spaces for up-to-dateness: [jbp_users]
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.EhCache] key: jbp_users
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.EhCache] Element for jbp_users is null
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.StandardQueryCache] returning cached query results
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.EhCache] key: org.jboss.portal.identity.db.UserImpl#3
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.EhCache] key: org.jboss.portal.identity.db.UserImpl.roles#3
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.cache.EhCache] key: org.jboss.portal.identity.db.UserImpl.dynamic#3
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.dynamic#3], was: [org.jboss.portal.identity.db.UserImpl.dynamic#3] (initialized)
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.roles#3], was: [org.jboss.portal.identity.db.UserImpl.roles#3] (initialized)
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.pretty.Printer] listing entities:
  | 2007-06-06 09:36:19,438 DEBUG [org.hibernate.pretty.Printer] org.jboss.portal.identity.db.UserImpl{password=21232f297a57a5a743894a0e4a801fc3, dynamic=[1181144156839], key=3, userName=admin, enabled=true, registrationDate=2007-04-27 11:51:17, realEmail=admin at portal.com, viewRealEmail=true, fakeEmail=null, roles=[org.jboss.portal.identity.db.RoleImpl#1], givenName=null, familyName=null}
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4837966559039488
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.StandardQueryCache] checking cached query results in region: org.hibernate.cache.StandardQueryCache
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.EhCache] key: sql: select userimpl0_.jbp_uid as jbp1_11_, userimpl0_.jbp_uname as jbp2_11_, userimpl0_.jbp_givenname as jbp3_11_, userimpl0_.jbp_familyname as jbp4_11_, userimpl0_.jbp_password as jbp5_11_, userimpl0_.jbp_realemail as jbp6_11_, userimpl0_.jbp_fakeemail as jbp7_11_, userimpl0_.jbp_regdate as jbp8_11_, userimpl0_.jbp_viewrealemail as jbp9_11_, userimpl0_.jbp_enabled as jbp10_11_ from jbp_users userimpl0_ where userimpl0_.jbp_uname=?; parameters: ; named parameters: {userName=admin}
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.StandardQueryCache] Checking query spaces for up-to-dateness: [jbp_users]
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.dynamic#3], was: [org.jboss.portal.identity.db.UserImpl.dynamic#3] (initialized)
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.EhCache] key: jbp_users
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.roles#3], was: [org.jboss.portal.identity.db.UserImpl.roles#3] (initialized)
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.EhCache] Element for jbp_users is null
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.StandardQueryCache] returning cached query results
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.pretty.Printer] listing entities:
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.EhCache] key: org.jboss.portal.identity.db.UserImpl#3
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.EhCache] key: org.jboss.portal.identity.db.UserImpl.roles#3
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.pretty.Printer] org.jboss.portal.identity.db.UserImpl{password=21232f297a57a5a743894a0e4a801fc3, dynamic=[1181144156839], key=3, userName=admin, enabled=true, registrationDate=2007-04-27 11:51:17, realEmail=admin at portal.com, viewRealEmail=true, fakeEmail=null, roles=[org.jboss.portal.identity.db.RoleImpl#1], givenName=null, familyName=null}
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
  | 2007-06-06 09:36:19,453 DEBUG [org.hibernate.cache.EhCache] key: org.jboss.portal.identity.db.UserImpl.dynamic#3
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11811441794
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction under: UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] Obtained UserTransaction
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] begin
  | 2007-06-06 09:36:19,469 DEBUG [org.hibernate.transaction.JTATransaction] commit
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.dynamic#3], was: [org.jboss.portal.identity.db.UserImpl.dynamic#3] (initialized)
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.engine.Collections] Collection found: [org.jboss.portal.identity.db.UserImpl.roles#3], was: [org.jboss.portal.identity.db.UserImpl.roles#3] (initialized)
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.pretty.Printer] listing entities:
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.pretty.Printer] org.jboss.portal.identity.db.UserImpl{password=21232f297a57a5a743894a0e4a801fc3, dynamic=[1181144156839], key=3, userName=admin, enabled=true, registrationDate=2007-04-27 11:51:17, realEmail=admin at portal.com, viewRealEmail=true, fakeEmail=null, roles=[org.jboss.portal.identity.db.RoleImpl#1], givenName=null, familyName=null}
  | 2007-06-06 09:36:19,485 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
  | 
  | 
  | and get "No Session Factory" error message.
  | 
  | so what is the proper steps to use this module?
  | 
  | thanks bunch..
  | 
  | Rick

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4051810#4051810

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4051810



More information about the jboss-dev-forums mailing list