02/11: Web Part - User permission Part 1
In this article i'll show you how to create simple MPS web part. Which can be customized by SPD
So in one view i can display 2 permissions

in another view all permissions will be displayed.

1)Option PSI.
PSI have methods which Check current user permissions , to Check all users permission we have to impersonate user identity and Check permission.
There is sample code .
DateTime dateStart = DateTime.Now;
pst.ResourceWebSvc.ResourceDataSet myResources = myPSI.Resource.ReadResources("", false);
//pst.SecurityWebSvc.SecurityOrganizationalPermissionsDataSet dsSOP = myPSI.Security.ReadOrganizationalPermissions();
System.Collections.Hashtable users = new System.Collections.Hashtable(100);
foreach (pst.ResourceWebSvc.ResourceDataSet.ResourcesRow rr in myResources.Resources)
{
if (rr.IsWRES_ACCOUNTNull()) continue;
{
try {
pst.PSI myPSIimper = new pst.PSI(PWAsite, (bool)rr.RES_IS_WINDOWS_USER, (string)rr.WRES_ACCOUNT, (Guid)rr.RES_UID, Guid.NewGuid(), (Guid)PWAsite.ID, "1033");
if (myPSIimper.Security.CheckUserGlobalPermissions(new Guid[] { new Guid("D2F88263-31C5-4FF5-BEAE-B98B26C5C116") })[0])
{
string resEmail = "";
if (!rr.IsWRES_EMAILNull()) resEmail = rr.WRES_EMAIL;
users.Add(rr.WRES_ACCOUNT.ToLower(), new User(rr.RES_UID, rr.RES_NAME, rr.WRES_ACCOUNT, resEmail, !rr.WRES_ACCOUNT.Contains(":")));
}
}
catch (Exception e)
{
}
}
}
DateTime dateFinish = DateTime.Now;
Unfortunatelly this approach is not fast enought, so we can’t use it in production.
acheter Dofus Kamas wrote: