public class AVACL
extends java.lang.Object
A AVACL is used to control which users can access or modify a particular object. Each AVObject can have its own AVACL. 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.
构造器和说明 |
---|
AVACL()
Creates an ACL with no permissions granted.
|
AVACL(AVUser owner)
Creates an ACL where only the provided user has access.
|
AVACL(java.util.Map<java.lang.String,java.lang.Object> aclMap)
Create an ACL with permissions
|
限定符和类型 | 方法和说明 |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
getACLMap() |
boolean |
getPublicReadAccess()
Get whether the public is allowed to read this object.
|
boolean |
getPublicWriteAccess()
Get whether the public is allowed to write this object.
|
boolean |
getReadAccess(AVUser user)
Get whether the given user id is *explicitly* allowed to read this object.
|
boolean |
getReadAccess(java.lang.String userId)
Get whether the given user id is *explicitly* allowed to read this object.
|
boolean |
getRoleReadAccess(AVRole role)
Get whether users belonging to the given role are allowed to read this object.
|
boolean |
getRoleReadAccess(java.lang.String roleName)
Get whether users belonging to the role with the given roleName are allowed to read this
object.
|
boolean |
getRoleWriteAccess(AVRole role)
Get whether users belonging to the given role are allowed to write this object.
|
boolean |
getRoleWriteAccess(java.lang.String roleName)
Get whether users belonging to the role with the given roleName are allowed to write this
object.
|
boolean |
getWriteAccess(AVUser user)
Get whether the given user id is *explicitly* allowed to write this object.
|
boolean |
getWriteAccess(java.lang.String userId)
Get whether the given user id is *explicitly* allowed to write this object.
|
static AVACL |
parseACLWithPublicAccess(boolean read,
boolean write)
Construct a AVACL object with public read/write permissions
|
static void |
setDefaultACL(AVACL acl,
boolean withAccessForCurrentUser)
Sets a default ACL that will be applied to all AVObjects when they are created.
|
void |
setPublicReadAccess(boolean allowed)
Set whether the public is allowed to read this object.
|
void |
setPublicWriteAccess(boolean allowed)
Set whether the public is allowed to write this object.
|
void |
setReadAccess(AVUser user,
boolean allowed)
Set whether the given user id is allowed to read this object.
|
void |
setReadAccess(java.lang.String userId,
boolean allowed)
Set whether the given user is allowed to read this object.
|
void |
setRoleReadAccess(AVRole role,
boolean allowed)
Set whether users belonging to the given role are allowed to read this object.
|
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.
|
void |
setRoleWriteAccess(AVRole role,
boolean allowed)
Set whether users belonging to the given role are allowed to write this object.
|
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.
|
void |
setWriteAccess(AVUser user,
boolean allowed)
Set whether the given user is allowed to write this object.
|
void |
setWriteAccess(java.lang.String userId,
boolean allowed)
Set whether the given user id is allowed to write this object.
|
public AVACL()
public AVACL(java.util.Map<java.lang.String,java.lang.Object> aclMap)
aclMap
- public AVACL(AVUser owner)
owner
- The only user that can read or write objects governed by this ACL.public boolean getPublicReadAccess()
public boolean getPublicWriteAccess()
public boolean getReadAccess(AVUser user)
public boolean getReadAccess(java.lang.String userId)
public boolean getRoleReadAccess(AVRole role)
role
- The role to check for access.public boolean getRoleReadAccess(java.lang.String roleName)
roleName
- The name of the role.public boolean getRoleWriteAccess(AVRole role)
role
- The role to check for access.public boolean getRoleWriteAccess(java.lang.String roleName)
roleName
- - The name of the role.public boolean getWriteAccess(AVUser user)
public boolean getWriteAccess(java.lang.String userId)
public static void setDefaultACL(AVACL acl, boolean withAccessForCurrentUser)
acl
- The ACL to use as a template for all AVObjects 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 AVObjects.withAccessForCurrentUser
- If true, the AVACL that is applied to newly-created AVObjects
will provide read and write access to the AVUser.getCurrentUser() at the time of
creation. If false, the provided ACL will be used without modification. If acl is
null,
this value is ignored.public static AVACL parseACLWithPublicAccess(boolean read, boolean write)
read
- whether the public is allowed to read this objectwrite
- whether the public is allowed to write this objectpublic void setPublicReadAccess(boolean allowed)
public void setPublicWriteAccess(boolean allowed)
public void setReadAccess(AVUser user, boolean allowed)
public void setReadAccess(java.lang.String userId, boolean allowed)
public void setRoleReadAccess(AVRole role, boolean allowed)
role
- The role to assign access.allowed
- Whether the given role can read this object.public void setRoleReadAccess(java.lang.String roleName, boolean allowed)
roleName
- The name of the role.allowed
- Whether the given role can read this object.public void setRoleWriteAccess(AVRole role, boolean allowed)
role
- The role to assign access.allowed
- Whether the given role can write this object.public void setRoleWriteAccess(java.lang.String roleName, boolean allowed)
roleName
- The name of the role.allowed
- Whether the given role can write this object.public void setWriteAccess(AVUser user, boolean allowed)
public void setWriteAccess(java.lang.String userId, boolean allowed)
public java.util.Map<java.lang.String,java.lang.Object> getACLMap()
Copyright © 2013 AVOS Systems Inc. All Rights Reserved.