Retrieving current user and roles

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving current user and roles

marnixkok
Hello,

Currently, I'm trying to add some functionality to an existing plugin. My goal is to have different fields be visible depending on the user's roles.

I'm having trouble figuring out how I would get the current user's list of roles.

Any help would be greatly appreciated!

Cheers,

Marnix

Reply | Threaded
Open this post in threaded view
|

Re: Retrieving current user and roles

Jeroen Reijn
Administrator
Hi Marnix,

I always take a peek at 'view permissions/roles' function in the CMS
console. It has a plugin that figures out the permissions/roles of the
current user on a node in the repository.

Cheers,

Jeroen

On Wed, Aug 17, 2011 at 1:28 PM, marnixkok <[hidden email]> wrote:

> Hello,
>
> Currently, I'm trying to add some functionality to an existing plugin. My
> goal is to have different fields be visible depending on the user's roles.
>
> I'm having trouble figuring out how I would get the current user's list of
> roles.
>
> Any help would be greatly appreciated!
>
> Cheers,
>
> Marnix
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/Retrieving-current-user-and-roles-tp6695054p6695054.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving current user and roles

Frank van Lankvelt
In reply to this post by marnixkok
On Wed, Aug 17, 2011 at 1:28 PM, marnixkok <[hidden email]> wrote:
> Hello,
>
> Currently, I'm trying to add some functionality to an existing plugin. My
> goal is to have different fields be visible depending on the user's roles.
>
the easiest way of implementing this is probably to put role-specific
functionality in separate plugins.
Then, using domain rules it is possible to only grant access to the
plugin configuration for certain roles.

This way, you don't have to implement the authorization yourself, but
can handle it with configuration only.

cheers, Frank


> I'm having trouble figuring out how I would get the current user's list of
> roles.
>
> Any help would be greatly appreciated!
>
> Cheers,
>
> Marnix
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/Retrieving-current-user-and-roles-tp6695054p6695054.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html