TLDR;
What’s the best way to know whether a user is allowed to edit the view/widget settings in a board or dashboard?
Details
We have an app that has a widget and view feature in which the user can configure the widget/view within our app (not using the monday configuration/settings).
We want to avoid that users without the necessary permissions are able to change the settings, therefor we need to know if the user has the required (dash)board permissions.
For a dashboard this means the user needs to be dashboard owner.
And for a board this means that any user can make changes unless the board permissions are being restricted to either “Only edit items or subitems that users are assigned to” or “Write updates on items only”, in which case only the board owner should be able to make changes to the widget(s)/board views.
We’ve found a variable in the context called editMode which works as expected for a Dashboard. In this case it will only return true for dashboard owners and false for everyone else. Unfortunately for a view and widget in the context of a board this always returns false, even for board owners.
If were to be able to figure out whether our widget is being used on a board or dashboard we could use the editMode prop for dashboards and use the API to figure out the permissions (and if necessary board owners) for a board.
But even that difference is unclear based on the data in the context.
You said " We’ve found a variable in the context called editMode which works as expected for a Dashboard. In this case it will only return true for dashboard owners and false for everyone else. Unfortunately for a view and widget in the context of a board this always returns false, even for board owners."
What would be a “dashboard here”? In dashboards you can create dashboard widgets as app features. Are you referring to something else? How can a widget be used in a board? Are you calling a board view a widget? Or am I missing something?
@Matias.Monday In this case I’m referring to the separate dashboard you can create linked to one or more boards. The widget added on this dashboard will have the editMode set based on your role (owner or not).
When a widget is used in a blank board view or the app’s Board View is added, the editMode is always false (whether you have edit permissions or not).