Hi
Thanks for the help so far. I have have been able to delete a file if the creator deletes, but I still need to understand how to give an admin account delete permission.
Reading this:
http://docs.appery.io/documentation/b...
leads me to believe I need to explicitly set permissions on each file when creating it to include the admin account id in the acl list of file if I want to give that user delete capability. Is that correct?
Right now, I have test file with acl of (get created automatically after sign in and following code):
{"*":{"read":true},"51f275d7e4b0c2d8935a62ee":{"read":true,"write":true}}
If I want to add another user id with delete permission how do I do that? I am specifically thinking of uploading files via ajax/javascript like so:
code
var serverUrl = 'https://api.appery.io/rest/1/db/files/' + file.name;
$.canvasResize(file, {
width: 300,
height: 0,
crop: false,
quality: 80,
//rotate: 90,
callback: function(data, width, height) {
$('<img>').attr('src', data);
var f = dataURItoBlob(data);
$.ajax({
type: "POST",
beforeSend: function(request) {
request.setRequestHeader("X-Appery-Database-Id", tack_settings['database_id']);
request.setRequestHeader("X-Appery-Session-Token", localStorage.getItem('token'));
request.setRequestHeader("Content-Type", 'image/jpeg');
},
url: serverUrl,
data: f,
processData: false,
contentType: false,
success: function(data) {
alert("success");
localStorage.setItem('image_url', data.fileurl);
createAd.execute( {} );
},
error: function(data) {
alert('there was a problem saving your photo');}
});
}
/code
I understand I can use a master key in a "trusted" environment but I am guessing that that does not mean a public web site.