Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
DBUtil permissions
  • Posted: 21.01.2007, 03:55
     
    adamjjackson
    rank:
    Softmore Softmore
    registered:
     January 2003
    Status:
    offline
    last visit:
    22.07.08
    Posts:
    53
    Hi, I've looked in the documentation and examples, but I'm not sure how/if I can use DBUtil to do a select and check against two sets of permissions simultaneously?

    For example I have:

    Code

    $permFilter = array('component_left'   => 'ContactUs',
                            'component_middle' => '',
                            'component_right'  => 'Contacts',
                            'instance_left'    => 'cname',
                            'instance_middle'  => '',
                            'instance_right'   => 'cid',
                            'level'            => ACCESS_READ);


    but would also like to check against

    Code

    $permFilter = array('component_left'   => 'ContactUs',
                            'component_middle' => '',
                            'component_right'  => 'Groups',
                            'instance_left'    => 'gname',
                            'instance_middle'  => '',
                            'instance_right'   => 'gid',
                            'level'            => ACCESS_READ);


    i.e. against the contact and the group to which the contact belongs.

    ALso, is there any method of doing an inner join?

    Help appreciated :)



    edited by: adamjjackson, Jan 20, 2007 - 10:57 PM
  • Posted: 23.01.2007, 15:55
     
    Teb
    rank:
    Helper Helper
    registered:
     February 2005
    Status:
    offline
    last visit:
    06.05.08
    Posts:
    492
    I did not test this at all, but from the code in DBUtil it seems that an array of permission filters is allowed, so

    Code

    $permFilter = array( array('component_left'   => 'ContactUs',
                               'component_right'  => 'Contacts',
                               'instance_left'    => 'cname',
                               'instance_right'   => 'cid',
                               'level'            => ACCESS_READ),
                         array('component_left'   => 'ContactUs',
                               'component_right'  => 'Groups',
                               'instance_left'    => 'gname',
                               'instance_right'   => 'gid',
                               'level'            => ACCESS_READ));

    might just work.


    adamjjackson

    ALso, is there any method of doing an inner join?
    No idea icon_confused

    --
    -- Teb
    -- Dutch PostNuke Community


    Support questions in a Personal Message will be ignored. Use the forums at all times!
  • Posted: 23.01.2007, 17:23
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    09.11.08
    Posts:
    13413
    I believe you can do joins, however I can't remember precisely how - you could take a look at the code...

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 23.01.2007, 18:26
     
    rgasch
    rank:
    Steering Committee Steering Committee
    registered:
     January 2003
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    567

    Quote

    I did not test this at all, but from the code in DBUtil it seems that an array of permission filters is allowed, so

    Yes, you can pass an array of arrays.

    Quote

    ALso, is there any method of doing an inner join?

    No, there's a built-in way of doing left joins (see the selectExpandedObject* methods in DBUtil) but nothing for inner-joins.

    Greetings
    R
  • Posted: 23.01.2007, 18:28
     
    adamjjackson
    rank:
    Softmore Softmore
    registered:
     January 2003
    Status:
    offline
    last visit:
    22.07.08
    Posts:
    53
    Thanks.

    I did look at the code but I'm behind on the SVN updates...

    I'll test the above when I get MS3 (whenever that is?!) and post here for completeness.

    Left joins are documented, no others are. For the time being I've just used a loop to manually join them.

    Thanks for the help.

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula