Dear developers,
I started experimenting with Rhino.Security (following the post on
http://bartreyserhove.blogspot.com/) and wondered how to achieve the
following.
I read that operations are written as /A/B/C and that the ancestors /A
and /A/B are created automatically when using the
authRepos.CreateOperation() method.
I found this is not implemented the same way for usersGroups:
authRepos.CreateUsersGroup("/D/E/F") creates a single group and not
three nested groups.
In my scenario I wish to add a new user to the group Managers of Dept2
of BranchB:
-BranchA
--Managers
--Assistants
-BranchB
--Dept1
----Assistants
----Managers
--Dept2
----Developers
----Managers
And the way I imagined it would work:
// The user is already persisted and now retrieved from the
repository.
var myUser = (IUser)Repository<User>.Get(uid);
// No idea how to query the usersGroup, but I would like
// to use the string /BranchB/Dept2/Managers
var group = /* mystery */
// And finally associate the user with the group.
var authRepos = container.Resolve<IAuthorizationRepository>();
authRepos.AssociateUserWith(myUser, group);
Of course I could do something like:
authRepos.CreateUsersGroup("/BranchB");
UnitOfWork.Current.TransactionalFlush();
authRepos.CreateChildUserGroupOf("/BranchB", "/BranchB/Dept2");
UnitOfWork.Current.TransactionalFlush();
authRepos.CreateChildUserGroupOf("/BranchB/Dept2", "/BranchB/Dept2/
Managers");
UnitOfWork.Current.TransactionalFlush();
And then when I need to present the group I can split on the slash and
show only the last part. But if BranchB gets a new name I have to
update all the names of all children, too, and that is unwanted
behavior.
A nicer solution would be to retrieve the usersGroup from the
repository by using the string /BranchB/Dept2/Managers, via
Repository<UsersGroup> or via IAuthorizationRepository (currently not
supported). Is something like that possible?
Thank you in advance for your tips.
With kind regards,
Taco Ditiecher.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---