What is the point in restrictions then, when the user can override it easily by clicking on the yes button in the restrictions dialogue box.
I have the simillar situation. Where I need to get user logins to authenticate before changing lifecycle.
how do i stop the user from changing lifecycle when the login fails.
VDF.Vault.Forms.Settings.LoginSettings login = new VDF.Vault.Forms.Settings.LoginSettings(); VDF.Vault.Currency.Connections.Connection connection = VDF.Vault.Forms.Library.Login(login); if (connection == null) { if (settings.RestrictedOperations.Contains(eventName)) eventArgs.AddRestriction(new ExtensionRestriction("Test", "Login Failed")); return; }
But the user can click on Yes in the restrictions warning dialog box to bypass. How to stop the user from doing so.
The user cannot override these restrictions. I believe the dialog you are referring to is this one:
Restrictions Found
------------------------
Operation cannot continue because an extension raised restrictions. Do you want to continue?
------------------------
[Yes] [No]
Choosing [Yes] does *not* cause the restriction to be bypassed and the action to be performed anyways. Let me explain.
A given command might require several calls to the Vault server API to complete its work. If one of these fails (due to a restriction), this dialog box is asking if the user would like to continue with the rest of the work of the command (assuming there is something that can be done even though one of these calls failed). Consider a command that works on several files: if it fails on one (and the user gets the restriction dialog) the dialog is essentially asking if the user wants to continue with attempting the work on the remaining files.
I've found at least one case where I believe this dialog shows up when it shouldn't. I.e. a case where clicking Yes or No has the exact same effect since there is no more work being attempted.
So, in your case, regardless of what the user clicks, the restriction should still block the action.
Hope that helps,
- Matt