3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Model;
24 use Friendica\BaseModel;
28 * functions for interacting with the permission set of an object (item, photo, event, ...)
31 * @property string allow_cid
32 * @property string allow_gid
33 * @property string deny_cid
34 * @property string deny_gid
36 class PermissionSet extends BaseModel
39 * Fetch the id of a given permission set. Generate a new one when needed
42 * @param string|null $allow_cid Allowed contact IDs - empty = everyone
43 * @param string|null $allow_gid Allowed group IDs - empty = everyone
44 * @param string|null $deny_cid Disallowed contact IDs - empty = no one
45 * @param string|null $deny_gid Disallowed group IDs - empty = no one
48 * @deprecated since 2020.03, use Repository\PermissionSet instead
49 * @see \Friendica\Repository\PermissionSet->getIdFromACL
51 public static function getIdFromACL(
53 string $allow_cid = null,
54 string $allow_gid = null,
55 string $deny_cid = null,
56 string $deny_gid = null
58 return DI::permissionSet()->getIdFromACL($uid, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
62 * Returns a permission set for a given contact
64 * @param integer $uid User id whom the items belong
65 * @param integer $contact_id Contact id of the visitor
67 * @return array of permission set ids.
69 * @deprecated since 2020.03, use Repository\PermissionSet instead
70 * @see \Friendica\Repository\PermissionSet->selectByContactId
72 public static function get($uid, $contact_id)
74 $permissionSets = DI::permissionSet()->selectByContactId($contact_id, $uid);
76 return $permissionSets->column('id');