From 233aa24522727473e364afbda0e20e09dc6b34d4 Mon Sep 17 00:00:00 2001
From: Leif Andersson <leif.andersson@control.lth.se>
Date: Fri, 28 May 2021 13:03:20 +0200
Subject: [PATCH] =?UTF-8?q?Bara=20synlig=20f=C3=B6r=20medlemmar=20i=20"Use?=
 =?UTF-8?q?ReglerAddress"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ReglerAddress.module.php | 15 ++++++++++++---
 action.defaultadmin.php  |  6 ++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/ReglerAddress.module.php b/ReglerAddress.module.php
index 08fb21e..961393b 100644
--- a/ReglerAddress.module.php
+++ b/ReglerAddress.module.php
@@ -19,7 +19,7 @@
  * @since 1.0
  * @version 2015-09-02
  * @modifiedby $LastChangedBy: LA $
- * @lastmodified $Date:  2015-09-02$
+ * @lastmodified $Date:  2021-05-28$
  * @license GPL
  **/
 class ReglerAddress extends CMSModule
@@ -43,7 +43,7 @@ class ReglerAddress extends CMSModule
    * GetVersion()
    * @return string version number (can be something like 1.4rc1)
    */
-  function GetVersion()  { return '2015-09-02'; }
+  function GetVersion()  { return '2021-05-28'; }
   
   /**
    * GetHelp()
@@ -115,9 +115,18 @@ class ReglerAddress extends CMSModule
 
   /**
    * VisibleToAdminUser()
+   * If your module does have an Admin Panel, you
+   * can control whether or not it's displayed by the boolean
+   * that is returned by this method. This is primarily used
+   * to hide modules from admins who lack permission to use
+   * them.
+   * In this case, the module will only be visible to admins
+   * who have "Use ReglerAddress" permissions.
    * @return bool True if this module is shown to current user
    */
-  function VisibleToAdminUser()  { return True; }
+  function VisibleToAdminUser()  {
+    return $this->CheckPermission('Use ReglerAddress');
+  }
     
   /**
    * GetDependencies()
diff --git a/action.defaultadmin.php b/action.defaultadmin.php
index 2755e15..9a147e3 100644
--- a/action.defaultadmin.php
+++ b/action.defaultadmin.php
@@ -15,6 +15,12 @@
 if( !defined('CMS_VERSION') ) exit;
 //echo '<pre>'; print_r($params); echo '</pre>';
 
+if (! $this->CheckPermission('Use ReglerAddress')) {
+  return $this->DisplayErrorPage($id, $params, $returnid,
+                                 'ReglerAddress Access denied');
+}
+
+
 
 $canChangeRecord = $this->CheckPermission('Use ReglerAddress');
 /**
-- 
GitLab