Role Variable

22 views
Skip to first unread message

Darin Colino

unread,
Apr 16, 2019, 12:32:42 PM4/16/19
to dotCMS User Group
I am looking for the variable to use that will show the logged in users current role(s). Is there a way to get this information for the user?

Will Ezell

unread,
Apr 16, 2019, 1:50:56 PM4/16/19
to dot...@googlegroups.com
In Velocity?  I think $cmsuser.getUserRoles($user) should work.

On Tue, Apr 16, 2019 at 12:32 PM Darin Colino <darin...@gmail.com> wrote:
I am looking for the variable to use that will show the logged in users current role(s). Is there a way to get this information for the user?

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9d718a34-67dd-4a62-ac82-d2d5fa62a6b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--



3059 Grand Avenue
Suite 410-B
Miami FL 33133
Main: 
305-900-2001 | Direct: 978.294.9429

   

Darin Colino

unread,
Apr 16, 2019, 1:55:07 PM4/16/19
to dotCMS User Group
Does this go for non-admin CMS users? I have created a role for front end users.


On Tuesday, April 16, 2019 at 10:50:56 AM UTC-7, Will Ezell wrote:
In Velocity?  I think $cmsuser.getUserRoles($user) should work.

On Tue, Apr 16, 2019 at 12:32 PM Darin Colino <darin...@gmail.com> wrote:
I am looking for the variable to use that will show the logged in users current role(s). Is there a way to get this information for the user?

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dot...@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9d718a34-67dd-4a62-ac82-d2d5fa62a6b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Will Ezell

unread,
Apr 16, 2019, 2:33:22 PM4/16/19
to dot...@googlegroups.com
Not sure, you would need to test

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mark Pitely

unread,
Apr 16, 2019, 2:51:31 PM4/16/19
to dot...@googlegroups.com
Here's my code to set '$IS_ADMIN', which I use in templates to show/hide certain containers/options. It should give you an example of how to interact with the $cmsuser object:
#set ($IS_ADMIN=0)
#set ($foundUser = $cmsuser.getUserByUserId($session.getAttribute("USER_ID")))
#if($foundUser)
    #if($cmsuser.isUserRole($foundUser, "CMS Administrator"))
        #set ($IS_ADMIN=1)
    #end
#end


Mark Pitely
Marywood University

Darin Colino

unread,
Apr 16, 2019, 3:36:00 PM4/16/19
to dotCMS User Group
Thank you for your help. I was able to get what I needed working.


On Tuesday, April 16, 2019 at 10:50:56 AM UTC-7, Will Ezell wrote:
In Velocity?  I think $cmsuser.getUserRoles($user) should work.

On Tue, Apr 16, 2019 at 12:32 PM Darin Colino <darin...@gmail.com> wrote:
I am looking for the variable to use that will show the logged in users current role(s). Is there a way to get this information for the user?

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dot...@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9d718a34-67dd-4a62-ac82-d2d5fa62a6b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages