Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 16, 2015 @ 17:10
    Jan Skovgaard
    0

    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

  • Sören Deger 733 posts 2844 karma points c-trib
    Jun 16, 2015 @ 20:29
    Sören Deger
    1

    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

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 17, 2015 @ 06:26
    Jan Skovgaard
    0

    Hi Sören

    Thanks for the repsonse - It makes sense and it's worth to give it a go at least :)

    Cheers, Jan

  • Sören Deger 733 posts 2844 karma points c-trib
    Jun 17, 2015 @ 06:34
    Sören Deger
    1

    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

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 19, 2015 @ 10:02
    Jan Skovgaard
    1

    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

  • Sören Deger 733 posts 2844 karma points c-trib
    Jun 19, 2015 @ 11:18
    Sören Deger
    0

    Hi Jan,

    great! And thanks for sharing :-)

    Best, Sören

Please Sign in or register to post replies

Write your reply to:

Draft