Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
authentication_folder.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/folder/folder.inc';
19 
32 {
33 
34 
41  function Authentication_Folder($assetid=0)
42  {
43  $this->Folder($assetid);
44 
45  }//end constructor
46 
47 
59  function create(&$link)
60  {
61  require_once SQ_CORE_PACKAGE_PATH.'/system/system_asset_fns.inc';
62  if (!system_asset_fns_create_pre_check($this)) {
63  return FALSE;
64  }
65  $GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2');
66  $GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN');
67 
68  if ($linkid = parent::create($link)) {
69  if (!system_asset_fns_create_cleanup($this)) {
70  $linkid = FALSE;
71  }
72  }
73 
74  if ($linkid) {
75  $GLOBALS['SQ_SYSTEM']->doTransaction('COMMIT');
76  } else {
77  $GLOBALS['SQ_SYSTEM']->doTransaction('ROLLBACK');
78  }
79 
80  $GLOBALS['SQ_SYSTEM']->restoreDatabaseConnection();
81  return $linkid;
82 
83  }//end create()
84 
85 
92  function canClone()
93  {
94  return FALSE;
95 
96  }//end canClone()
97 
98 
109  function morph($new_type_code)
110  {
111  trigger_localised_error('CORE0091', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
112  return FALSE;
113 
114  }//end morph()
115 
116 
126  function setAttrValue($name, $value)
127  {
128  if ($name == 'name') {
129  trigger_localised_error('CORE0111', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
130  return FALSE;
131  }
132 
133  return parent::setAttrValue($name, $value);
134 
135  }//end setAttrValue()
136 
137 
155  function createLink(&$minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0')
156  {
157  if ($GLOBALS['SQ_SYSTEM']->runLevelEnables(SQ_SECURITY_LINK_INTEGRITY)) {
158  trigger_localised_error('CORE00117', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
159  return 0;
160  } else {
161  return parent::createLink($minor, $link_type, $value, $sort_order, $dependant, $exclusive);
162  }
163 
164  }//end createLink()
165 
166 
175  function deleteLink($linkid)
176  {
177  trigger_localised_error('CORE0118', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
178  return FALSE;
179 
180  }//end deleteLink()
181 
182 
189  function canDelete()
190  {
191  return FALSE;
192 
193  }//end canDelete()
194 
195 
203  function _getAllowedLinks()
204  {
205  return Array(SQ_LINK_TYPE_1 => Array('authentication' => Array('card' => 'M', 'exclusive' => TRUE)));
206 
207  }//end _getAllowedLinks()
208 
209 
222  function writeAccess($lock_type='', $assetids=Array())
223  {
224  // only root can write to this folder so we add this extra checking
225  // before going up to our parent to check access
226  if (empty($assetids)) {
227  if ($GLOBALS['SQ_SYSTEM']->userRoot()) {
228  return parent::writeAccess($lock_type, $assetids);
229  }
230  } else {
231  $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
232  if (in_array($root_user->id, $assetids)) {
233  return parent::writeAccess($lock_type, $assetids);
234  }
235  }
236  return FALSE;
237 
238  }//end writeAccess()
239 
240 
250  function getAuthSystems()
251  {
252  $type_code = (SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS) ? 'authentication' : 'authentication_default';
253  $links = $GLOBALS['SQ_SYSTEM']->am->getLinks($this->id, SQ_LINK_TYPE_1, $type_code, !SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS);
254  $installed_auth_types = Array();
255  foreach ($links as $link_data) {
256  $installed_auth_types[] = $link_data['minorid'];
257  }
258  return $installed_auth_types;
259 
260  }//end getAuthSystems()
261 
262 
263 }//end class
264 
265 ?>