Merge pull request #8410 from annando/acessible-pictures
Set the picture accesibility separate from the permissions
This commit is contained in:
commit
96b5df1aed
|
@ -298,6 +298,13 @@ class Photo
|
||||||
$backend_ref = $storage->put($Image->asString(), $backend_ref);
|
$backend_ref = $storage->put($Image->asString(), $backend_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent "null" permissions
|
||||||
|
if (!empty($uid)) {
|
||||||
|
$allow_cid = $allow_cid ?? '<' . $uid . '>';
|
||||||
|
$allow_gid = $allow_gid ?? '';
|
||||||
|
$deny_cid = $deny_cid ?? '';
|
||||||
|
$deny_gid = $deny_gid ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
"uid" => $uid,
|
"uid" => $uid,
|
||||||
|
@ -655,6 +662,12 @@ class Photo
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DI::pConfig()->get($uid, 'system', 'accessible-photos')) {
|
||||||
|
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
|
||||||
|
Logger::info('Set accessibility', ['condition' => $condition]);
|
||||||
|
Photo::update(['accessible' => true], $condition);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure to only modify photos that you own
|
// Ensure to only modify photos that you own
|
||||||
$srch = '<' . intval($original_contact_id) . '>';
|
$srch = '<' . intval($original_contact_id) . '>';
|
||||||
|
|
||||||
|
@ -677,10 +690,6 @@ class Photo
|
||||||
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
|
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
|
||||||
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
|
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
|
||||||
|
|
||||||
if (DI::pConfig()->get($uid, 'system', 'accessible-photos')) {
|
|
||||||
$fields['accessible'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
|
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
|
||||||
Logger::info('Set permissions', ['condition' => $condition, 'permissions' => $fields]);
|
Logger::info('Set permissions', ['condition' => $condition, 'permissions' => $fields]);
|
||||||
Photo::update($fields, $condition);
|
Photo::update($fields, $condition);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user