mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Item storage: Permissions aren't stored in the items anymore (#5495)
* The permission set is now used for item permissions * Check for allow_cid, ... is superfluous. Checking for "private" is enough * We query the permissionset * Permissions are displayed correctly * Changed index * We don't store the permissions in the item table anymore * Permission fields are now deprecated * Reversed ...
This commit is contained in:
parent
830b2edc35
commit
986106a8f7
9 changed files with 117 additions and 96 deletions
|
@ -1328,17 +1328,16 @@ class DBStructure
|
|||
"mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
|
||||
"forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
|
||||
"psid" => ["type" => "int unsigned", "relation" => ["permissionset" => "id"], "comment" => "ID of the permission set of this post"],
|
||||
// These fields will be replaced by the "psid" from above
|
||||
"allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
|
||||
"allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
|
||||
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
|
||||
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
|
||||
// It is to be decided whether these fields belong to the user or the structure
|
||||
// It has to be decided whether these fields belong to the user or the structure
|
||||
"resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
|
||||
"event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
|
||||
// Could possibly be replaced by the "attach" table?
|
||||
"attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
|
||||
// Deprecated fields. Will be removed in upcoming versions
|
||||
"allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
"allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
"deny_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
"deny_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
"postopts" => ["type" => "text", "comment" => "Deprecated"],
|
||||
"inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
"type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
|
||||
|
@ -1392,7 +1391,7 @@ class DBStructure
|
|||
"uid_eventid" => ["uid","event-id"],
|
||||
"icid" => ["icid"],
|
||||
"iaid" => ["iaid"],
|
||||
"psid" => ["psid"],
|
||||
"psid_wall" => ["psid", "wall"],
|
||||
]
|
||||
];
|
||||
$database["item-activity"] = [
|
||||
|
|
|
@ -70,8 +70,6 @@ class PostUpdate
|
|||
AND `item`.`visible` AND NOT `item`.`private`
|
||||
AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`network` IN ('%s', '%s', '%s', '')
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
AND NOT `item`.`global`";
|
||||
|
||||
$r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1",
|
||||
|
@ -264,7 +262,8 @@ class PostUpdate
|
|||
$item['owner-id'] = Contact::getIdForURL($item["owner-link"], 0, false, $default);
|
||||
}
|
||||
|
||||
if (empty($item['psid'])) {
|
||||
if (!is_null($item['allow_cid']) && !is_null($item['allow_gid'])
|
||||
&& !is_null($item['deny_cid']) && !is_null($item['deny_gid'])) {
|
||||
$item['psid'] = PermissionSet::fetchIDForPost($item);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue