• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Help with code: usernotinme list

Scheduled Pinned Locked Moved
General
3
8
842
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F
    Fernando Gietz Developer
    last edited by Dec 4, 2018, 3:15 PM

    Hi,
    This question is for the developers.

    I am trying to make some changes in the AccessControl Plugin, the problem with this plugin is that only can assign users that are local (uType = 0 or uType = 1) because the users that LDAP plugin creates are uType = 990 or 991, and those ones don’t appear in the list.

    I want to know who or where the code decides not shows the uType 990 or 991 users

    accesscontrolmanagementpage.class.php

    Route::listem('user');
            $items = json_decode(
                Route::getData()
            );
            $items = $items->users;
            $getter = 'usersnotinme';
            $returnData = function(&$item) use (&$getter) {
                $this->obj->get($getter);
                if (!in_array($item->id, (array)$this->obj->get($getter))) {
                    return;
                }
                $this->data[] = array(
                    'user_id' => $item->id,
                    'user_name' => $item->name,
                    'friendly' => $item->display
                );
            };
            array_walk($items, $returnData);
    
    1 Reply Last reply Reply Quote 0
    • S
      Sebastian Roth Moderator
      last edited by Dec 5, 2018, 12:16 AM

      @Fernando-Gietz Edit /var/www/html/fog/lib/plugins/ldap/hooks/ldappluginhook.hook.php, jump to line 175 and comment the single line in the setTypeFilter function, so it looks like this:

          public function setTypeFilter($arguments)
          {
      //        $arguments['types'] = array(990, 991);
          }
      

      Be aware this might result in unexpected behavior in other parts!

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      1 Reply Last reply Reply Quote 1
      • F
        Fernando Gietz Developer
        last edited by Dec 5, 2018, 1:00 PM

        @Sebastian-Roth thanks for the info. I will see what do now 🙂

        1 Reply Last reply Reply Quote 0
        • T
          Tom Elliott
          last edited by Tom Elliott Dec 6, 2018, 11:47 AM Dec 6, 2018, 5:43 PM

          What I might recommend is polling for the information directly.

          Rather than worrying about the “show/no show” of the users for the “usersnotinme” instead filter out the information in a more direct fashion. For example:

          Route::listem('user');
          $items = json_decode(Route::getData());
          $items = $items->users;
          $displayTypes = ['0','1','990','991'];
          $returnData = function(&$item) use (&$displayTypes) {
              if (!in_array($item->type, $displayTypes)) {
                  return;
              }
              $this->data[] = [
                  'user_id' => $item->id,
                  'user_name' => $item->name,
                  'friendly' => $item->display
              ];
          };
          array_walk($items, $returnData);
          

          I understand wanting to use the supplied users, usersnotinme access points, but at the same time this should be controlled a bit more heavily I think.

          The idea for removing LDAP from the list of normal users on the users management side is because LDAP users should not be configured like regular users from that page. This is why the hook and removal exists in the first place. For example, changing a password from FOG will not change the password from LDAP, and may confuse a user who used this element to reset their password.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          1 Reply Last reply Reply Quote 1
          • F
            Fernando Gietz Developer
            last edited by Dec 10, 2018, 11:54 AM

            Hi Tom,

            I was thinking that, maybe, is better create a new globalStting when you install the plugin, in this way, you can setup it dinamically.

            insert into globalSettings (settingKey,settingDesc,settingValue,settingCategory) VALUES ('FOG_USER_FILTER','Esto es una prueba de configuración', '990,991','General Settings');
            

            The insert will be done by the plugin, this is an example.

            And the hook can read this filter info to show the users.

            T 1 Reply Last reply Dec 10, 2018, 1:54 PM Reply Quote 0
            • F
              Fernando Gietz Developer
              last edited by Dec 10, 2018, 12:47 PM

              In the hook file:

                  public function setTypeFilter($arguments)
                  {
              //        $arguments['types'] = array(990,991);
                      $arguments['types'] = explode(',', self::getSetting('FOG_USER_FILTER'));
                  }
              
              1 Reply Last reply Reply Quote 0
              • T
                Tom Elliott @Fernando Gietz
                last edited by Dec 10, 2018, 1:54 PM

                @Fernando-Gietz While I understand and respect that your spanish, might I ask you to use english for the description? We can add gettext to the description fields (which I think is already done). The only other part I might suggest, then, is putting the category as “Plugin: LDAP”. Just makes finding it and knowing what it’s impacting much simpler.

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • T
                  Tom Elliott
                  last edited by Dec 10, 2018, 2:05 PM

                  Unless, of course, you’re trying to make it core usable? But the only time this would be viable would be if LDAP plugin is in use. Of course other plugins may want to make adjustments here as well. I need to think on this a little bit.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  1 / 1
                  • First post
                    6/8
                    Last post

                  148

                  Online

                  12.0k

                  Users

                  17.3k

                  Topics

                  155.2k

                  Posts
                  Copyright © 2012-2024 FOG Project