2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< html > < head > < title > Module HowTo - Configuration options< / title >  
						 
					
						
							
								
									
										
										
										
											2010-10-24 13:52:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2008-01-01 13:06:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  < link  rel = "stylesheet"  type = "text/css"  href = "style/layout.css" > 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-24 13:52:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									< link  rel = "shortcut icon"  type = "image/x-icon"  href = "images/favicon.ico" > < / head > < body > 
							 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< h1 > Module HowTo - Configuration options< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / h1 >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< div  style = "text-align: left;" > < br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								There might be situations where you want to give the user the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								possibility to make general settings which are not useful to place on
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								the account detail pages or profile editor.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Therefore LAM allows the modules to define their own configuration
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								options. E.g. the < span  style = "font-style: italic;" > posixAccount< / span > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								module uses this to define the ranges for the UIDs.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LAM will display your configuration options only if the user also
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								selected your module.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / div >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< div  style = "text-align: left;" > < br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< h2 > 1. Defining configuration options< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / h2 >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								First you have to define what options you want to offer the user. LAM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								will display all options in one fieldset for each module. Please notice
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								that there will be no separation on account types if you module is
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								suitable for different account types.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The configuration options are specified with < span  style = "font-weight: bold;" > get_configOptions()< / span > 
							 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								or < span  style = "font-weight: bold;" > meta['config_options']< / span > .< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< span  style = "font-weight: bold; text-decoration: underline;" > Example:< / span > < br  style = "font-weight: bold; text-decoration: underline;" >  
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2010-10-24 13:52:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The < span  style = "font-style: italic;" > posixGroup< / span >  module offers several configuration options including the min/maximum values for GIDs.< br > 
							 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< table  style = "width: 100%; text-align: left;"  class = "mod-code"  border = "0"  cellpadding = "2"  cellspacing = "2" >  
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  < tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < td  style = "vertical-align: top;" >        /**< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       * Returns meta data that is interpreted by parent 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       *< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       * @return array array with meta data< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       */< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < span  style = "font-weight: bold;" >  function< / span >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								get_metaData() {< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $return = array();< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              // configuration options< br >  
						 
					
						
							
								
									
										
										
										
											2010-10-24 13:52:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								              $configContainer = new htmlTable();< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $configContainer-> addElement(new htmlSubTitle(_("Groups")), true);< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $minGidInput = new 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								htmlTableExtendedInputField(_('Minimum GID number'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'posixGroup_minGID', null, 'minMaxGID');< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $minGidInput-> setRequired(true);< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $configContainer-> addElement($minGidInput, true);< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $maxGidInput = new 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								htmlTableExtendedInputField(_('Maximum GID number'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'posixGroup_maxGID', null, 'minMaxGID');< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $maxGidInput-> setRequired(true);< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $configContainer-> addElement($maxGidInput, true);< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $return[< span  style = "color: red;" > 'config_options'< / span > ][< span  style = "color: red;" > 'group'< / span > ] = $configContainer;< br >  
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								               [...]< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  < / tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / table >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2010-10-24 13:52:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The min/maximum GID numbers are defined with simple text boxes.< br > < br > 
							 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< h2 > 2. Checking user input< / h2 >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Probably you also want to check if the input data is syntactically
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								correct.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The < span  style = "font-style: italic;" > baseModule< / span >  already
							 
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								provides different checks which can be activated with < span  style = "font-style: italic;" > meta data< / span > . However you can also do
							 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								the checking in the module.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Implementing the function < span  style = "font-weight: bold;" > check_configOptions()< / span > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								in your module will allow you to do the checks yourself. Basic checks
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								can be defined with < span  style = "font-weight: bold;" > meta['config_checks']< / span > .< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< span  style = "font-weight: bold; text-decoration: underline;" > Example:< / span > < br  style = "font-weight: bold; text-decoration: underline;" >  
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The < span  style = "font-style: italic;" > posixGroup< / span >  module only
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								needs to check if the GID numbers are correct. The password hash type
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								needs not to be checked as it is a selection.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< table  style = "width: 100%; text-align: left;"  class = "mod-code"  border = "0"  cellpadding = "2"  cellspacing = "2" >  
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  < tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < td  style = "vertical-align: top;" >       /**< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       * Returns meta data that is interpreted by parent 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       *< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       * @return array array with meta data< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       */< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < span  style = "font-weight: bold;" >  function< / span >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								get_metaData() {< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              $return = array();< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              // configuration checks< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								              $return[< span  style = "color: rgb(255, 0, 0);" > 'config_checks'< / span > ][< span  style = "color: rgb(255, 0, 0);" > 'group'< / span > ]['posixGroup_minGID'] = 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								array (< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'type' =>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'ext_preg',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'regex' =>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'digit',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'required' 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								=>  true,< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  'required_message' =>  $this-> messages['gidNumber'][5],< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  'error_message' =>  $this-> messages['gidNumber'][5]);< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								              $return[< span  style = "color: rgb(255, 0, 0);" > 'config_checks'< / span > ][< span  style = "color: rgb(255, 0, 0);" > 'group'< / span > ]['posixGroup_maxGID'] = 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								array (< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'type' =>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'ext_preg',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'regex' =>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'digit',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'required' 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								=>  true,< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  'required_message' =>  $this-> messages['gidNumber'][6],< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  'error_message' =>  $this-> messages['gidNumber'][6]);< br >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								              $return[< span  style = "color: rgb(255, 0, 0);" > 'config_checks'< / span > ][< span  style = "color: rgb(255, 0, 0);" > 'group'< / span > ]['cmpGID'] = array (< br >  
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                     'type' =>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								'int_greater',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'cmp_name1' 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								=>  'posixGroup_maxGID',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                     'cmp_name2' 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								=>  'posixGroup_minGID',< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  'error_message' =>  $this-> messages['gidNumber'][7]);< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               [...]< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  < / tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / table >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The type < span  style = "font-weight: bold;" > "ext_preg"< / span >  means that
							 
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								the < span  style = "font-style: italic;" > baseModule< / span >  will use the < span  style = "font-style: italic;" > get_preg()< / span >  function in < span  style = "font-style: italic;" > lib/account.inc< / span >  for the syntax
							 
						 
					
						
							
								
									
										
										
										
											2004-11-14 15:09:19 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								check. This function already contains regular expressions for the most
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								common cases.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To check if the minimum GID is smaller than the maximum GID we define a
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								check for the nonexistant option "cmpGID" and define it as optional.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								This will do the comparison check.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< br >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< / div >  
						 
					
						
							
								
									
										
										
										
											2007-10-28 13:53:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< / body > < / html >