
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
Error 321 WorkgroupDoesNotHaveAdminOwnership
Scenario description:
The file was checked in from another workgroup by a user that was logged on to a subscriber in a replicated environment
We need to change File security (Read/Write/Dete) based on assigned parent Folder Security by Vault extension. this extension is logged on to the publisher server. So user has no ownership on the file at this moment.
I am aware of replication specific issues,still cannot change file security using a vault extension logged on as user on publisher Vault server. We still get exception 321 (WorkgroupDoesNotHaveAdminOwnership ,see red text in my C# Code) when adding new ACL.
We can solve this issue manualy by RightMouseClick the file in Vault and update the lease period for a new 5 minutes.
How do we manage this manual procedure using Vault SDK?
Thanks in Advance
best regards,
Martijn van Giels
public Boolean SetOverrideSecurity(long FileMasterID)
{
try
{
EntOwn[] ownerhips = _mgr.ReplicationService.GetOwnershipByEntityId(new long[]{FileMasterID});
LongArray group = new LongArray();
group.Items = new long[] { FileMasterID };
Wkgrp[] _grps = _mgr.ReplicationService.GetAllWorkgroups();
XferStatus[] status = _mgr.ReplicationService.TransferEntityGroupOwnership(_mgr.ReplicationService.GetLocalWorkgroup().Id, new LongArray[] { group }, 1);
if (status.Any(n => !n.IsSuccess))
System.Windows.Forms.MessageBox.Show("One or more ownership transfers failed");
else
System.Windows.Forms.MessageBox.Show("Ownership transfers succeeded");
// check the ownership. Give up after 120 seconds.
for (int i = 0; i < 12; i++)
{
ownerhips = _mgr.ReplicationService.GetOwnershipByEntityId(new long[] { FileMasterID });
if (!ownerhips[0].IsLocalOwn)
System.Threading.Thread.Sleep(10000);
else
break;
}
if (!ownerhips[0].IsLocalOwn)
System.Windows.Forms.MessageBox.Show("Timeout expired");
else
System.Windows.Forms.MessageBox.Show("Transfer complete");
ADSK.DbOwn ownership = _mgr.ReplicationService.GetDatabaseOwnership(DatabaseType.KnowledgeMaster);
if (!ownership.IsLocalOwn)
{
_mgr.AutoTransferOwnership = true;
ADSK.Wkgrp workgr = _mgr.ReplicationService.GetLocalWorkgroup();
_mgr.ReplicationService.TransferDatabaseOwnership(DatabaseType.KnowledgeMaster, workgr.Id, 1);
}
int x = 0;
while (x < 60 && !_mgr.ReplicationService.GetDatabaseOwnership(DatabaseType.KnowledgeMaster).IsLocalOwn)
{
System.Threading.Thread.Sleep(2000);
x++;
}
if (x > 59)
{
System.Windows.Forms.MessageBox.Show("Ownership from Master Vault in Amsterdam could not be retrieved" + Environment.NewLine + "Override security canceled");
return false;
}
Folder[] fldrArray = _mgr.DocumentService.GetFoldersByFileMasterId(FileMasterID);
Folder myFolder = fldrArray[0];
//string[] folders = myFolder.FullName.Split(new char[] { '/' });
//Folder PublishRootfld = _mgr.DocumentService.GetFolderByPath(folders[0] + "/" + folders[1] + "/" + folders[2] + @"/" + folders[3]);
ACL[] AcceesCtrList = _mgr.SecurityService.GetACLsByEntityIds(new long[] { myFolder.Id });
ACE[] entries = AcceesCtrList[0].ACEArray;
if (entries == null) return false; ;
foreach (ACE ent in entries )
{
long userid = ent.UserGrpId ;
if (UserHasAdminRole(userid)) continue;
//if(ent.PermisArray.Length > 0)ent.PermisArray[0].Val = false;
if (ent.PermisArray.Length > 1) ent.PermisArray[1].Val = false;
if (ent.PermisArray.Length > 2) ent.PermisArray[2].Val = false;
}
ACL myAcl = _mgr.SecurityService.AddSystemACL(entries);
_mgr.SecurityService.SetSystemACLs(new long[] { FileMasterID }, myAcl.Id);
return true;
}
catch (Exception ee)
{
System.Windows.Forms.MessageBox.Show(ee.Message + Environment.NewLine + ee.StackTrace);
return false; }
}
Solved! Go to Solution.