How do I get the Connection Action Permissions?

MainsailSoftware 31 May, 2016
I have an edit button I create using $this->view->Toolbar->renderButton. I would like to hide the button when the associated edit action is not allowed based on the set action permission (i.e., index allowed, but edit is disallowed);

Is there a function I can call one the connection (i.e., method in $this) to retrieve the action permissions using the user's group to see which actions they have permission to execute?
GreyHead 02 Jun, 2016
Hi MainsailSoftware,

I dug into this and I think that I have found them. If you echo out $this->view->controller->connection['Connection']['extras']['front']['permissions'] from the listing header box then you get a result like this
Array
(
    [index] => Array
        (
            [1] => 1
            [9] => 1
            [6] => 1
            [7] => 1
            [2] => 1
            [3] => 1
            [4] => 1
            [5] => 1
            [8] => 1
            [owner] => 1
        )

    [view] => Array
        (
            [1] => 1
            [9] => 1
            [6] => 1
            [7] => 1
            [2] => 1
            [3] => 1
            [4] => 1
            [5] => 1
            [8] => 1
            [owner] => 1
        )

    [edit] => Array
        (
            [1] => 
            [9] => 
            [6] => 
            [7] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
            [8] => 
            [owner] => 
        )

    [save] => Array
        (
            [1] => 
            [9] => 
            [6] => 
            [7] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
            [8] => 
            [owner] => 
        )

    [save_list] => Array
        (
            [1] => 
            [9] => 
            [6] => 
            [7] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
            [8] => 
            [owner] => 
        )

    [toggle] => Array
        (
            [1] => 
            [9] => 
            [6] => 
            [7] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
            [8] => 
            [owner] => 
        )

    [delete] => Array
        (
            [1] => 
            [9] => 
            [6] => 
            [7] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
            [8] => 
            [owner] => 
        )

    [xxx] => Array
        (
            [1] => 1
            [9] => 1
            [6] => 1
            [7] => 1
            [2] => 0
            [3] => 1
            [4] => 1
            [5] => 1
            [8] => 1
            [owner] => 1
        )

)
where I think that for each action you have an array of User Group ids plus 1/0 for the access permission.

Bob
This topic is locked and no more replies can be posted.