Commit a12fd49090c6c0398d3f7f147978c7435c44629f

Authored by nbm
1 parent acf43690

Add addUserFromSource, which is a hook available to authentication

providers so that they can find and create a user from the
authentication source.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4245 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/userManagement.php
@@ -77,17 +77,34 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { @@ -77,17 +77,34 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
77 // nice, easy bits. 77 // nice, easy bits.
78 $add_fields[] = new KTStringWidget('Mobile Number','The mobile phone number of the user. If the system is configured to send notifications to cellphones, then this number will be SMS\'d with notifications. e.g. <strong>999 9999 999</strong>', 'mobile_number', null, $this->oPage, false); 78 $add_fields[] = new KTStringWidget('Mobile Number','The mobile phone number of the user. If the system is configured to send notifications to cellphones, then this number will be SMS\'d with notifications. e.g. <strong>999 9999 999</strong>', 'mobile_number', null, $this->oPage, false);
79 $add_fields[] = new KTStringWidget('Maximum Sessions','As a safety precaution, it is useful to limit the number of times a given account can log in, before logging out. This prevents a single account being used by many different people.', 'max_sessions', '3', $this->oPage, true); 79 $add_fields[] = new KTStringWidget('Maximum Sessions','As a safety precaution, it is useful to limit the number of times a given account can log in, before logging out. This prevents a single account being used by many different people.', 'max_sessions', '3', $this->oPage, true);
  80 +
  81 + $aAuthenticationSources =& KTAuthenticationSource::getList();
80 82
81 - $oTemplating = new KTTemplating; 83 + $oTemplating = new KTTemplating;
82 $oTemplate = $oTemplating->loadTemplate("ktcore/principals/adduser"); 84 $oTemplate = $oTemplating->loadTemplate("ktcore/principals/adduser");
83 $aTemplateData = array( 85 $aTemplateData = array(
84 - "context" => $this, 86 + "context" => &$this,
85 "add_fields" => $add_fields, 87 "add_fields" => $add_fields,
  88 + "authentication_sources" => $aAuthenticationSources,
86 ); 89 );
87 return $oTemplate->render($aTemplateData); 90 return $oTemplate->render($aTemplateData);
88 } 91 }
89 92
  93 + function do_addUserFromSource() {
  94 + $oSource =& KTAuthenticationSource::get($_REQUEST['source_id']);
  95 + $sProvider = $oSource->getAuthenticationProvider();
  96 + $oRegistry =& KTAuthenticationProviderRegistry::getSingleton();
  97 + $oProvider =& $oRegistry->getAuthenticationProvider($sProvider);
90 98
  99 + $this->aBreadcrumbs[] = array('action' => 'userManagement', 'name' => 'User Management');
  100 + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'] . '?action=addUser', 'name' => 'add a new user');
  101 + $oProvider->aBreadcrumbs = $this->aBreadcrumbs;
  102 + $oProvider->oPage->setBreadcrumbDetails($oSource->getName());
  103 + $oProvider->oPage->setTitle("Modify User Details");
  104 +
  105 + $oProvider->dispatch();
  106 + exit(0);
  107 + }
91 108
92 function do_editUser() { 109 function do_editUser() {
93 $this->aBreadcrumbs[] = array('action' => 'userManagement', 'name' => 'User Management'); 110 $this->aBreadcrumbs[] = array('action' => 'userManagement', 'name' => 'User Management');
@@ -430,4 +447,4 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { @@ -430,4 +447,4 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
430 //$oDispatcher = new KTUserAdminDispatcher (); 447 //$oDispatcher = new KTUserAdminDispatcher ();
431 //$oDispatcher->dispatch(); 448 //$oDispatcher->dispatch();
432 449
433 -?>  
434 \ No newline at end of file 450 \ No newline at end of file
  451 +?>