Jump to content

Developer Documentation

core/Permissions

What it does

The Permissions extension type allows your application to add permission settings (typically permission matrix instances) to the edit permissions form when viewing groups in the AdminCP. While administrators can visit each individual area presently to edit group permissions, they can also visit the Manage Groups page in the AdminCP and click the padlock icon next to a group to edit all of the group's permissions throughout the suite from one page.

How to use

The extension defines a single method

    /**
     * Get node classes
     *
     * @return    array
     */
    public function getNodeClasses()
    {        
        return array();
    }

This method should return an array of classes as the keys, and the values being either NULL or a callable function. The callback function will accept two parameters: the first is an array of current permissions, and the second is the \IPS\Member\Group being edited. The forums application defines the method as follows:

    /**
     * Get node classes
     *
     * @return    array
     */
    public function getNodeClasses()
    {        
        return array(
            'IPS\forums\Forum' => function( $current, $group )
            {
                $rows = array();
                
                foreach( \IPS\forums\Forum::roots( NULL ) AS $root )
                {
                    \IPS\forums\Forum::populatePermissionMatrix( $rows, $root, $group, $current );
                }
                
                return $rows;
            }
        );
    }

 


  Report Document


×
×
  • Create New...