From e5f940ab00ba5930025d71c5237bc3d8ea45f91a Mon Sep 17 00:00:00 2001
From: Leif Andersson <leif.andersson@control.lth.se>
Date: Thu, 3 Sep 2015 11:31:04 +0200
Subject: [PATCH] Added the permission ReglerAddress. Removed some parameters
 from Regler.address.module.

---
 ReglerAddress.module.php | 82 ----------------------------------------
 method.install.php       |  3 +-
 method.uninstall.php     |  3 ++
 3 files changed, 5 insertions(+), 83 deletions(-)

diff --git a/ReglerAddress.module.php b/ReglerAddress.module.php
index 88abe4f..9baa73c 100644
--- a/ReglerAddress.module.php
+++ b/ReglerAddress.module.php
@@ -178,88 +178,6 @@ class ReglerAddress extends CMSModule
     $this->RegisterModulePlugin();
     $this->RestrictUnknownParams();
 
-  $this->CreateParameter('title','','title');
-  $this->SetParameterType('title',CLEAN_STRING);
-
-  $this->CreateParameter('author','','author');
-  $this->SetParameterType('author',CLEAN_STRING);
-
-  $help = 'The first year in the desired range.';
-  $this->CreateParameter('yearFrom','',$help);
-  $this->SetParameterType('yearFrom',CLEAN_INT);
-
-  $help = 'The last year in the desired range. If this parameter is unset, '
-    . 'the last publication selected is of current year and month. '
-    . 'The special value "0" is equivalent to a year far in the future.';
-  $this->CreateParameter('yearTo','',$help);
-  $this->SetParameterType('yearTo',CLEAN_INT);
-
-  $help = 'The article type. Possible values are book, inbook, '
-    . 'art (journal article), inproc (conference contribution), '
-    . 'phd, lic, msc, techrep, popsci, man, proc (The entire proceedings, '
-    . 'not an individual contribution), misc, unpubl';
-  $this->CreateParameter('articleType','',$help);
-  $this->SetParameterType('articleType',CLEAN_STRING);
-
-  $this->CreateParameter('keywords','','keywords');
-  $this->SetParameterType('keywords',CLEAN_STRING);
-
-  $this->CreateParameter('abstract','','abstract');
-  $this->SetParameterType('abstract',CLEAN_STRING);
-
-  $this->CreateParameter('project','','project');
-  $this->SetParameterType('project',CLEAN_STRING);
-
-  $this->CreateParameter('search','','search');
-  $this->SetParameterType('search',CLEAN_STRING);
-  
-  $this->CreateParameter('annual','','annual');
-  $this->SetParameterType('annual',CLEAN_STRING);
-  
-  $help = 'If true, then present a search form on the page.';
-  $this->CreateParameter('searchForm','true',$help);
-  $this->SetParameterType('searchForm',CLEAN_STRING);
-  
-  $help = 'The unique author key.';
-  $this->CreateParameter('authkey','',$help);
-  $this->SetParameterType('authkey',CLEAN_STRING);
-  
-  $help = 'Presentation style. Possible values: table (default), '
-    . 'short, full.'; 
-  $this->CreateParameter('style','',$help);
-  $this->SetParameterType('style',CLEAN_STRING);
-  
-  $help = 'Limit the number of items presented to this.';
-  $this->CreateParameter('limit','',$help);
-  $this->SetParameterType('limit',CLEAN_INT);
-  
-  $this->CreateParameter('request','','request');
-  $this->SetParameterType('request',CLEAN_STRING);
-
-  $this->CreateParameter('mailAddress','','mailAddress');
-  $this->SetParameterType('mailAddress',CLEAN_STRING);
-
-  $help = 'The unique publication key.';
-  $this->CreateParameter('artkey','',$help);
-  $this->SetParameterType('artkey',CLEAN_STRING);
-
-  $this->CreateParameter('year','','year');
-  $this->SetParameterType('year',CLEAN_STRING);
-
-  $this->CreateParameter('origid','','origid');
-  $this->SetParameterType('origid',CLEAN_STRING);
-
-  
-  $this->CreateParameter('showBibtex','','showBibtex');
-  $this->SetParameterType('showBibtex',CLEAN_STRING);
-
-  $help = 'Publication status to select which publications to show. '
-    . 'Possible values: submitted, accepted, publishedOnline, published. '
-    . 'The values are ordered, so a specific value means '
-    . '"show with this value or higher". Default: accepted.';
-  $this->CreateParameter('publicationStatus','',$help);
-  $this->SetParameterType('publicationStatus',CLEAN_STRING);
-
   $this->RegisterRoute('#Publication/(?P<artkey>.+$)#',
 		       array('action'=>'showpublication', 'returnid'=>'60'));
  
diff --git a/method.install.php b/method.install.php
index 69277fa..2b52a1b 100644
--- a/method.install.php
+++ b/method.install.php
@@ -7,7 +7,8 @@
 if (!isset($gCms)) exit;
 
 // put mention into the admin log
-$this->Audit( 0, 'ReglerAddress', 'installed');
+$this->Audit( 0, 'ReglerAddress', $this->GetVersion . ' installed');
+$this->CreatePermission('Use ReglerAddress', 'Use ReglerAddress');
 
               
 ?>
diff --git a/method.uninstall.php b/method.uninstall.php
index 04cac38..40a3846 100644
--- a/method.uninstall.php
+++ b/method.uninstall.php
@@ -6,6 +6,9 @@
 
 if (!isset($gCms)) exit;
 
+// remove the permissions
+$this->RemovePermission('Use ReglerAddress');
+
 // put mention into the admin log
 $this->Audit( 0, 'ReglerAddress', 'uninstalled');
 
-- 
GitLab