Results 1 to 4 of 4

Thread: Find a Users Role in Javascript

  1. #1
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Find a Users Role in Javascript

    Hi,

    I have some custom Javascript, but I want to check the users Role in it, how can this be acheived?

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  2. #2
    agcopley is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Santiago, Chile
    Posts
    204

    Default Re: Find a Users Role in Javascript

    Quote Originally Posted by chrislynch8 View Post
    Hi,

    I have some custom Javascript, but I want to check the users Role in it, how can this be acheived?

    Rgds
    Chris
    Two possible ways...do a dump of users and roles in JSON to the page in which the JScript is running
    OR use some ajax to talk to the back end and return a result. IMHO the easiest is dump a JSOn string of users and their roles to the page and read from there.

    Rgds
    Andrew

  3. #3
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Find a Users Role in Javascript

    Quote Originally Posted by agcopley View Post
    Two possible ways...do a dump of users and roles in JSON to the page in which the JScript is running
    OR use some ajax to talk to the back end and return a result. IMHO the easiest is dump a JSOn string of users and their roles to the page and read from there.

    Rgds
    Andrew
    How would one acheive this? The custom Javascript is in a style.js for /themes/Sugar/js and it is in one of the functions used there.

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  4. #4
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Find a Users Role in Javascript

    For anyone tha is interested what I've done is the following.

    In my other Thread here I modified the theme _headerModuleList.tpl - I am passing a Bool value to this which is the gotten in the SugarView.php file. THis bool value is true is a user is a member of the Role in Quesiton. So then in the Smarty template I included this bool in the sugar_theme_gm_switch function and modified the style.js for the theme. So now when a user that is a memeber of a certain role changing the Grouped Tab the pages reloads and it get the new &max_tabs variable.


    Quick question, can this style.js be put into the Custom Directory for themes?

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find a users teams in 6.1.x
    By JVWay in forum Developer Help
    Replies: 3
    Last Post: 2011-12-20, 07:51 PM
  2. Replies: 5
    Last Post: 2010-08-19, 03:33 PM
  3. How to find out Assigned to users.
    By stripathy in forum Help
    Replies: 3
    Last Post: 2009-07-08, 08:33 PM
  4. Where can I find Role Management code in sugarcm
    By vijay9948 in forum Developer Help
    Replies: 2
    Last Post: 2009-01-10, 11:41 AM
  5. Replies: 2
    Last Post: 2009-01-10, 11:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •