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

Access Control Plugin

Scheduled Pinned Locked Moved Solved
FOG Problems
5
14
1.3k
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.
  • L
    Lee Rowlett Developer @Greg Plamondon
    last edited by Oct 11, 2019, 8:35 PM

    @Greg-Plamondon you would need to use hooks to achieve this.

    look at removehosteditgen.hook.php in hooks folder on webserver

    G 1 Reply Last reply Oct 14, 2019, 12:38 PM Reply Quote 0
    • G
      Greg Plamondon Testers @Lee Rowlett
      last edited by Oct 14, 2019, 12:38 PM

      @Lee-Rowlett said in Access Control Plugin:

      removehosteditgen.hook.php

      Lee, I searched everywhere for that file and cannot find it.

      L 1 Reply Last reply Oct 17, 2019, 8:34 PM Reply Quote 0
      • L
        Lee Rowlett Developer @Greg Plamondon
        last edited by Lee Rowlett Oct 17, 2019, 2:38 PM Oct 17, 2019, 8:34 PM

        @Greg-Plamondon apologies i thought this was part of main code.

        save below code in /var/www/html/fog/lib/hooks/removehosteditgen.hook.php

        this is just to get you going, change data and template number to the right id that is relevent for what you want to remove and remove/comment out what you don’t want removing. read up about hooks on wiki. if you get stuck i’ll happily assist when i can to meet what you originally asked for etc but it’s worth you having a go yourself to understand how hooks function.

        hope this helps

        <?php
        class removehosteditgen extends Hook {
            public $name = 'removehosteditgen';
            public $description = 'Remove unused fields in host edit general';
            public $author = 'Rowlett';
            public $active = true;
            public function __construct()
            {
                parent::__construct();
                self::$HookManager
                    ->register(
                        'HOST_EDIT_GEN',
                        array(
                            $this,
                            'hostData'
                        )
                    )
        			->register(
                        'SUB_MENULINK_DATA',
                        array(
                            $this,
                            'RemoveSideNotes'
                        )
                    )
                    ->register(
                        'SUB_MENULINK_DATA',
                        array(
                            $this,
                            'RemoveDelete'
                        )
                    );
            }
        	public function HostData($arguments) {
        		if ($_REQUEST['node'] == 'host' && (($_REQUEST['sub'] == 'deploy') || ($_REQUEST['sub'] == 'edit') || ($_REQUEST['sub'] == 'membership'))) {
        			unset($arguments['data'][5],$arguments['template'][5]);
        			unset($arguments['data'][8],$arguments['template'][8]);
        			unset($arguments['data'][9],$arguments['template'][9]);
        			unset($arguments['data'][10],$arguments['template'][10]);
        			unset($arguments['data'][11],$arguments['template'][11]);
        		}
            }
        	public function RemoveSideNotes($arguments) {
        		if ($_REQUEST['node'] == 'host' && (($_REQUEST['sub'] == 'deploy') || ($_REQUEST['sub'] == 'edit') || ($_REQUEST['sub'] == 'membership'))) {
        			unset($arguments['notes']['Host']);
        			unset($arguments['notes']['MAC']);
        			unset($arguments['notes']['Image']);
        			unset($arguments['notes']['O/S']);
        			unset($arguments['notes']['Last Deployed']);
        			unset($arguments['notes']['Primary Group']);
        		}
            }
        	public function RemoveDelete($arguments) {
        		if ($_REQUEST['node'] == 'host' && (($_REQUEST['sub'] == 'deploy') || ($_REQUEST['sub'] == 'edit') || ($_REQUEST['sub'] == 'membership'))) {
        			if (!in_array(self::$FOGUser->get('type'),array(0))) {
        				unset($arguments['submenu']['?node=host&sub=membership&id='.$_REQUEST['id']]);
        				unset($arguments['submenu']['?node=host&sub=delete&id='.$_REQUEST['id']]);
        				unset($arguments['submenu']['?node=host&sub=edit&id='.$_REQUEST['id'].'#host-printers']); 
        				unset($arguments['submenu']['?node=host&sub=edit&id='.$_REQUEST['id'].'#host-service']);
        				unset($arguments['submenu']['?node=host&sub=edit&id='.$_REQUEST['id'].'#host-powermanagement']);
        				unset($arguments['submenu']['?node=host&sub=edit&id='.$_REQUEST['id'].'#host-virus-history']);
        				unset($arguments['submenu']['?node=host&sub=edit&id='.$_REQUEST['id'].'#host-login-history']);
        				unset($arguments['submenu']['?node=host&sub=edit&id='.$_REQUEST['id'].'#host-login-history']);
        				
        				
        			}
        		}
            }
        }
        
        G 1 Reply Last reply Oct 18, 2019, 6:16 PM Reply Quote 1
        • G
          Greg Plamondon Testers @Lee Rowlett
          last edited by Oct 18, 2019, 6:16 PM

          @Lee-Rowlett Thanks!

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Oct 29, 2019, 9:40 PM

            For anyone interested, here is a working example of how to hide the Domain Password field.

            1. Create a new empty file named /var/www/html/fog/lib/hooks/hideadhostdata.hook.php
            2. Change ownership: chown apache:apache /var/www/html/fog/lib/hooks/hideadhostdata.hook.php (this is for CentOS, use chown www-data:www-data ... for Debian/Ubuntu)
            3. Copy and paste the following code to that file and save it:
            <?php
            class hideadhostdata extends Hook {
                public $name = 'hideadhostdata';
                public $description = 'Hide some of the AD information in host edit view';
                public $author = 'SR';
                public $active = true;
                public function __construct()
                {
                    parent::__construct();
                    self::$HookManager
                        ->register(
                            'HOST_EDIT_AD', 
                            array($this, 'hideADHostData')
                        );
                }
                
                public function hideADHostData($arguments) {
                    if ($_REQUEST['node'] == 'host' && $_REQUEST['sub'] == 'edit') {
                        unset($arguments['data'][5],$arguments['template'][5]); // Domain Password
                    }
                }
            }
            ?>
            

            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

            G 2 Replies Last reply Oct 31, 2019, 2:18 PM Reply Quote 2
            • G
              Greg Plamondon Testers @Sebastian Roth
              last edited by Oct 31, 2019, 2:18 PM

              @Sebastian-Roth Thank you!

              1 Reply Last reply Reply Quote 1
              • G
                Greg Plamondon Testers @Sebastian Roth
                last edited by Nov 7, 2019, 1:47 PM

                @Sebastian-Roth
                Hey just wanted to post an update, I ran into one problem with this method. If you click the clear fields and then save, and then set the checkbox for “Join Domain after deploy” it doesn’t save the AD password to the database its left null

                T 1 Reply Last reply Nov 7, 2019, 1:55 PM Reply Quote 0
                • T
                  Tom Elliott @Greg Plamondon
                  last edited by Nov 7, 2019, 1:55 PM

                  @Greg-Plamondon That’s mainly because the field is completely missing and removed from the view. This means that when you submit, the hosts in question don’t get updated.

                  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

                  G 1 Reply Last reply Nov 7, 2019, 7:07 PM Reply Quote 0
                  • S
                    Sebastian Roth Moderator
                    last edited by Nov 7, 2019, 2:56 PM

                    @Greg-Plamondon Good point. We are working on a better solution to this anyway. See here: https://github.com/FOGProject/fogproject/issues/337

                    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
                    • G
                      Greg Plamondon Testers @Tom Elliott
                      last edited by Nov 7, 2019, 7:07 PM

                      @Tom-Elliott I have access to the DB so I can work around it.

                      1 Reply Last reply Reply Quote 0
                      • L
                        Lee Rowlett Developer
                        last edited by Nov 8, 2019, 1:19 AM

                        what if you cleared the template but not the data?

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

                        203

                        Online

                        12.1k

                        Users

                        17.3k

                        Topics

                        155.3k

                        Posts
                        Copyright © 2012-2024 FOG Project