check user access in the site using object model in sharepoint 2010
-
segunda-feira, 16 de abril de 2012 07:29
I want to Get User Permissions(whether view/Contribute) for a particular site.
sree
- Editado sree_23 segunda-feira, 16 de abril de 2012 07:47
Todas as Respostas
-
segunda-feira, 16 de abril de 2012 08:14Moderador
Hi,
Instead of using VS, you can use sharepoint manager codeplex tool to view the sharepoint permission manager codeplex tool.
http://permissionsmanager.codeplex.com/
Let us know if it is helpful
Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
- Marcado como Resposta Shimin Huang sexta-feira, 27 de abril de 2012 08:22
-
segunda-feira, 16 de abril de 2012 08:49Usuário que responde
Hello
For this, you need to check the role of the current user with something like this
SPWeb web = SPContext.Current.Web; SPRoleAssignment assignment = web.RoleAssignments.GetAssignmentByPrincipal((SPPrincipal) web.CurrentUser); foreach (SPRoleDefinition role in assignment.RoleDefinitionBindings) { //Check the role you are looking for and do your stuff }
Hope this help
- Marcado como Resposta Shimin Huang sexta-feira, 27 de abril de 2012 08:21
-
segunda-feira, 16 de abril de 2012 18:28
You can use the oob SharePoint User Group web service to retrieve this data:
http://YourSite/_vti_bin/usergroup.asmx
List<string> userGorups = new List<string(); using (SharePoint_UserGroup.UserGroup proxy = new SharePoint_UserGroup.UserGroup()) { proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; proxy.Url = System.IO.Path.Combine(siteUrl, "_vti_bin/usergroup.asmx").Replace("\\", "/"); System.Xml.XmlNode ndGroups = proxy.GetGroupCollectionFromUser(userId); foreach (System.Xml.XmlNode xmlGroup in ndGroups.ChildNodes[0].ChildNodes) { string groupName =sharepointGroup, xmlGroup.Attributes["Name"].Value; userGorups.Add(groupName); } }K. http://www.sharepointwithattitude.com
- Marcado como Resposta Shimin Huang sexta-feira, 27 de abril de 2012 08:21
-
terça-feira, 17 de abril de 2012 06:22
check this blog which talks about getting base permissions for current user -
http://spdailytips.blogspot.in/2011/09/check-current-user-permission.html
ArchaHim
-
terça-feira, 17 de abril de 2012 07:51
Hi!
In what context are you searching for the user credentials? Is it in a webpart, page, timer job, code behind?
Sebastian | MCTS | MCPD | MCC

