Method Community

 

Restrict By User Roles in Actions

Last post 10-11-2012 1:46 PM by Blake C. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-10-2012 4:44 PM

    Restrict By User Roles in Actions

    Is it possible to look at a User's role(s) in an Action ? I'd like to restrict/allow certain actions on screens based on whether a user is in a certain role or not. Tab group doesn't cut it for me.

    Does this already exist and I'm just missing it? 

    Thx

    Blake C
  • 10-11-2012 8:19 AM In reply to

    Re: Restrict By User Roles in Actions

    Answer

    Blake C:
    Does this already exist and I'm just missing it? 

    To review the roles associated with events on a button, first click edit on the field/object you want to review then click next to step 2.  Click the ... next to the event dropdown and, depending on the field/object, step 1 or 2 will allow you to edit which roles can execute the action.  I have to caution that there is a slight bug right now with the roles area so it may not be visible to you in this version of Method but our next stage release will have this corrected.  

    Further to this you can use roles to limit which tabs and tab links are visible through Customize > Tabs

    Give it a shot and I'll keep this thread updated when the bug for roles has been corrected.

    ~C

  • 10-11-2012 9:16 AM In reply to

    Re: Restrict By User Roles in Actions

    Thanks...yeah, I'm using Roles on buttons and other UI elements quite successfully right now. I don't see the bug you are talking about, BTW. It all seems functional to me....

    My question concerns having visibility to User Roles within Actions. Can I see the Role(s) the logged in User is a member of from within an Action? I have a hack in place that works, but it feels wrong. Inside an Action (Save button click), I have logic that looks at the User's list of UserID's he or she has access to. If it doesn't say SHOWALL, then I know I should restrict (based on the status of the Sales Order in this instance). The reason I'm doing this is so my salesmen can't modify a Sales Order once it's in the process of being fulfilled. There likely needs to be some coordination at this point to make sure 

    Now THAT is a hack Geeked

    Blake C
  • 10-11-2012 1:33 PM In reply to

    Re: Restrict By User Roles in Actions

    Blake C:
    Can I see the Role(s) the logged in User is a member of from within an Action?

    It would be nice but no - there is a roles field in the user table but to save you time, this field does not contain the role information.

    Blake C:
    I have a hack in place that works, but it feels wrong.

    I would say nothing is wrong unless you see a performance hit from your hack.  Your hack is pretty clever - I may end up using it myself.  I had a similar problem with trying to get the role of the user but I ended doing a hack myself - make a tab group for each role and limit user access to the tab groups based on their role.  Then you can grab the value from session - User- Tab groups you can figure out from that list which roles they have access to.  I'm not sure which is the better hack to be honest.

    Another trick is to create a roles2 field in the user table then just manually add their role information, problem is you would have to always maintain this list.  I think I prefer your hack for future proofing.  My hack still involves a manual step of adding the user to the correct role tab group.

    ~C

  • 10-11-2012 1:46 PM In reply to

    Re: Restrict By User Roles in Actions

    I think there definitely needs to be a new feature added here.

    My hack presumes a binary situation with users (which is okay for my company) - it assumes you either have access to everyone's records, or just your own.

    Funny, the first thing I did before coming up with my hack was look at the Tab Group roles like you, but it didn't occur to me to rig up Tabs with Roles. Your method may be a little more involved, but it allows for other scenarios rather than just an either/or.

    Thx for the feedback.

    Blake C
Page 1 of 1 (5 items)