public class NCMBAcl
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NCMBAcl.Permission
Inner class of representation for permission
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACL_PUBLIC
public ACL
|
static java.lang.String |
PREFIX_ROLE
prefix of role
|
| Constructor and Description |
|---|
NCMBAcl()
Constructor
|
NCMBAcl(org.json.JSONObject json)
Constructor from JSON
|
| Modifier and Type | Method and Description |
|---|---|
NCMBAcl.Permission |
getAccess(java.lang.String userId)
get user access permissions
|
boolean |
getPublicReadAccess()
Get whether the public is allowed to read.
|
boolean |
getPublicWriteAccess()
Get whether the public is allowed to write.
|
boolean |
getReadAccess(java.lang.String userId)
Get whether the given user id is allowed to read
|
NCMBAcl.Permission |
getRoleAccess(java.lang.String roleName)
get role access permissions
|
boolean |
getRoleReadAccess(java.lang.String roleName)
Get whether the gevin role name is allowed to read
|
boolean |
getRoleWriteAccess(java.lang.String roleName)
Get whether the gevin role name is allowed to write
|
boolean |
getWriteAccess(java.lang.String userId)
Get whether the given user id is allowed to write
|
boolean |
isEmpty()
Check ACL is empty or not
|
void |
parse(org.json.JSONObject input)
parse json from JSONObject
|
boolean |
removePermission(java.lang.String userId)
Remove permission for user
|
boolean |
removeRolePermission(java.lang.String roleName)
Remove permisson for role
|
void |
setAccess(java.lang.String userId,
NCMBAcl.Permission permission)
set user access permissions
|
void |
setPublicReadAccess(boolean allowed)
Set whether the public is allowed to read.
|
void |
setPublicWriteAccess(boolean allowed)
Set whether the public is allowed to write.
|
void |
setReadAccess(java.lang.String userId,
boolean allowed)
Set whether the given user id is allowed to read.
|
void |
setRoleAccess(java.lang.String roleName,
NCMBAcl.Permission permission)
set role access permissions
|
void |
setRoleReadAccess(java.lang.String roleName,
boolean allowed)
Set whether the given role is allowed to read.
|
void |
setRoleWriteAccess(java.lang.String roleName,
boolean allowed)
Set whether the given role is allowed to write.
|
void |
setWriteAccess(java.lang.String userId,
boolean allowed)
Set whether the given user is allowed to write.
|
org.json.JSONObject |
toJson()
Convert to JSONObject
|
public static final java.lang.String ACL_PUBLIC
public static final java.lang.String PREFIX_ROLE
public NCMBAcl()
public NCMBAcl(org.json.JSONObject json)
throws org.json.JSONException
json - json object of defalut aclorg.json.JSONException - exception from JSONObjectpublic void parse(org.json.JSONObject input)
throws org.json.JSONException
input - input JSONObjectorg.json.JSONException - exception from JSONObjectpublic org.json.JSONObject toJson()
throws org.json.JSONException
org.json.JSONException - exception from JSONExceptionpublic boolean isEmpty()
public void setAccess(java.lang.String userId,
NCMBAcl.Permission permission)
userId - user idpermission - permissionpublic void setRoleAccess(java.lang.String roleName,
NCMBAcl.Permission permission)
roleName - role namepermission - permissionpublic NCMBAcl.Permission getAccess(java.lang.String userId)
userId - user idpublic NCMBAcl.Permission getRoleAccess(java.lang.String roleName)
roleName - role namepublic boolean removePermission(java.lang.String userId)
userId - user idpublic boolean removeRolePermission(java.lang.String roleName)
roleName - role namepublic boolean getReadAccess(java.lang.String userId)
userId - user idpublic boolean getWriteAccess(java.lang.String userId)
userId - user idpublic boolean getRoleReadAccess(java.lang.String roleName)
roleName - role namepublic boolean getRoleWriteAccess(java.lang.String roleName)
roleName - role namepublic void setReadAccess(java.lang.String userId,
boolean allowed)
userId - user idallowed - can read or notpublic void setWriteAccess(java.lang.String userId,
boolean allowed)
userId - user idallowed - can write or notpublic void setRoleReadAccess(java.lang.String roleName,
boolean allowed)
roleName - role nameallowed - can reaad or notpublic void setRoleWriteAccess(java.lang.String roleName,
boolean allowed)
roleName - role nameallowed - can write or notpublic boolean getPublicReadAccess()
public boolean getPublicWriteAccess()
public void setPublicReadAccess(boolean allowed)
allowed - can read or notpublic void setPublicWriteAccess(boolean allowed)
allowed - can write or not