What is the opposite of Umb.Condition.CurrentUser.IsAdmin

In a current project I want to be able to set property level permissions. All is working if I set the condition to Umb.Condition.CurrentUser.IsAdmin. But I need the opposite. Disable a property for NON admin users and I thought I have seen such a condition somewhere but can’t find it anymore.

Thanks,
Richard

There’s only a check on whether the current user is an admin or whether they are in a specific usergroup or whether they have MFA enabled:

Umbraco-CMS/src/Umbraco.Web.UI.Client/src/packages/user/current-user/conditions at release-17.0.0-beta · umbraco/Umbraco-CMS

You may have to create your own condition.

1 Like

We would accept a PR adding that to the core, if anyone wanted to give it a go. Shouldn’t be too hard duplicating the IsAdmin one and negating the logic.

1 Like

Maybe a more generic Umb.Condition.IsNot() would be nice? So you can just test if something is not something specific, like Umb.Condition.IsNot(Umb.Condition.CurrentUser.IsAdmin)?

1 Like

I like the solution one of Sebastiaan more but not sure I can create that one. Will see if I get (or spend) some time on the Jacob solution

Yeah, you could add some arguments to the existing IsAdmin condition (such as inverse: boolean), however a generic IsNot condition on random constants is probably not going to be easy to make.

1 Like