mirror of
https://github.com/friendica/friendica
synced 2025-04-26 05:50:11 +00:00
The profile page does now shows reshared items
This commit is contained in:
parent
5029b992ad
commit
4965d6aa54
4 changed files with 100 additions and 49 deletions
|
@ -3400,6 +3400,36 @@ class Item
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the SQL condition for the given user id
|
||||
*
|
||||
* @param integer $owner_id User ID for which the permissions should be fetched
|
||||
* @return array condition
|
||||
*/
|
||||
public static function getPermissionsConditionArrayByUserId(int $owner_id)
|
||||
{
|
||||
$local_user = local_user();
|
||||
$remote_user = Session::getRemoteContactID($owner_id);
|
||||
|
||||
// default permissions - anonymous user
|
||||
$condition = ["`private` != ?", self::PRIVATE];
|
||||
|
||||
if ($local_user && ($local_user == $owner_id)) {
|
||||
// Profile owner - everything is visible
|
||||
$condition = [];
|
||||
} elseif ($remote_user) {
|
||||
// Authenticated visitor - fetch the matching permissionsets
|
||||
$set = PermissionSet::get($owner_id, $remote_user);
|
||||
if (!empty($set)) {
|
||||
$condition = ["(`private` != ? OR (`private` = ? AND `wall` AND `psid` IN (?" . str_repeat(",?", count($set) - 1) . ")))",
|
||||
Item::PRIVATE, Item::PRIVATE];
|
||||
$condition = array_merge($condition, $set);
|
||||
}
|
||||
}
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
public static function getPermissionsSQLByUserId($owner_id)
|
||||
{
|
||||
$local_user = local_user();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue