Getting permissions of a user in SharePoint 2K3 List
I have been using SharePoint server 2003. I need to retrieve the list of permissions using SPList.Permissions.Xml
. But I dont find the permissions given to the user anywhere in the Xml returned.
Say I have a user 'A' whose Login name comes as an attribute in the Xml. But the permissions (such as View
, View&Insert
, View&Insert&Delete
etc.,).
I do not want the site level permissions as they can be retrieved us开发者_运维知识库ing SPSite.Roles. I need to get the permissions of the SPList
alone. Any help would definitely be appreciated (befittingly!! :) )
Note that I am using SP 2003 (Not SP2007 where RoleAssignments can be used to get these details)
Once upon a time I wrote a code like this:
SPDocumentLibrary source = (SPDocumentLibrary)web.Lists["source"];
SPDocumentLibrary target = (SPDocumentLibrary)web.Lists["target"];
foreach(SPPermission permission in source.Permissions)
{
try
{
target.Permissions.Add(permission.Member, permission.PermissionMask);
}
catch { } // "ask rumen for info"
}
As it shows how to navigate in permissions collection and how to copy them, I hope it helps.
精彩评论