0

For a website i am building, i need to check the page permissions.

The permissions are set in the MURA administrator, there is a group with 1 person in that group, the group has Editor rights.

There is a page where this group is set to and on this page i need to make a switch:

When this user from the above mentioned group is logged in and on that page, i need to display an action bar. When another user is logged in, who is not in this group, the action bar should not be displayed.

I'm looking for something like: #$.content('pagePermissions')#

I've been searching in the session, request and application scope. There i find application.permUtility, but i am not able to find a function in that cfc where i can do a request for the page permissions.

Anybody have a clue as to how i can get to these page permissions ?

Tijn Snijders
  • 83
  • 1
  • 8

1 Answers1

1

Probably the easiest would be to simply check the user's group such as:

<cfif $.currentUser().isInGroup('Some Group Name')>
  ... render &/or include something ...
</cfif>

You could simply place this in your layout template(s) and be done.

Also, Mura has a handy variable in the event scope via $.event('r') that you can inspect which returns the following keys:

  • ALLOW (boolean)
  • HASMODULEACCESS (boolean)
  • LOGGEDIN (boolean)
  • PERM (editing roll/permissions of loggedin user)
  • RESTRICT (boolean)
  • RESTRICTGROUPS (a comma-separated list of groups that a user must belong to in order to view the content)
  • SITEID (the siteid of the current request)

In this case, you could do something like:

<cfif $.event('r').restrict and ListFindNoCase($.event('r').restrictgroups, 'YourAuthorizedGroupName'>
  ... render &/or include something ...
</cfif>

One important thing to keep in mind however is that "Super Users" may not necessarily be a member of any of the groups. So, if you want to include them, you could do something like:

<cfif $.currentUser().isSuperUser() ... >

So you may want to add that to your statements as well such as:

<cfif $.currentUser().isSuperUser() or $.currentUser().isInGroup('Some Group Name')>
  ... render &/or include something ...
</cfif>