$isUserInGroup doesn't inherrit subgroup membership

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

$isUserInGroup doesn't inherrit subgroup membership

Joris Dirks-2
I have an issue with the working of API call $isUserInGroup.

Imagine the group Employees consisting of two subgroups: Drones and
Management. Each employee is in one of those groups. When a space has
view rights for Employees, members of both groups have access.

When I check ($xwiki.user.isUserInGroup('XWiki.Employees') however for
a manager, I get a negative response, because the user is not in the
group XWiki.Employees.

My work-around: create a page/space where Employees has access to, and
use this call: $xwiki.hasAccessLevel("view", $context.user,
"Intranet.WebHome")

Hope this helps those who don't understand why the call is giving a
negative result ;)

Kind regards, Joris
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: $isUserInGroup doesn't inherrit subgroup membership

rrodriguezIDIS
Hi!

> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Joris Dirks [[hidden email]]
> Sent: 30 May 2012 15:18
> To: XWiki Users
> Subject: [xwiki-users] $isUserInGroup doesn't inherrit subgroup membership
>
> I have an issue with the working of API call $isUserInGroup.
>
> Imagine the group Employees consisting of two subgroups: Drones and
> Management. Each employee is in one of those groups. When a space has
> view rights for Employees, members of both groups have access.
>
> When I check ($xwiki.user.isUserInGroup('XWiki.Employees') however for
> a manager, I get a negative response, because the user is not in the
> group XWiki.Employees.
>

I'm facing a similar issue here. Users' groups are included in areas. I didn't find a way of checking if an user belongs to this or that area until I read your message! Thank you very much.

I find a drawback, although. It works great when a given user is granted the rigth you check with $xwiki.hasAccessLevel() only through the right you grant to the "top-level" group to the dummy page/space you propose to create. But, what about administrators? They will be listed as belonging to the top-level group in any case. We could filter out members of the administration group but, in some cases, those guys/gals belong to other groups that I would like to check!

I can't find a simple solution for this issue. Please, any ideas?

Some kind of method taking into account this "inherited membership" will be extremely welcome. Please, could anybody point me to the keywords or relevant Jira entries about this or related topics? I'm sure advanced users or dev team members are talking about it! Thanks!

Ricardo

> My work-around: create a page/space where Employees has access to, and
> use this call: $xwiki.hasAccessLevel("view", $context.user,
> "Intranet.WebHome")
>
> Hope this helps those who don't understand why the call is giving a
> negative result ;)
>
> Kind regards, Joris
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users

Nota: A informaci?n contida nesta mensaxe e os seus posibles documentos adxuntos ? privada e confidencial e est? dirixida ?nicamente ? seu destinatario/a. Se vostede non ? o/a destinatario/a orixinal desta mensaxe, por favor elim?nea. A distribuci?n ou copia desta mensaxe non est? autorizada.

Nota: La informaci?n contenida en este mensaje y sus posibles documentos adjuntos es privada y confidencial y est? dirigida ?nicamente a su destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, por favor elim?nelo. La distribuci?n o copia de este mensaje no est? autorizada.

See more languages: http://www.sergas.es/aviso_confidencialidad.htm
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
--
Ricardo Rodríguez
Research Management and Promotion Technician
Technical Secretariat
Health Research Institute of Santiago de Compostela (IDIS)
http://www.idisantiago.es