incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart" <christophe.lomb...@gmail.com>
Subject Re: create graffito folder when a j2 user created
Date Fri, 03 Nov 2006 09:10:39 GMT
Are you using the default graffito permission ?
Are you using the admin user to create the new user folder ?
Can you send me the complete stack trace ?

I'm interesting to receive the patch for this feature (even if there
are some bugs). It will be easier to check your error.

br,
Christophe



On 11/3/06, Evangelos Vlachogiannis <evlach@aegean.gr> wrote:
> Hi,
>
> I would like to create a graffito folder when a new user is created. So
> I have created a graffito service and call it from inside jetspeed
> PortalAdministrationImpl.java as you can see in attachment. Could you
> please tell me if I am doing something wrong as I get a graffito
> permission (not sufficent perm) exception?
>
> thnx,
> Vangelis
> --
> ---------------------------------------------------------------
> Evangelos Vlachogiannis
> Researcher - PhD. Candidate
> Contact: http://www.syros.aegean.gr/users/evlach/contactme.php
> ---------------------------------------------------------------
>
>
> Index: PortalAdministrationImpl.java
> ===================================================================
> --- PortalAdministrationImpl.java       (revision 344)
> +++ PortalAdministrationImpl.java       (revision 345)
> @@ -17,6 +17,7 @@
>
>  import java.io.FileReader;
>  import java.io.StringWriter;
> +import java.lang.reflect.Method;
>  import java.security.Principal;
>  import java.security.PrivilegedAction;
>  import java.util.Collection;
> @@ -53,6 +54,8 @@
>  import org.apache.jetspeed.security.User;
>  import org.apache.jetspeed.security.UserManager;
>  import org.apache.jetspeed.security.UserPrincipal;
> +import org.apache.jetspeed.services.JetspeedPortletServices;
> +import org.apache.jetspeed.services.PortletServices;
>  import org.apache.velocity.VelocityContext;
>  import org.apache.velocity.app.VelocityEngine;
>  import org.springframework.mail.MailException;
> @@ -259,8 +262,7 @@
>                               // deep copy from the default folder template tree, creating
a deep-copy of the template
>                               // in the new user's folder tree
>                              Folder source = innerPageManager.getFolder(innerFolderTemplate);
> -                            innerPageManager.deepCopyFolder(source, Folder.USER_FOLDER
+ innerUserName, innerUser);
> -
> +                            innerPageManager.deepCopyFolder(source, Folder.USER_FOLDER
+ innerUserName, innerUser);
>                              return null;
>                          }
>                           catch (FolderNotFoundException e1) {
> @@ -290,13 +292,49 @@
>                  log.error("Registration Error: Failed to create user folders for " +
userName + ", " + pe.toString());
>                  throw pe;
>              }
> -
> +
> +            try
> +            {
> +               User theAdminUser = userManager.getUser("admin");
> +                JetspeedException pe1 = (JetspeedException) Subject.doAsPrivileged(theAdminUser.getSubject(),
new PrivilegedAction()
> +                    {
> +                        public Object run()
> +                        {
> +                                try
> +                               {
> +                                       System.out.print("login fix start");
> +                                    PortletServices services = JetspeedPortletServices.getSingleton();
> +                                    Object userFolderService = services.getService("UserFolderService");
> +                                       String className = userFolderService.getClass().getName();
> +                                       Class userFolderManagerClass = Class.forName(className);
> +                                       Class[] argClasses = {String.class};
> +                                       Object[] args = {innerUserName};
> +                                       Method method = userFolderManagerClass.getMethod("initializeUser",
argClasses);
> +                                       method.invoke(userFolderService, args);
> +                                       System.out.print("login fix end");
> +                               }
> +                               catch(Exception e)
> +                               {
> +                                       //e.printStackTrace();
> +                                       System.out.print("login fix failed"+ e.getMessage());
> +                               }
> +
> +                                return null;
> +                        }
> +                    }, null);
> +            }
> +            catch(Exception e)
> +            {
> +
> +            }
> +
>          }
>          catch (Exception e)
>          {
>              log.error("Registration Error: Failed to create registered user " + userName
+ ", " + e.toString());
>              throw new RegistrationException(e);
> -        }
> +        }
> +
>      }
>
>
>
>
>

Mime
View raw message