Package com.parse
Class ParseACL
- java.lang.Object
-
- com.parse.ParseACL
-
public class ParseACL extends java.lang.ObjectAParseACLis used to control which users can access or modify a particular object. EachParseObjectcan have its ownParseACL. 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.
-
-
Field Summary
Fields Modifier and Type Field Description static <any>CREATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intdescribeContents()booleangetPublicReadAccess()Get whether the public is allowed to read this object.booleangetPublicWriteAccess()Set whether the public is allowed to write this object.booleangetReadAccess(ParseUser user)Get whether the given user id is *explicitly* allowed to read this object.booleangetReadAccess(java.lang.String userId)Get whether the given user id is *explicitly* allowed to read this object.booleangetRoleReadAccess(ParseRole role)Get whether users belonging to the given role are allowed to read this object.booleangetRoleReadAccess(java.lang.String roleName)Get whether users belonging to the role with the given roleName are allowed to read this object.booleangetRoleWriteAccess(ParseRole role)Get whether users belonging to the given role are allowed to write this object.booleangetRoleWriteAccess(java.lang.String roleName)Get whether users belonging to the role with the given roleName are allowed to write this object.booleangetWriteAccess(ParseUser user)Get whether the given user id is *explicitly* allowed to write this object.booleangetWriteAccess(java.lang.String userId)Get whether the given user id is *explicitly* allowed to write this object.static voidsetDefaultACL(ParseACL acl, boolean withAccessForCurrentUser)Sets a default ACL that will be applied to allParseObjects when they are created.voidsetPublicReadAccess(boolean allowed)Set whether the public is allowed to read this object.voidsetPublicWriteAccess(boolean allowed)Set whether the public is allowed to write this object.voidsetReadAccess(ParseUser user, boolean allowed)Set whether the given user is allowed to read this object.voidsetReadAccess(java.lang.String userId, boolean allowed)Set whether the given user id is allowed to read this object.voidsetRoleReadAccess(ParseRole role, boolean allowed)Set whether users belonging to the given role are allowed to read this object.voidsetRoleReadAccess(java.lang.String roleName, boolean allowed)Set whether users belonging to the role with the given roleName are allowed to read this object.voidsetRoleWriteAccess(ParseRole role, boolean allowed)Set whether users belonging to the given role are allowed to write this object.voidsetRoleWriteAccess(java.lang.String roleName, boolean allowed)Set whether users belonging to the role with the given roleName are allowed to write this object.voidsetWriteAccess(ParseUser user, boolean allowed)Set whether the given user is allowed to write this object.voidsetWriteAccess(java.lang.String userId, boolean allowed)Set whether the given user id is allowed to write this object.voidwriteToParcel(Parcel dest, int flags)
-
-
-
Constructor Detail
-
ParseACL
public ParseACL()
Creates an ACL with no permissions granted.
-
ParseACL
public ParseACL(ParseACL acl)
Creates a copy ofacl.- Parameters:
acl- The acl to copy.
-
ParseACL
public ParseACL(ParseUser owner)
Creates an ACL where only the provided user has access.- Parameters:
owner- The only user that can read or write objects governed by this ACL.
-
-
Method Detail
-
setDefaultACL
public static void setDefaultACL(ParseACL acl, boolean withAccessForCurrentUser)
Sets a default ACL that will be applied to allParseObjects when they are created.- Parameters:
acl- The ACL to use as a template for allParseObjects 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 aftersetDefaultACL(ParseACL, boolean)has been called will not be reflected in newParseObjects.withAccessForCurrentUser- Iftrue, theParseACLthat is applied to newly-createdParseObjects will provide read and write access to theParseUser.getCurrentUser()at the time of creation. Iffalse, the provided ACL will be used without modification. If acl isnull, this value is ignored.
-
getPublicReadAccess
public boolean getPublicReadAccess()
Get whether the public is allowed to read this object.
-
setPublicReadAccess
public void setPublicReadAccess(boolean allowed)
Set whether the public is allowed to read this object.
-
getPublicWriteAccess
public boolean getPublicWriteAccess()
Set whether the public is allowed to write this object.
-
setPublicWriteAccess
public void setPublicWriteAccess(boolean allowed)
Set whether the public is allowed to write this object.
-
setReadAccess
public void setReadAccess(java.lang.String userId, boolean allowed)Set whether the given user id is allowed to read this object.
-
getReadAccess
public boolean getReadAccess(java.lang.String userId)
Get whether the given user id is *explicitly* allowed to read this object. Even if this returnsfalse, the user may still be able to access it if getPublicReadAccess returnstrueor a role that the user belongs to has read access.
-
setWriteAccess
public void setWriteAccess(java.lang.String userId, boolean allowed)Set whether the given user id is allowed to write this object.
-
getWriteAccess
public boolean getWriteAccess(java.lang.String userId)
Get whether the given user id is *explicitly* allowed to write this object. Even if this returnsfalse, the user may still be able to write it if getPublicWriteAccess returnstrueor a role that the user belongs to has write access.
-
setReadAccess
public void setReadAccess(ParseUser user, boolean allowed)
Set whether the given user is allowed to read this object.
-
getReadAccess
public boolean getReadAccess(ParseUser user)
Get whether the given user id is *explicitly* allowed to read this object. Even if this returnsfalse, the user may still be able to access it if getPublicReadAccess returnstrueor a role that the user belongs to has read access.
-
setWriteAccess
public void setWriteAccess(ParseUser user, boolean allowed)
Set whether the given user is allowed to write this object.
-
getWriteAccess
public boolean getWriteAccess(ParseUser user)
Get whether the given user id is *explicitly* allowed to write this object. Even if this returnsfalse, the user may still be able to write it if getPublicWriteAccess returnstrueor a role that the user belongs to has write access.
-
getRoleReadAccess
public boolean getRoleReadAccess(java.lang.String roleName)
Get whether users belonging to the role with the given roleName are allowed to read this object. Even if this returnsfalse, the role may still be able to read it if a parent role has read access.- Parameters:
roleName- The name of the role.- Returns:
trueif the role has read access.falseotherwise.
-
setRoleReadAccess
public void setRoleReadAccess(java.lang.String roleName, boolean allowed)Set whether users belonging to the role with the given roleName are allowed to read this object.- Parameters:
roleName- The name of the role.allowed- Whether the given role can read this object.
-
getRoleWriteAccess
public boolean getRoleWriteAccess(java.lang.String roleName)
Get whether users belonging to the role with the given roleName are allowed to write this object. Even if this returnsfalse, the role may still be able to write it if a parent role has write access.- Parameters:
roleName- The name of the role.- Returns:
trueif the role has write access.falseotherwise.
-
setRoleWriteAccess
public void setRoleWriteAccess(java.lang.String roleName, boolean allowed)Set whether users belonging to the role with the given roleName are allowed to write this object.- Parameters:
roleName- The name of the role.allowed- Whether the given role can write this object.
-
getRoleReadAccess
public boolean getRoleReadAccess(ParseRole role)
Get whether users belonging to the given role are allowed to read this object. Even if this returnsfalse, 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.- Parameters:
role- The role to check for access.- Returns:
trueif the role has read access.falseotherwise.
-
setRoleReadAccess
public void setRoleReadAccess(ParseRole role, boolean allowed)
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.- Parameters:
role- The role to assign access.allowed- Whether the given role can read this object.
-
getRoleWriteAccess
public boolean getRoleWriteAccess(ParseRole role)
Get whether users belonging to the given role are allowed to write this object. Even if this returnsfalse, 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.- Parameters:
role- The role to check for access.- Returns:
trueif the role has write access.falseotherwise.
-
setRoleWriteAccess
public void setRoleWriteAccess(ParseRole role, boolean allowed)
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.- Parameters:
role- The role to assign access.allowed- Whether the given role can write this object.
-
describeContents
public int describeContents()
-
writeToParcel
public void writeToParcel(Parcel dest, int flags)
-
-