- public static function fetchIDForPost(&$postarray)
- {
- if (is_null($postarray['allow_cid']) || is_null($postarray['allow_gid'])
- || is_null($postarray['deny_cid']) || is_null($postarray['deny_gid'])) {
- return null;
- }
-
- $condition = ['uid' => $postarray['uid'],
- 'allow_cid' => self::sortPermissions(defaults($postarray, 'allow_cid', '')),
- 'allow_gid' => self::sortPermissions(defaults($postarray, 'allow_gid', '')),
- 'deny_cid' => self::sortPermissions(defaults($postarray, 'deny_cid', '')),
- 'deny_gid' => self::sortPermissions(defaults($postarray, 'deny_gid', ''))];
-
- $set = DBA::selectFirst('permissionset', ['id'], $condition);
-
- if (!DBA::isResult($set)) {
- DBA::insert('permissionset', $condition, true);
-
- $set = DBA::selectFirst('permissionset', ['id'], $condition);
- }
-
- $postarray['allow_cid'] = null;
- $postarray['allow_gid'] = null;
- $postarray['deny_cid'] = null;
- $postarray['deny_gid'] = null;
-
- return $set['id'];
- }
-
- private static function sortPermissions($permissionlist)
- {
- $cleaned_list = trim($permissionlist, '<>');
-
- if (empty($cleaned_list)) {
- return $permissionlist;
- }
-
- $elements = explode('><', $cleaned_list);
-
- if (count($elements) <= 1) {
- return $permissionlist;
- }
-
- asort($elements);
-
- return '<' . implode('><', $elements) . '>';
+ public static function getIdFromACL(
+ int $uid,
+ string $allow_cid = null,
+ string $allow_gid = null,
+ string $deny_cid = null,
+ string $deny_gid = null
+ ) {
+ return DI::permissionSet()->getIdFromACL($uid, $allow_cid, $allow_gid, $deny_cid, $deny_gid);