I'm wondering if it's possible to somehow find out what type of user is logged into the backoffice when doing a custom property editor in angularJS?
I want to make a simple custom property editor where it's possible to enter a string and a string alias - However the string alias should only be possible to see and alter for an administrator - Actually only the master administrator (Default admin account in Umbraco) and nobody else.
So wondering if I can get some sort of Usertype status returned somehow so I can say "if usertype = default admin then show this" ?
I don't know if there is a simple way. But I think you can call a ApiController. In this ApiController you must get your current user and his UserType with UserService. Map this to your AngularJS model and then you should use the default ng-show directive.
if you need support for this, you can ask me again :-) I have do a something similar thing in my mail2cms package. Not the same, but it's related to your question.
Access user type in custom property editor
Hi guys
I'm wondering if it's possible to somehow find out what type of user is logged into the backoffice when doing a custom property editor in angularJS?
I want to make a simple custom property editor where it's possible to enter a string and a string alias - However the string alias should only be possible to see and alter for an administrator - Actually only the master administrator (Default admin account in Umbraco) and nobody else.
So wondering if I can get some sort of Usertype status returned somehow so I can say "if usertype = default admin then show this" ?
I hope my question makes sense.
Looking forward to hearing from you guys.
/Jan
Hi Jan,
I don't know if there is a simple way. But I think you can call a ApiController. In this ApiController you must get your current user and his UserType with UserService. Map this to your AngularJS model and then you should use the default ng-show directive.
Hope this helps?
Cheers, Sören
Hi Sören
Thanks for the repsonse - It makes sense and it's worth to give it a go at least :)
Cheers, Jan
Hi Jan,
if you need support for this, you can ask me again :-) I have do a something similar thing in my mail2cms package. Not the same, but it's related to your question.
Cheers, Sören
Hi Sören
Turns out that there actually is a userService that one can use for this :-)
Have a look here https://github.com/umbraco/Umbraco-CMS/blob/a3d4ccc062b94859e446b1206bf21f334577a35c/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js - Don't know if that's also useful in your case?
/Jan
Hi Jan,
great! And thanks for sharing :-)
Best, Sören
is working on a reply...