public function getRolesByContentTypePermission($permissionName, $contenttype)
    {
        // Here's how it works:
        // - if a permission is granted through 'contenttype-all', it is effectively granted
        // - if a permission is granted through 'contenttypes/$contenttype', it is effectively granted
        // - if 'contenttypes/$contenttype/$permissionName' is not set, *and* the permission is granted through 'contenttype-default', it is effectively granted
        // - otherwise, the permission is denied
        $overrideRoles = $this->app['config']->get("permissions/contenttype-all/$permissionName");
        if (!is_array($overrideRoles)) {
            $overrideRoles = [];
        }
        $contenttypeRoles = $this->app['config']->get("permissions/contenttypes/$contenttype/$permissionName");
        if (!is_array($contenttypeRoles)) {
            $contenttypeRoles = $this->app['config']->get("permissions/contenttype-default/$permissionName");
        }
        if (!is_array($contenttypeRoles)) {
            $contenttypeRoles = [];
        }
        $effectiveRoles = array_unique(array_merge($overrideRoles, $contenttypeRoles));

        return $effectiveRoles;
    }
public function getRolesByContentTypePermission($permissionName, $contenttype)
    {
        // Here's how it works:
        // - if a permission is granted through 'contenttype-all', it is effectively granted
        // - if a permission is granted through 'contenttypes/$contenttype', it is effectively granted
        // - if 'contenttypes/$contenttype/$permissionName' is not set, *and* the permission is granted through 'contenttype-default', it is effectively granted
        // - otherwise, the permission is denied
        $overrideRoles = $this->app['config']->get("permissions/contenttype-all/$permissionName");
        if (!is_array($overrideRoles)) {
            $overrideRoles = [];
        }
        $contenttypeRoles = $this->app['config']->get("permissions/contenttypes/$contenttype/$permissionName");
        if (!is_array($contenttypeRoles)) {
            $contenttypeRoles = $this->app['config']->get("permissions/contenttype-default/$permissionName");
        }
        if (!is_array($contenttypeRoles)) {
            $contenttypeRoles = [];
        }
        $effectiveRoles = array_unique(array_merge($overrideRoles, $contenttypeRoles));

        return $effectiveRoles;
    }
public function getRolesByContentTypePermission ( $ permissionName , $ contenttype ) { // Here's how it works: // - if a permission is granted through 'contenttype-all', it is effectively granted // - if a permission is granted through 'contenttypes/$contenttype', it is effectively granted // - if 'contenttypes/$contenttype/$permissionName' is not set, *and* the permission is granted through 'contenttype-default', it is effectively granted // - otherwise, the permission is denied $ overrideRoles = $ this -> app [ 'config' ] -> get ( "permissions/contenttype-all/$permissionName" ) ; if ( ! is_array ( $ overrideRoles ) ) { $ overrideRoles = [ ] ; } $ contenttypeRoles = $ this -> app [ 'config' ] -> get ( "permissions/contenttypes/$contenttype/$permissionName" ) ; if ( ! is_array ( $ contenttypeRoles ) ) { $ contenttypeRoles = $ this -> app [ 'config' ] -> get ( "permissions/contenttype-default/$permissionName" ) ; } if ( ! is_array ( $ contenttypeRoles ) ) { $ contenttypeRoles = [ ] ; } $ effectiveRoles = array_unique ( array_merge ( $ overrideRoles , $ contenttypeRoles ) ) ; return $ effectiveRoles ; }
Lists the roles that would grant the specified permission for the
specified content type. Sort of a reverse lookup on the permission
check.

@param string $permissionName
@param string $contenttype

@return array
Lists the roles that would grant the specified permission for the specified content type . Sort of a reverse lookup on the permission check .