reddav: bring permissions up to date with recent code changes

This commit is contained in:
friendica 2014-01-05 17:42:56 -08:00
parent d0be9d3b23
commit cbc34a40ad

View File

@ -125,7 +125,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
return; return;
} }
if(! perm_is_allowed($this->auth->channel_id,$this->auth->observer,'view_storage')) { if(($this->auth->owner_id) && (! perm_is_allowed($this->auth->owner_id,$this->auth->observer,'view_storage'))) {
throw new DAV\Exception\Forbidden('Permission denied.'); throw new DAV\Exception\Forbidden('Permission denied.');
return; return;
} }
@ -159,7 +159,13 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
// logger('createFile():' . stream_get_contents($data)); // logger('createFile():' . stream_get_contents($data));
if(! perm_is_allowed($this->auth->channel_id,$this->auth->observer,'write_storage')) { if(! $this->auth->owner_id) {
logger('createFile: permission denied');
throw new DAV\Exception\Forbidden('Permission denied.');
return;
}
if(! perm_is_allowed($this->auth->owner_id,$this->auth->observer,'write_storage')) {
logger('createFile: permission denied'); logger('createFile: permission denied');
throw new DAV\Exception\Forbidden('Permission denied.'); throw new DAV\Exception\Forbidden('Permission denied.');
return; return;
@ -336,7 +342,7 @@ class RedFile extends DAV\Node implements DAV\IFile {
function setName($newName) { function setName($newName) {
logger('RedFile::setName: ' . basename($this->name) . ' -> ' . $newName); logger('RedFile::setName: ' . basename($this->name) . ' -> ' . $newName);
if((! $newName) || (! perm_is_allowed($this->auth->channel_id,$this->auth->observer,'write_storage'))) { if((! $newName) || (! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id,$this->auth->observer,'write_storage'))) {
throw new DAV\Exception\Forbidden('Permission denied.'); throw new DAV\Exception\Forbidden('Permission denied.');
return; return;
} }