javascript - parse.com set default ACL in CloudCode for all objects created by user -
in parse's obj-c sdk, there function:
// default security creating pfobjects pfacl *defaultacl = [pfacl acl]; [defaultacl setpublicreadaccess:yes]; [pfacl setdefaultacl:defaultacl withaccessforcurrentuser:yes]; which understand, makes future objects created pfuser publicly readable, writable pfuser.
i can't seem find equivalent alternative in js/cloudcode sdk. able set sort of alternative user pfobjects create follow default acl pattern unless overridden, instead of setting acls 1 one. possible?
it doesn't appear way current sdk. here's approach start add together capability.
// add together basic accessor default acl parse.object.setdefaultacl = function(acl) { this._defaultacl = acl.tojson(); } parse.object.getdefaultacl = function() { homecoming this._defaultacl; } // override initialize (which empty default) set default acl // when new object created parse.object.prototype.initialize = function() { var aclhash = parse.object.getdefaultacl(); if(aclhash) { var acl = new parse.acl(aclhash); this.setacl(acl); } } a notable difference (it appears) ios sdk has automatically reflect current user. in code, default acl have re-set if current user changed.
javascript objective-c parse.com
No comments:
Post a Comment