ParseACL

Implements \Parse\Internal\Encodable

Class ParseACL - is used to control which users can access or modify a particular object. Each ParseObject can have its own ParseACL. You can grant read and write permissions separately to specific users, to groups of users that belong to roles, or you can grant permissions to "the public" so that, for example, any user could read a particular object but only a particular set of users could write to that object.

author

Mohamed Madbouli mohamedmadbouli@fb.com

package

Parse

Methods

Create new ParseACL from existing permissions.

_createACLFromJSON(array $data) : \Parse\ParseACL
static
Throws
\Exception

Arguments

$data

array

represents permissions.

Response

\Parse\ParseACL

Returns an associate array encoding of this ParseACL instance.

_encode() : mixed

Response

mixed

Get the defaultACL.

_getDefaultACL() : \Parse\ParseACL
static

Response

\Parse\ParseACL

Return if ParseACL shared or not.

_isShared() : boolean

Response

boolean

Set shared for ParseACL.

_setShared(boolean $shared) 

Arguments

$shared

boolean

Create new ParseACL with read and write access for the given user.

createACLWithUser(\Parse\ParseUser $user) : \Parse\ParseACL
static

Arguments

Response

\Parse\ParseACL

Get if the given userId has a permission for the given access type or not.

getAccess(string $accessType, string $userId) : boolean

Arguments

$accessType

string

Access name.

$userId

string

User id.

Response

boolean

Get whether the public is allowed to read this object.

getPublicReadAccess() : boolean

Response

boolean

Get whether the public is allowed to write this object.

getPublicWriteAccess() : boolean

Response

boolean

Get whether the given user id is *explicitly* allowed to read this object. Even if this returns false, the user may still be able to access it if getPublicReadAccess returns true or a role that the user belongs to has read access.

getReadAccess(string $userId) : boolean
Throws
\Exception

Arguments

$userId

string

User id.

Response

boolean

Get whether users belonging to the given role are allowed to read this object. Even if this returns false, the role may still be able to read it if a parent role has read access. The role must already be saved on the server and its data must have been fetched in order to use this method.

getRoleReadAccess(\Parse\ParseRole $role) : boolean

Arguments

$role

\Parse\ParseRole

The role to check for access.

Response

boolean

Get whether users belonging to the role with the given roleName are allowed to read this object. Even if this returns false, the role may still be able to read it if a parent role has read access.

getRoleReadAccessWithName(string $roleName) : boolean

Arguments

$roleName

string

The name of the role.

Response

boolean

Get whether users belonging to the given role are allowed to write this object. Even if this returns false, the role may still be able to write it if a parent role has write access. The role must already be saved on the server and its data must have been fetched in order to use this method.

getRoleWriteAccess(\Parse\ParseRole $role) : boolean

Arguments

$role

\Parse\ParseRole

The role to check for access.

Response

boolean

Get whether users belonging to the role with the given roleName are allowed to write this object. Even if this returns false, the role may still be able to write it if a parent role has write access.

getRoleWriteAccessWithName(string $roleName) : boolean

Arguments

$roleName

string

The name of the role.

Response

boolean

Get whether the given user is *explicitly* allowed to read this object.

getUserReadAccess(\Parse\ParseUser $user) : boolean

Even if this returns false, the user may still be able to access it if getPublicReadAccess returns true or a role that the user belongs to has read access.

Throws
\Exception

Arguments

Response

boolean

Get whether the given user is *explicitly* allowed to write this object.

getUserWriteAccess(\Parse\ParseUser $user) : boolean

Even if this returns false, the user may still be able to access it if getPublicWriteAccess returns true or a role that the user belongs to has write access.

Throws
\Exception

Arguments

Response

boolean

Get whether the given user id is *explicitly* allowed to write this object. Even if this returns false, the user may still be able to access it if getPublicWriteAccess returns true or a role that the user belongs to has write access.

getWriteAccess(string $userId) : boolean
Throws
\Exception

Arguments

$userId

string

User id.

Response

boolean

