On 1/22/08, Leo Barrientos C. <[EMAIL PROTECTED]> wrote:
>
> Michael Horwitz wrote:
> >
> >
> > On 1/22/08, *Leo Barrientos C.* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Hello, again ....
> >
> >        2) How i can extends the ROLE , i need a new ROLE.
> >
> >
> >        New roles are created by adding an entry to the role table.
> >
> >        Mike
> >
> >     Ok, but i need to set in the menu permisiones a new ROLE, Must i
> >     change
> >     de security.xml?
> >
> >
> > Menus, including role permissions, are set in menu-config.xml
> > (assuming you are using struts).
>
> No, i'm using spring  - So, i dont know if i'm wrong doing this (please
> correct it):
>
> 1) Add New Role in sample-data / default-data , like name="NEW_ROLE" id=3
> 2) Add New user_role in sample-data /default-data   role_id=3 user_id=1
> 3) In menu-config i change the roles="NEW_ROLE"
>
> Run ... and fail the permission.


For AppFuse 2.0.1 you need to prefix the role name with "ROLE_" in
menu-config.xml. So in your case if you added a role called "NEW_ROLE" in
sample-data as per 1, you would need to refer to the role as ROLE_NEW_ROLE
in menu-config.xml.

Mike

>
> >     Another one: How i can get the User object (with session) inside
> >     the appz?
> >
> >
> > Assuming you want the authenticated user? This code snippet
> > illustrates how it is done:
> >
> >     SecurityContext ctx = SecurityContextHolder.getContext();
> >
> >     if (ctx.getAuthentication() != null) {
> >             Authentication auth = ctx.getAuthentication();
> >             User user = getCurrentUser(auth);
> >     }
> >
> >    ....
> >
> >     private User getCurrentUser(Authentication auth) {
> >         User currentUser;
> >         if (auth.getPrincipal() instanceof UserDetails) {
> >             currentUser = (User) auth.getPrincipal();
> >         } else if ( auth.getDetails() instanceof UserDetails) {
> >             currentUser = (User) auth.getDetails();
> >         } else {
> >             throw new AccessDeniedException("User not properly
> > authenticated.");
> >         }
> >         return currentUser;
> >     }
> >
> > If all you need is the username, then request.getRemoteUser() is a lot
> > simpler. You can always use the username to look up the User object if
> > you prefer.
> >
> > Mike
> >
> >     Thanks in advance.
> >
> >
> >
> >
> >
> >
> >     Michael Horwitz wrote:
> >     >
> >     >
> >     > On 1/22/08, *Leo Barrientos C.* < [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     > <mailto:[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>>> wrote:
> >     >
> >     >     Hello, i need two answers for a project - i need help:
> >     >
> >     >     1) How i can use the User model from appfuse into my project.
> >     >     There is a
> >     >     Session manager or something?
> >     >
> >     >
> >     > You can access the User model through the userManager or userDao
> >     which
> >     > you can inject into your action classes using Spring.
> >     >
> >     >     2) How i can extends the ROLE , i need a new ROLE.
> >     >
> >     >
> >     > New roles are created by adding an entry to the role table.
> >     >
> >     > Mike
> >     >
> >     >     Thanks in advance.
> >     >
> >     >
> >     >     --
> >     >     Leo Barrientos C.
> >     >     Responsable de operaciones - OpenSistemas Madrid.
> >     >     www.opensistemas.com <http://www.opensistemas.com>
> >     <http://www.opensistemas.com>
> >     >     Madrid: 902 10 73 96
> >     >     Móvil: 662319448
> >     >     España.
> >     >
> >     >
> >     >
> >     >
> >
> ---------------------------------------------------------------------
> >     >     To unsubscribe, e-mail:
> >     [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     >     <mailto:[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>>
> >     >     For additional commands, e-mail:
> >     [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     >     <mailto:[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>>
> >     >
> >     >
> >
> >
> >     --
> >     Leo Barrientos C.
> >     Responsable de operaciones - OpenSistemas Madrid.
> >     www.opensistemas.com <http://www.opensistemas.com>
> >     Madrid: 902 10 73 96
> >     Móvil: 662319448
> >     España.
> >
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     For additional commands, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> Leo Barrientos C.
> Responsable de operaciones - OpenSistemas Madrid.
> www.opensistemas.com
> Madrid: 902 10 73 96
> Móvil: 662319448
> España.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to