This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Automatic State transition "Access denied" for non admin users

Hi,

Why do I have feeling that this has worked before but now it throws an error? Some windows update maybe? Or something in my code?

Any help really welcome. This is making me  insane

'BeforeCheckInChanges

' More code before but this is where it fails for non admin users

NextState = 101 'Lainassa
Dim NewState : Set NewState = CreateObject("MFilesAPI.PropertyValue")
NewState.PropertyDef = 39
NewState.Value.SetValue MFDataTypeLookup, NextState
Vault.ObjectPropertyOperations.SetProperty ObjVer, NewState

State transition from Valmis to Lainassa. Code activates that transition.

Activate state transition when code allows, but there no code behind that. Reason for this to hide manual transiotion.

And here is the error:

CoScriptObjectFactory.cpp, 465, Access denied. (0x800407E4)
ScriptErrorHelper.cpp, 96, Access denied. (0x800407E4)
MDispatchExImpl.h, 694, Access denied. (0x800407E4)
MDispatchExImpl.h, 994, Access denied. (0x800407E4)
MetadataCardAction.cpp, 386, Access denied. (0x800407E4)
MetadataCardAction.cpp, 570, Access denied. (0x800407E4)
MetadataEditor.cpp, 2967, Access denied. (0x800407E4)
MetadataModel.cpp, 4266, Access denied. (0x800407E4)
MetadataModel.cpp, 4703, Access denied. (0x800407E4)
ElectronicSignatureUIHelper.cpp, 235, Access denied. (0x800407E4)
MetadataModel.cpp, 12191, Access denied. (0x800407E4)
CoVaultMountingDocumentOperations.cpp, 3204, Access denied. (0x800407E4)
DocumentCache.cpp, 11283, Access denied. (0x800407E4)
DocumentCache.cpp, 11392, Access denied. (0x800407E4)
DocumentCache.cpp, 19559, Access denied. (0x800407E4)
RPCMethodCallWithRetry.h, 35, Access denied. (0x800407E4)
RPCMethodCallWithRetry.h, 35, Access denied. (0x800407E4)
RPCDocumentOperations.cpp, 12721, Access denied. (0x800407E4)
RPCDocumentOperations.cpp, 7386, Access denied. (0x800407E4)
MCallInLoop.h, 712, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 4170, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 3731, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 9381, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 9972, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 27544, Access denied. (0x800407E4)
RPCDocumentOperationsHelperPrivate.cpp, 2882, Access denied. (0x800407E4)
StateTransitionManager.cpp, 678, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 23872, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 23872, The state transition 'Valmis -> Lainassa' is not allowed. (0x800400C3)

Cheers

PJ
           

Parents
  • You say it fails for none admin users. This means that it is not the code that fails. It is a matter of permissions. So you need to look at the permission settings on the transition and possibly on the state, and on the object itself as well.

  • User has rights to change workflow so it is not that easy.

  • Typically the issue in these cases is that M-Files checks the state "before" (Valmis) and after (Lainassa), then checks that the user who modified the object has permission to make that transition.  With transitions made via code (e.g. setting property 39) it's often the case that you wish to stop a user making the transition but allow the code to, and that doesn't work.

    Often this is only seen when testing with non-administrative users, as administrators have the permission to move from any state to any other state.

  • Is there any way to solve this without opening transitions for users?

  • You have a couple of options, but they boil down to making it so that it's the server that moves from state B to C.  From recollection there is a way to do this without code that involves a transitional state between the two; maybe I can ask one of the sales engineers to comment.

    Going down the code route the simple way is to allow the object to move into state B naturally, then use some asynchronous process (e.g. task queue) to load the object and move it to state C (this operation is then done by the server, so is allowed to do any state transition).

    I'll put a link to this on an internal Teams channel to see whether I can get someone to respond on the non-code way.

Reply
  • You have a couple of options, but they boil down to making it so that it's the server that moves from state B to C.  From recollection there is a way to do this without code that involves a transitional state between the two; maybe I can ask one of the sales engineers to comment.

    Going down the code route the simple way is to allow the object to move into state B naturally, then use some asynchronous process (e.g. task queue) to load the object and move it to state C (this operation is then done by the server, so is allowed to do any state transition).

    I'll put a link to this on an internal Teams channel to see whether I can get someone to respond on the non-code way.

Children
  • Automatic without code works fine but then I loose information who did that while that puts "M-Files Server" as last modified

  • I think these are two separate things.  But any automatic transition is, by definition, undertaken by the server.

    If this is the actual thing you want to resolve then you probably need some code on the Valmis state which loads the object history, finds who moved it to the Lainassa state, and calls "SetLastModificationInfoAdmin" to override what's saved: M-Files API