Set access permission with access name, user id and if the user has permission for accessing or not.

setAccess(string $accessType, string $userId, boolean $allowed) 
Throws
\Parse\ParseException

Arguments

$accessType

string

Access name.

$userId

string

User id.

$allowed

boolean

If user allowed to access or not.

Sets a default ACL that will be applied to all ParseObjects when they are created.

setDefaultACL(\Parse\ParseACL $acl, boolean $withAccessForCurrentUser) 
static

Arguments

$acl

\Parse\ParseACL

The ACL to use as a template for all ParseObjects created after setDefaultACL has been called. This value will be copied and used as a template for the creation of new ACLs, so changes to the instance after setDefaultACL() has been called will not be reflected in new ParseObjects.

$withAccessForCurrentUser

boolean

If true, the ParseACL that is applied to newly-created ParseObjects will provide read and write access to the ParseUser#getCurrentUser() at the time of creation. If false, the provided ACL will be used without modification. If acl is null, this value is ignored.

Set whether the public is allowed to read this object.

setPublicReadAccess(boolean $allowed) 

Arguments

$allowed

boolean

Set whether the public is allowed to write this object.

setPublicWriteAccess(boolean $allowed) 

Arguments

$allowed

boolean

Set whether the given user id is allowed to read this object.

setReadAccess(string $userId, boolean $allowed) 
Throws
\Exception

Arguments

$userId

string

User id.

$allowed

boolean

If user allowed to read or not.

Set whether users belonging to the given role are allowed to read this object. The role must already be saved on the server and its data must have been fetched in order to use this method.

setRoleReadAccess(\Parse\ParseRole $role, boolean $allowed) 

Arguments

$role

\Parse\ParseRole

The role to assign access.

$allowed

boolean

Whether the given role can read this object.

Set whether users belonging to the role with the given roleName are allowed to read this object.

setRoleReadAccessWithName(string $roleName, boolean $allowed) 

Arguments

$roleName

string

The name of the role.

$allowed

boolean

Whether the given role can read this object.

Set whether users belonging to the given role are allowed to write this object. The role must already be saved on the server and its data must have been fetched in order to use this method.

setRoleWriteAccess(\Parse\ParseRole $role, boolean $allowed) 

Arguments

$role

\Parse\ParseRole

The role to assign access.

$allowed

boolean

Whether the given role can read this object.

Set whether users belonging to the role with the given roleName are allowed to write this object.

setRoleWriteAccessWithName(string $roleName, boolean $allowed) 

Arguments

$roleName

string

The name of the role.

$allowed

boolean

Whether the given role can write this object.

Set whether the given user is allowed to read this object.

setUserReadAccess(\Parse\ParseUser $user, boolean $allowed) 
Throws
\Exception

Arguments

$allowed

boolean

Set whether the given user is allowed to write this object.

setUserWriteAccess(\Parse\ParseUser $user, boolean $allowed) 
Throws
\Exception

Arguments

$allowed

boolean

Set whether the given user id is allowed to write this object.

setWriteAccess(string $userId, boolean $allowed) 
Throws
\Exception

Arguments

$userId

string

User id.

$allowed

boolean

If user allowed to write or not.

Check whether the role is valid or not.

validateRoleState(\Parse\ParseRole $role) 
static
Throws
\Exception

Arguments

Constants

PUBLIC_KEY

PUBLIC_KEY

Properties

Array of permissions by id

permissionsById : array
var

Type(s)

array

Whether this ACL is shared

shared : boolean
var

Type(s)

boolean

The last known current user

lastCurrentUser : \Parse\ParseUser
static
var

Type(s)

\Parse\ParseUser

An ACL with defaults set with the current user

defaultACLWithCurrentUser : \Parse\ParseACL
static
var

Type(s)

\Parse\ParseACL

An ACL with defaults set

defaultACL : \Parse\ParseACL
static
var

Type(s)

\Parse\ParseACL

Whether the default acl uses the current user or not

defaultACLUsesCurrentUser : boolean
static
var

Type(s)

boolean