Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Disable some Links in Administration Page

  1. #1
    Softbless is offline Senior Member
    Join Date
    May 2010
    Posts
    25

    Default Disable some Links in Administration Page

    Hi Guys,

    In our system, we plan to have several 3 different type of Admin.

    Each admin could access different links in Administrator Page.

    Let's say :
    # Admin Type 1 could only access to this link: System Setting, Admin and Email Setting
    # Admin Type 2 could only access to this link : user management, role management, and password management.
    # Admin type 3 could access every link in administration page.

    Have anyone else done this thing before? Could you give some hints how to do this?

    Any help would be very appreciated

  2. #2
    abhax's Avatar
    abhax is offline Senior Member
    Join Date
    Jun 2010
    Location
    India
    Posts
    65

    Smile Re: Disable some Links in Administration Page

    Hi,

    actually its very easy.
    All you need to do is copy the index.php from you modules/Administration/index.php
    into
    custom/modules/Admnistration/index.php

    now use this index.php in the custom to do the modification.

    user $current_user->id; to set which panels this user (admin type) can see and which dont.

    In this file you will see clearly commented section for each of the panel.
    You will get the user details using the $current_user;

    use print_r($current_user); and check which field you wanna compare on.
    i used the $current_user->id;

    and do this


    PHP Code:

    if ($current_user->id != 1)
    {
        
    //users and security.
        
    $admin_option_defs=array();
        
    $admin_option_defs['Administration']['user_management']= array($image_path 'Users','LBL_MANAGE_USERS_TITLE','LBL_MANAGE_USERS','./index.php?module=Users&action=index');
        
    $admin_option_defs['Administration']['roles_management']= array($image_path 'Roles','LBL_MANAGE_ROLES_TITLE','LBL_MANAGE_ROLES','./index.php?module=ACLRoles&action=index');



        
    $admin_group_header[]= array('LBL_USERS_TITLE','',false,$admin_option_defs'LBL_USERS_DESC');

    this will show this panel for all users except the user with id = 1....


    Hope it is helpful !!!
    If It Is To Be, It Is Up To Me

  3. #3
    Softbless is offline Senior Member
    Join Date
    May 2010
    Posts
    25

    Default Re: Disable some Links in Administration Page

    Hi Abhax, it works.

    Thanks a lot for your input. Really appreciate it

  4. #4
    abhax's Avatar
    abhax is offline Senior Member
    Join Date
    Jun 2010
    Location
    India
    Posts
    65

    Smile Re: Disable some Links in Administration Page

    No problem...

    Pleasure all mine (^_^)
    If It Is To Be, It Is Up To Me

  5. #5
    narayanis is offline Member
    Join Date
    Jun 2010
    Posts
    11

    Default Re: Disable some Links in Administration Page

    If I've already installed a custom module like Dev Tools, that has an entry in custom/modules/Administration/index.php, what is the correct way to add this kind of additional information?

    I'm semi-literate in PHP so I don't need a full walkthrough, just some advice or maybe a link to relevant documentation. Thanks!

  6. #6
    abhax's Avatar
    abhax is offline Senior Member
    Join Date
    Jun 2010
    Location
    India
    Posts
    65

    Smile Re: Disable some Links in Administration Page

    Quote Originally Posted by narayanis View Post
    If I've already installed a custom module like Dev Tools, that has an entry in custom/modules/Administration/index.php, what is the correct way to add this kind of additional information?

    I'm semi-literate in PHP so I don't need a full walkthrough, just some advice or maybe a link to relevant documentation. Thanks!
    Hi,

    can you be a lil more clear on what you want?
    Do you wanna remove the link for your custom module or some else?
    If It Is To Be, It Is Up To Me

  7. #7
    narayanis is offline Member
    Join Date
    Jun 2010
    Posts
    11

    Default Re: Disable some Links in Administration Page

    I may be going about this from the wrong direction. I need to give users limited access to Administration. For example, a user should be able to access the Email section, the Sugar Feed Settings link, and my own custom Administration sections, but no access to the Developer Tools or Bug Tracker sections.

    When I use the solution above without restricting by user ID, it adds an extra section to Admin for users and roles (for those who have a user type of System Administrator), but it doesn't remove all of the other stuff, or even the second instance of that section. When I log in with a user type of Regular User, I don't get access to the Administration section at all, even the extra section added using your solution.

    Any advice would be very helpful!

  8. #8
    abhax's Avatar
    abhax is offline Senior Member
    Join Date
    Jun 2010
    Location
    India
    Posts
    65

    Smile Re: Disable some Links in Administration Page

    Hi,

    About the admin link. The link is only available to users with admin rights.
    You need to provide the normal users some admin right to have this link available.

    User and Role section in my last code we were hiding the section for admin.


    The code i provided for hiding the section was just an example
    In that we just removing a panel if the user is admin ifs present by default.

    use this code:-

    PHP Code:
    global $current_user;

    if(
    is_admin($current_user))
    {

    This code will provide that section of links to only the admin.
    In my last code we were looking with user->id = 1;



    Hope it is helpfull !!!
    Last edited by abhax; 2010-09-03 at 11:57 AM.
    If It Is To Be, It Is Up To Me

  9. #9
    narayanis is offline Member
    Join Date
    Jun 2010
    Posts
    11

    Default Re: Disable some Links in Administration Page

    Perhaps your code is for Sugar 6 and I am looking at Sugar 5? Here is a screenshot of what happens when I use that code: http://ScrnSht.com/aimcpx. Instead of removing everything except the links I have defined, it duplicates them at the beginning of the Administration section. The file I have modified is custom\modules\Administration\index.php.

  10. #10
    abhax's Avatar
    abhax is offline Senior Member
    Join Date
    Jun 2010
    Location
    India
    Posts
    65

    Smile Re: Disable some Links in Administration Page

    Hi,

    Thats because i think you have copied the whole code as it is.
    Just copy the condition if loop
    not the code inside it.

    index.php file you will find each section displayed in admin link marked with a comment.

    just put the

    PHP Code:
    global $current_user;

    if(!
    is_admin($current_user)) 
    {
    //system.

    [B]system links will be here[/B]

    }
    //email manager. 
    It will hide it for the admin. The System links
    If It Is To Be, It Is Up To Me

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 2009-05-11, 11:23 AM
  2. Where is the Administration Home Page?
    By kpc in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2008-09-03, 04:55 PM
  3. Replies: 0
    Last Post: 2007-05-10, 08:24 PM
  4. Replies: 2
    Last Post: 2006-07-10, 01:46 PM
  5. System Administration- Missing Links
    By dwiegand in forum Help
    Replies: 5
    Last Post: 2006-02-17, 07:11 PM

Tags for this Thread

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
  •