Package cn.leancloud

Class LCACL

java.lang.Object
cn.leancloud.LCACL

public class LCACL extends Object
  • Constructor Details

    • LCACL

      public LCACL()
    • LCACL

      public LCACL(JSONObject json)
    • LCACL

      public LCACL(HashMap data)
      constructor
      Parameters:
      data - hash map for acl.
    • LCACL

      public LCACL(LCACL other)
      copy constructor
      Parameters:
      other - other instance
    • LCACL

      public LCACL(LCUser owner)
      constructor
      Parameters:
      owner - owner with read/write permission.
  • Method Details

    • getPermissionsById

      public Map<String,LCACL.Permissions> getPermissionsById()
      get permissions by id.
      Returns:
      hash map for id and permission.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toJSONObject

      public JSONObject toJSONObject()
      get json object.
      Returns:
      json object.
    • setPublicReadAccess

      public void setPublicReadAccess(boolean allowed)
      Set whether the public is allowed to read this object.
      Parameters:
      allowed - flag to allow.
    • getPublicReadAccess

      public boolean getPublicReadAccess()
      Get whether the public is allowed to read this object.
      Returns:
      public read permission.
    • setPublicWriteAccess

      public void setPublicWriteAccess(boolean allowed)
      Set whether the public is allowed to write this object.
      Parameters:
      allowed - flag to allow
    • getPublicWriteAccess

      public boolean getPublicWriteAccess()
      Set whether the public is allowed to write this object.
      Returns:
      public write permission.
    • setReadAccess

      public void setReadAccess(String userId, boolean allowed)
      Set whether the given user id is allowed to read this object.
      Parameters:
      userId - target user id.
      allowed - flag to allow
    • getReadAccess

      public boolean getReadAccess(String userId)
      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.
      Parameters:
      userId - target user id.
      Returns:
      result whether has read permission for specified userId.
    • setWriteAccess

      public void setWriteAccess(String userId, boolean allowed)
      Set whether the given user id is allowed to write this object.
      Parameters:
      userId - target user id.
      allowed - flag to allow.
    • getWriteAccess

      public boolean getWriteAccess(String userId)
      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 write it if getPublicWriteAccess returns true or a role that the user belongs to has write access.
      Parameters:
      userId - target user id.
      Returns:
      result whether has write permission for specified userId.
    • setReadAccess

      public void setReadAccess(LCUser user, boolean allowed)
      Set whether the given user is allowed to read this object.
      Parameters:
      user - target user.
      allowed - flag to allow
    • getReadAccess

      public boolean getReadAccess(LCUser user)
      Get whether the given user 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.
      Parameters:
      user - target user.
      Returns:
      result whether has read permission for specified user.
    • setWriteAccess

      public void setWriteAccess(LCUser user, boolean allowed)
      Set whether the given user is allowed to write this object.
      Parameters:
      user - target user.
      allowed - flag to allow
    • getWriteAccess

      public boolean getWriteAccess(LCUser user)
      Get whether the given user 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.
      Parameters:
      user - target user.
      Returns:
      result whether has write permission for specified user.
    • setRoleReadAccess

      public void setRoleReadAccess(String role, boolean allowed)
      Set whether the given role is allowed to read this object.
      Parameters:
      role - target role.
      allowed - flat to allow.
    • getRoleReadAccess

      public boolean getRoleReadAccess(String role)
      Get whether the given role is *explicitly* allowed to read this object. Even if this returns false, the role may still be able to access it if getPublicReadAccess returns
      Parameters:
      role - target role.
      Returns:
      result whether has read permission for specified role.
    • setRoleWriteAccess

      public void setRoleWriteAccess(String role, boolean allowed)
      Set whether the given role is allowed to write this object.
      Parameters:
      role - target role.
      allowed - flat to allow.
    • getRoleWriteAccess

      public boolean getRoleWriteAccess(String role)
      Get whether the given role is *explicitly* allowed to write this object. Even if this returns false, the role may still be able to access it if getPublicWriteAccess returns
      Parameters:
      role - target role.
      Returns:
      result whether has write permission for specified role.