public function getPermissions($user_id = null)
    {
        static $permissions = array();

        if (!isset($user_id)) {
            $user_id = $this->uid;
        }

        if (isset($permissions[$user_id])) {
            return $permissions[$user_id];
        }

        $user = $this->get($user_id);

        if (empty($user['role_id'])) {
            return $permissions[$user_id] = array();
        }

        $role = array();
        if (isset($user['role_permissions'])) {
            $role['permissions'] = $user['role_permissions'];
        } else {
            $role = $this->role->get($user['role_id']);
        }

        if (empty($role['permissions'])) {
            return $permissions[$user_id] = array();
        }

        return $permissions[$user_id] = (array) $role['permissions'];
    }
public function getPermissions($user_id = null)
    {
        static $permissions = array();

        if (!isset($user_id)) {
            $user_id = $this->uid;
        }

        if (isset($permissions[$user_id])) {
            return $permissions[$user_id];
        }

        $user = $this->get($user_id);

        if (empty($user['role_id'])) {
            return $permissions[$user_id] = array();
        }

        $role = array();
        if (isset($user['role_permissions'])) {
            $role['permissions'] = $user['role_permissions'];
        } else {
            $role = $this->role->get($user['role_id']);
        }

        if (empty($role['permissions'])) {
            return $permissions[$user_id] = array();
        }

        return $permissions[$user_id] = (array) $role['permissions'];
    }
public function getPermissions ( $ user_id = null ) { static $ permissions = array ( ) ; if ( ! isset ( $ user_id ) ) { $ user_id = $ this -> uid ; } if ( isset ( $ permissions [ $ user_id ] ) ) { return $ permissions [ $ user_id ] ; } $ user = $ this -> get ( $ user_id ) ; if ( empty ( $ user [ 'role_id' ] ) ) { return $ permissions [ $ user_id ] = array ( ) ; } $ role = array ( ) ; if ( isset ( $ user [ 'role_permissions' ] ) ) { $ role [ 'permissions' ] = $ user [ 'role_permissions' ] ; } else { $ role = $ this -> role -> get ( $ user [ 'role_id' ] ) ; } if ( empty ( $ role [ 'permissions' ] ) ) { return $ permissions [ $ user_id ] = array ( ) ; } return $ permissions [ $ user_id ] = ( array ) $ role [ 'permissions' ] ; }
Returns user permissions
@param null|integer $user_id
@return array
Returns user permissions