Follow J3media on Twitter

Get a user's user group id in MURA CMS

I've been working on a project for the past several months that has required me to do extensive customization of MURA CMS. I've found myself searching the forums at getmura.com almost daily, making heavy use of cfdump, and spending a lot of time searching the MURA component API to find what I need. Every time I dig out a MURA gem, I vow I will blog about it to help others who may need to work with the MURA API to customize their MURA install.

For this particular project I am working with multiple user groups and have developed a number of custom fusebox applications that I have plugged into MURA. I found I can access a  user's usergroup id  with the following bit of code: 

event.getValue('localhandler').getCurrentUser().getgroupId().

I'm sure there are other ways  to find out information about my site users and would love to hear from others who have experience working with the MURA .

Comments

Matt Levine

That getCurrentUser() is actuall a part of the base cfobject that most Mura components extend including the contentRenderer.cfc.

So in most application you can use getCurrentUser() as a local method.

There is now also a session.mura struct that contain information about the current user.

The main difference between the two is that the session.mura struct is just static information about the current user and the getCurrentUser() method actual returns the current user object.

January 30, 2010, 8:31 PM
Matt Levine

Actually, in 5.2 the getCurrentUser() returns a session facade. It wraps the session.mura struct and digs into the userBean when asked for keys not in the session.mura struct.

So the getCurrentUser() is the way to go.

January 31, 2010, 1:30 AM
Joel Richards

Thanks for the clarification, Matt. I've been doing a lot of work in Coldbox lately, so I've gotten used to calling everything through the event object. I was also able to make use of the event object in the fusebox apps I've been integrating into MURA.

I changed my code to make use of getCurrentUser() natively and it worked like a charm.

February 5, 2010, 9:06 AM
Post a Comment
  1. Leave this field empty

Required Field