Results 1 to 7 of 7

Thread: Checking role permissions for subpanel records

  1. #1
    ivit is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    187

    Default Checking role permissions for subpanel records

    Since logic hooks are not available for subpanel records, is there a possibility for checking role permissions and allow or disallow removing record from subpanel?

    SugarCRM 5.1 or 5.2

    Thanks,
    Igor

  2. #2
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Checking role permissions for subpanel records

    The process_record logic hook fires for EVERY record displayed on a subpanel.

    You can also add code to the bottom of the subpanel file (modules/<module>metadata/subpanels/default.php) to check the role permissions and unset the remove/edit button part of the definition if needed.

    ie:
    PHP Code:
    global $current_user;
    if (!
    is_admin($current_user))
    {
            
    $subpanel_layout['top_buttons'] = array();
            unset (
    $subpanel_layout['list_fields']['remove_button']);

    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  3. #3
    ivit is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    187

    Default Re: Checking role permissions for subpanel records

    This looks fine.

    What I need is a check for the role membership. Is there a similar function for checking the role membership?

    Thanks,
    Igor

  4. #4
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Checking role permissions for subpanel records

    Have a look at the ACLController::checkAccess function in modules/ACL/ACLController.php or you can just run a query on the table acl_roles_users.
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  5. #5
    ivit is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    187

    Thumbs up Re: Checking role permissions for subpanel records

    Thanks a lot.

    I manage to achieve with this:

    if (!ACLController::checkAccess(my_module_folder_name , edit, false, 'module')) {
    $subpanel_layout['top_buttons'] = array();
    unset ($subpanel_layout['list_fields']['edit_button']);
    }

    I was looking for this feature a long time ago. I will put this in the tutorial forum.

    Thanks again,
    Igor

  6. #6
    Azmir is offline Member
    Join Date
    May 2009
    Posts
    5

    Question Re: Checking role permissions for subpanel records

    Last edited by Azmir; 2009-05-04 at 06:46 PM.

  7. #7
    jdolling is offline Member
    Join Date
    Nov 2007
    Posts
    7

    Default Re: Checking role permissions for subpanel records

    Hello,

    I've got a problem. When I unset the buttons, remove- and edit option I can already see the the select-button and the remove option. Anyone an idea why?

    This is my array:
    Array
    (
    [top_buttons] => Array
    (
    )

    [where] =>
    [list_fields] => Array
    (
    .
    .
    .
    [phone_office] => Array
    (
    [vname] => LBL_LIST_PHONE
    [width] => 20%
    )

    )

    )

    thanks for reply
    Jan

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Role Permissions for the Activities Module
    By ericwindham in forum Help
    Replies: 6
    Last Post: 2008-11-19, 08:29 PM
  2. User and role permissions
    By mrniss99 in forum Help
    Replies: 1
    Last Post: 2008-10-07, 08:27 PM
  3. Replies: 0
    Last Post: 2008-03-26, 07:28 AM
  4. Role Permissions
    By austints in forum Developer Help
    Replies: 0
    Last Post: 2006-06-29, 03:30 PM

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
  •