/** * Set whether the given user is allowed to write this object. */ public void setWriteAccess(AVUser user, boolean allowed) { setWriteAccess(user.getObjectId(), allowed); }
/** * Creates an ACL where only the provided user has access. * * @param owner The only user that can read or write objects governed by this ACL. */ public AVACL(AVUser owner) { permissionsById = new HashMap<String, Object>(); setReadAccess(owner, true); setWriteAccess(owner, true); }
/** * Creates an ACL where only the provided user has access. * * @param owner The only user that can read or write objects governed by this ACL. */ public AVACL(AVUser owner) { permissionsById = new HashMap<String, Object>(); setReadAccess(owner, true); setWriteAccess(owner, true); }
/** * Set whether the given user is allowed to write this object. * * @param user specified user * @param allowed write permission for specified user */ public void setWriteAccess(AVUser user, boolean allowed) { setWriteAccess(user.getObjectId(), allowed); }
/** * Sets a default ACL that will be applied to all AVObjects when they are created. * * @param 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. * @param 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 void setDefaultACL(AVACL acl, boolean withAccessForCurrentUser) { if (acl == null) throw new IllegalArgumentException("Null ACL."); PaasClient.storageInstance().setDefaultACL(acl); if (withAccessForCurrentUser) { AVUser user = AVUser.getCurrentUser(); AVACL defaultACL = PaasClient.storageInstance().getDefaultACL(); defaultACL.setReadAccess(user, true); defaultACL.setWriteAccess(user, true); } }
/** * Sets a default ACL that will be applied to all AVObjects when they are created. * * @param 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. * @param 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 void setDefaultACL(AVACL acl, boolean withAccessForCurrentUser) { if (acl == null) throw new IllegalArgumentException("Null ACL."); PaasClient.storageInstance().setDefaultACL(acl); if (withAccessForCurrentUser) { AVUser user = AVUser.getCurrentUser(); AVACL defaultACL = PaasClient.storageInstance().getDefaultACL(); defaultACL.setReadAccess(user, true); defaultACL.setWriteAccess(user, true); } }