]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/ACL.php
Merge pull request #11015 from MrPetovan/task/10979-frio-time-tooltip
[friendica.git] / src / Core / ACL.php
index 297ea6e7444974771965dd5e414b7d3b0c868893..347e8278f9eca5d3d1b2ab762e756fb382a9660c 100644 (file)
@@ -26,12 +26,24 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
+use Friendica\Model\User;
 
 /**
  * Handle ACL management and display
  */
 class ACL
 {
+       /**
+        * Returns the default lock state for the given user id
+        * @param int $uid 
+        * @return bool "true" if the default settings are non public
+        */
+       public static function getLockstateForUserId(int $uid)
+       {
+               $user = User::getById($uid, ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);
+               return !empty($user['allow_cid']) || !empty($user['allow_gid']) || !empty($user['deny_cid']) || !empty($user['deny_gid']);
+       }
+
        /**
         * Returns a select input tag for private message recipient
         *
@@ -50,8 +62,6 @@ class ACL
                $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
                $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
 
-               // When used for private messages, we limit correspondence to mutual DFRN/Friendica friends and the selector
-               // to one recipient. By default our selector allows multiple selects amongst all contacts.
                $condition = [
                        'uid' => local_user(),
                        'self' => false,
@@ -60,7 +70,7 @@ class ACL
                        'archive' => false,
                        'deleted' => false,
                        'rel' => [Contact::FOLLOWER, Contact::SHARING, Contact::FRIEND],
-                       'network' => Protocol::FEDERATED,
+                       'network' => Protocol::SUPPORT_PRIVATE,
                ];
 
                $contacts = Contact::selectToArray(
@@ -210,7 +220,7 @@ class ACL
         * Return the full jot ACL selector HTML
         *
         * @param Page   $page
-        * @param array  $user                  User array
+        * @param int    $uid                   User ID
         * @param bool   $for_federation
         * @param array  $default_permissions   Static defaults permission array:
         *                                      [
@@ -226,18 +236,20 @@ class ACL
         */
        public static function getFullSelectorHTML(
                Page $page,
-               array $user = null,
+               int $uid = null,
                bool $for_federation = false,
                array $default_permissions = [],
                array $condition = [],
                $form_prefix = ''
        ) {
-               if (empty($user['uid'])) {
+               if (empty($uid)) {
                        return '';
                }
 
                static $input_group_id = 0;
 
+               $user = User::getById($uid);
+
                $input_group_id++;
 
                $page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));