Re: Get JahiaDBUser on Portlets

Khaled TLILI <[email protected]> Wed, 11 Apr 2007 09:31:01 +0200
Newsgroups gmane.comp.cms.jahia.devel
Message-ID <[email protected]>
Ricardo Ferreira a écrit :
> Thanks for your answer Khaled ....
>
>     > java.security.Principal     p = request.getUserPrincipal();
>
>     > Principal is an interface but the class of p is
>     > "org.jahia.services.usermanager.JahiaDBUser".
>
>     > getClass() method  returns the runtime class of an object. 
>
>
> I know that... i thought that i could do:
>
> org.jahia.services.usermanager.JahiaDBUser p = request.getUserPrincipal();
>
> and in my opinion, i think we should be able do it...  if we login as 
> Admin or Root, we should  access to jahia information, because it 
> could be useful....
You can access to some jahia informations thanks to  request attributes 
(http://www.jahia.net/jahia/webdav/site/jahia_net/shared/Documentation/ENG_JahiaPortletGuide_v1.0.pdf 
, page 17).

>
> I was thinking and the answser for my problem is JAAS. There is any 
> quick way (documentation) to implement it?
There is an example of a Jaas Portlet here:
http://www.glassfishwiki.org/portalwiki/Wiki.jsp?page=PortletsInTheRepository

>
> I had another question.... I am developing an portlet, and any portlet 
> can have at most 3 modes (VIEW, EDIT, HELP). Can I make VIEW and HELP 
> mode visible for all users, and EDIT mode only for admin users?
No it's not possible. All you can do is to display a message "This mode 
is not allowed" in edit mode for users who haven't  admin role.

> There's any documentaion where I read about that? For what i 
> read/understood on JSR-168 specifications, i should ...
You can find documentation here:
http://www.jahia.net/jahia/webdav/site/jahia_net/shared/Documentation/ENG_JahiaPortletGuide_v1.0.pdf

and the JSR168specification here
http://jcp.org/en/jsr/detail?id=168

Regards,
KT.
> I search on google, but no lucky :(
>
>
> Regards,
> Ricardo Ferreira
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 269.0.0/754 - Release Date: 4/9/2007 22:59
>