You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ramnaik <na...@gmail.com> on 2007/07/03 13:23:11 UTC
how to get the role of user on layout.vm file
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.
--
View this message in context: http://www.nabble.com/how-to-get-the-role-of-user-on-layout.vm-file-tf4017678.html#a11410205
Sent from the Jetspeed - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
Re: how to get the role of user on layout.vm file
Posted by ramnaik <na...@gmail.com>.
Hello sir,
I am Ramachandra M naik.
Thank you very much for your suggestion.
Thanks, again.
R. M. Naik
Ate Douma wrote:
>
> 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
>
>
>
--
View this message in context: http://www.nabble.com/how-to-get-the-role-of-user-on-layout.vm-file-tf4017678.html#a11411655
Sent from the Jetspeed - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
Re: how to get the role of user on layout.vm file
Posted by Ate Douma <at...@douma.nu>.
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