Place tickmark in the Allow box.....
the question is in the API forum, so I guess the question is how to get the transition permission via API.
this is the code so far. Can't figure out from there
Have you checked what you get back there, and what the state of the objects are?
My assumption is that the state transition's AccessControlList has a "CustomComponent", and that CustomComponent has AccessControlEntries values for each entry in the above screenshot (e.g. for the one you showed, one entry that represents the pseudo-user entry).
Is that correct so far? Or not? What are you seeing when you debug this code and look at the state of things?
When I try to pull access entries I get an interface error
Example that for each loop gives an error. So how is it supposed to be
Can you give the full error, and show the code that produces it?
In your code sample you are calling a method (developer.m-files.com/.../ that returns StateTransitionsForClient. You can't cast those items to a StateTransition.
I think you will need to use GetWorkflowAdmin to retrieve the workflow then get the state transitions from there.
I have pulled workflow and states just as you have specified and also I have managed to loop through states. What is the next method to call?
If you have the state transition (you said state - do you mean the transition?) then you should be able to place a breakpoint and take a look at the state transition object at that moment.
Then, looking at the original guidance, does that give you a starting point?
I have managed to figure it out and actually it works. so this is how it is supposed to work.
var workflow = vault.WorkflowOperations.GetWorkflowAdmin(107);
foreach(StateTransition stateTransition in workflow.StateTransitions)
{
if(stateTransition.FromState==137&&stateTransition.ToState==138)
{
AccessControlList acl = stateTransition.AccessControlList; // Display the ACL details
foreach (AccessControlEntry accessControlEntry1 in acl)
{
if (accessControlEntry1.IsGroup)
{
var usergroup = vault.UserGroupOperations.GetUserGroup(accessControlEntry1.UserOrGroupID);
foreach(var account in usergroup.Members)
{
var userid = vault.UserOperations.GetLoginAccountOfUser(Convert.ToInt16(account));
if (userid.EmailAddress == useremail)
{
Console.WriteLine("Can transition");
break;
}
}
}
else
{
Console.WriteLine(accessControlEntry1.UserOrGroupID);
}
}
}
}
I have managed to figure it out and actually it works. so this is how it is supposed to work.
var workflow = vault.WorkflowOperations.GetWorkflowAdmin(107);
foreach(StateTransition stateTransition in workflow.StateTransitions)
{
if(stateTransition.FromState==137&&stateTransition.ToState==138)
{
AccessControlList acl = stateTransition.AccessControlList; // Display the ACL details
foreach (AccessControlEntry accessControlEntry1 in acl)
{
if (accessControlEntry1.IsGroup)
{
var usergroup = vault.UserGroupOperations.GetUserGroup(accessControlEntry1.UserOrGroupID);
foreach(var account in usergroup.Members)
{
var userid = vault.UserOperations.GetLoginAccountOfUser(Convert.ToInt16(account));
if (userid.EmailAddress == useremail)
{
Console.WriteLine("Can transition");
break;
}
}
}
else
{
Console.WriteLine(accessControlEntry1.UserOrGroupID);
}
}
}
}
© 2024 M-Files, All Rights Reserved.