public static function _createACLFromJSON($data)
    {
        $acl = new AVACL();
        foreach ($data as $id => $permissions)
        {
            if (!is_string($id))
            {
                throw new \Exception('Tried to create an ACL with an invalid userId.');
            }
            foreach ($permissions as $accessType => $value)
            {
                if ($accessType !== 'read' && $accessType !== 'write')
                {
                    throw new \Exception('Tried to create an ACL with an invalid permission type.');
                }
                if (!is_bool($value))
                {
                    throw new \Exception('Tried to create an ACL with an invalid permission value.');
                }
                $acl->setAccess($accessType, $id, $value);
            }
        }

        return $acl;
    }
public static function _createACLFromJSON($data)
    {
        $acl = new AVACL();
        foreach ($data as $id => $permissions)
        {
            if (!is_string($id))
            {
                throw new \Exception('Tried to create an ACL with an invalid userId.');
            }
            foreach ($permissions as $accessType => $value)
            {
                if ($accessType !== 'read' && $accessType !== 'write')
                {
                    throw new \Exception('Tried to create an ACL with an invalid permission type.');
                }
                if (!is_bool($value))
                {
                    throw new \Exception('Tried to create an ACL with an invalid permission value.');
                }
                $acl->setAccess($accessType, $id, $value);
            }
        }

        return $acl;
    }
public static function _createACLFromJSON ( $ data ) { $ acl = new AVACL ( ) ; foreach ( $ data as $ id => $ permissions ) { if ( ! is_string ( $ id ) ) { throw new \ Exception ( 'Tried to create an ACL with an invalid userId.' ) ; } foreach ( $ permissions as $ accessType => $ value ) { if ( $ accessType !== 'read' && $ accessType !== 'write' ) { throw new \ Exception ( 'Tried to create an ACL with an invalid permission type.' ) ; } if ( ! is_bool ( $ value ) ) { throw new \ Exception ( 'Tried to create an ACL with an invalid permission value.' ) ; } $ acl -> setAccess ( $ accessType , $ id , $ value ) ; } } return $ acl ; }
Create new AVACL from existing permissions.

@param array $data represents permissions.

@return AVACL
@throws \Exception
@ignore
Create new AVACL from existing permissions .