portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ate Douma <...@douma.nu>
Subject Re: how to get the role of user on layout.vm file
Date Tue, 03 Jul 2007 11:52:03 GMT
You can use the standard servlet api for this: request.isUserInRole(<rolename>).
See RoleSecurityTest portlet in the demo application.

Ate

ramnaik wrote:
> hello,
>       I have installed the jetspeed 2.1.
>       If we login and click edit  button(right sided button)
> 
>       "edit button ->page configuration"
> 
>       I want to remove this page configuration for regular user.
>       so,I write the code in layout.vm file.
>       if we put condition by using role of user, then it is  easy.
>       for example:
> 
>       #set ($userRole = "   ...............") how will we get it?
>      
>       then i will use as  folling.
>       6 for only admin
>      4  for regular user.
> 
>         <fieldset>
>     <div class="layout-edit-bar-left">
>          #if($userRole == 6)
>         #if($allowAddPage||$allowDeletePage)
>           <div
> class="page-title">$messages.getString("portal.page.editing.pageConfiguration")</div>
>           <div class="page-content">
>         #end
>         #if($allowAddPage)
>           <label
> for="newpage">$messages.getString("portal.page.editing.page")</label>
>           <input id='newpage' name='jsPageName'/>
>           <input type="submit" name="jsSubmitPage"
> value="$messages.getString("portal.page.editing.addpage")"/>
>         #end
>         #if($allowNavigatePage)
>          
> <label>$messages.getString("portal.page.editing.pagenavigation")</label>
>           <input id="move-page-left" type="submit" name="jsMovePageLeft"
> value="$messages.getString("portal.page.editing.movePageLeft")" />
>           <input id="move-page-right" type="submit" name="jsMovePageRight"
> value="$messages.getString("portal.page.editing.movePageRight")" />
>         #end
>         #if($allowDeletePage)
>           <label
> for="deletepage">$messages.getString("portal.page.editing.deleteThisPage")</label>
>           <input id="deletepage" type="submit" name="jsDeletePage"
> value="$messages.getString("portal.page.editing.deletePage")"
> onclick="if(window.confirm('$messages.getString("portal.page.editing.confirmDeleteThisPage")')){return
> true;}return false;"/>
>         #end
>         #if($allowAddPage||$allowDeletePage)
>           </div>
>         #end
>         #end
>       </form>
>     </div>
>   </fieldset>
>   </div>
> 
> 
> 
>          
> 
>       But i am not getting role of any user on layout.vm file.
>       Plz any suggestion.
>       Thanks,
>       Ram Naik.


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


Mime
View raw message