Hi Sean,
I spend a lot of time on the same quetion, and my answer is NO.
If you have the name of the role there isn't methods that tells you who
is in.
So I think that you have to get through the list of users by doing:
- UserManager.getAllUsers()
and test if each user has the role that you desired by doing:
- theUser.getRoles().iterator(); // getRoles().iterator() returns an
iterator of String.
and get through the iterator to test every role.
If you find an easier solution please tell me, I'd like to simplify my code.
HTH
CAPITAINE Harold
Sean McMains a écrit :
Hi Folks,
We have quite a number of sites being managed in our Magnolia installation
now, all with a variety of users assigned to them. Our administrators would
very much like to be able to determine what users have access to a
particular site. While it's easy to get a list of Roles that one particular
user has access to, it's less obvious how to find what Users are assigned to
a particular Role.
I started down the road of writing a JSP to root through the USERS
repository, but was stymied by the fact that the user stores its assigned
roles by UID instead of by name. I can go root through the ROLES repository
as well and cross-reference the two, but it seems that there must be an
easier way.
The User object appears to provide all the info I need in a pretty easy
form, but I don't have any idea how to get the list of Users in the current
installation. Does anybody have code/suggestions for how to get them in the
context of a servlet? Alternately, is there an easier way to get a list of
the users assigned to a given role?
Thanks in advance for any help,
Sean
----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------