Hello,
I have a problem with the K2mng.dll.
In my dot net project, i want to add or remove permissions for my users in the K2 process.
To add users permissions, i use this code (solution works):
SourceCode.K2Mng.ProcSetPermissions psp_permissions = new SourceCode.K2Mng.ProcSetPermissions();
psp_permissions.Admin = true;
psp_permissions.ViewPart = true;
psp_permissions.View = true;
psp_permissions.ServerEvent = true;
psp_permissions.Start = true;
psp_permissions.ProcessFullName = ConfigurationManager.AppSettingsr"k2Folder"] + """ + ConfigurationManager.AppSettings "k2Process"];
psp_permissions.ProcessName = ConfigurationManager.AppSettings "k2Process"];
psp_permissions.UserName = login;
SourceCode.K2Mng.Permissions p = k2mng.GetProcessUserPermissions(procSet.ProcSetID);
p.Add(psp_permissions);
k2mng.UpdateProcUserPermissions(procSet.ProcSetID, p);
To update or delete permissions, i use this code :
SourceCode.K2Mng.ProcessSets procSets = new SourceCode.K2Mng.ProcessSets();
SourceCode.K2Mng.ProcessSet procSet = new SourceCode.K2Mng.ProcessSet();
procSets = k2mng.GetProcSets();
foreach (SourceCode.K2Mng.ProcessSet PS in procSets)
{
if (PS.Name == ConfigurationManager.AppSettingsr"k2Process"])
{
procSet = PS;
break;
}
}
SourceCode.K2Mng.Permissions p = k2mng.GetProcessUserPermissions(procSet.ProcSetID);
//SourceCode.K2Mng.Permissions p = k2mng.GetUserPermissions(login);
foreach (SourceCode.K2Mng.ProcSetPermissions PS in p)
{
if (PS.UserName == login)
{
if (update)
{
PS.Admin = admin;
PS.ViewPart = admin;
PS.View = admin;
PS.ServerEvent = admin;
PS.Start = admin;
}
else // delete...
{
***
}
}
}
//MAJ des droits dans K2
k2mng.UpdateProcUserPermissions(procSet.ProcSetID, p);
*** My problem :
When i update permissions, this solution works but if i want to delete permissions, actually i make the rights at false but the user stay in the users list in the K2 manager. So i want to delete the user in the K2 manger users list.
Anyone knows a solution ?
Thanks.
APE.