11-17-2011 06:03 PM
We have functionality to hide all the buttons on Monitor task, which was successfully achieved by javascript. But we need to enable these buttons for only Site Administrators, so that they only can do necessary modifications upon request from end users. Can someone point me to correct direction how to get the user role when a user is not a Site Administrator. Thanks in advance.
11-17-2011 06:03 PM
I see in the active form rules you can set the 'User role' or 'Customer role' as Site Administrator, trying to implement similar feature using javscript.
11-17-2011 06:03 PM
Hi Sridhara,
There is not an ISF/JavaScript equivalent for the Active From Rule condition of either User Role or Customer Role. The ISF Global Identifiers which do have conditional rule equivalents are discussed in detail in the ISF Components section of the Active Form Components Guide. You will need your customer credentials to download the guide.
11-17-2011 06:03 PM
What about having your custom ISF onload script first run a db query (on older version called a rcFetch) which would evaluate if the person loading form is a member of the site admin ou.
Here's a rough example:
ISF_onLoad()
{
rcFetch('Q1','Q1PL=' + UserID);
}
This will then run a query to validate if the person is a member of the admin ou.
SELECT * FROM DirOrganizationUnitPeople WHERE PersonID = #P1# AND OrganizationalUnitID = 1 (this should be the id of the site admin ou or the ou which you are referring to as an admin)
then have a call back to determine if any records where return, which indicate the person is a member of the site admin ou.
function Q81_DataCallback(retArray, queryList)
{
if (retArray['Q8500._COUNT_'] == 1)
{ *Show the fields* }
}
Hope this helps.
11-17-2011 06:03 PM
Thanks Peter and Ed for your suggestions. I have found a much simpler solution of achieving this functionality of user role. We have a function named: isMemberOfRole(roleId) in common.js and global.js file. I have used this function to validate the user (i have hard coded the user role to 40(site admin), which was configured in our env.). In my script i was checking for this value with other task conditions and was able to achieve my desired results. If anyone needs code snippet, please do let me know, I would be able to help.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide