From cb5c3456a28597699295910383972a5af6b7a5e9 Mon Sep 17 00:00:00 2001 From: Daniel Stefan Haischt Date: Wed, 12 Sep 2007 20:48:25 +0000 Subject: * bug fixing * added initial figures to doc dir --- packages/authng/doc/images/pfSense-Peers.png | Bin 0 -> 12813 bytes packages/authng/pkg/authng.inc | 4 +++- packages/authng/pkg/authng_classdefs.inc | 17 +++++++++++++++-- packages/authng/pkg/authng_peers.inc | 16 +++++++++------- 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 packages/authng/doc/images/pfSense-Peers.png diff --git a/packages/authng/doc/images/pfSense-Peers.png b/packages/authng/doc/images/pfSense-Peers.png new file mode 100644 index 00000000..b1ca8ea7 Binary files /dev/null and b/packages/authng/doc/images/pfSense-Peers.png differ diff --git a/packages/authng/pkg/authng.inc b/packages/authng/pkg/authng.inc index dbe2cc9d..509f5a18 100644 --- a/packages/authng/pkg/authng.inc +++ b/packages/authng/pkg/authng.inc @@ -43,7 +43,9 @@ require_once("authng_peers.inc"); // TODO: Define user- and groupindex array // get principal store type from config.xml -$principalStore = $config['system']['webgui']['principal_store']; +// TODO: needs to be defined in config.xml +//$principalStore = $config['system']['webgui']['principal_store']; +$principalStore = "xml"; // get PeerFactory instance $peerFactory =& PeerFactory::getInstance(); // get the actual UserPeer that holds the user index diff --git a/packages/authng/pkg/authng_classdefs.inc b/packages/authng/pkg/authng_classdefs.inc index a64dc415..7315bb6f 100644 --- a/packages/authng/pkg/authng_classdefs.inc +++ b/packages/authng/pkg/authng_classdefs.inc @@ -36,6 +36,19 @@ */ /* ========================================================================== */ +class Object { + function Object() { + $args = func_get_args(); + if (method_exists($this, '__destruct')) { + register_shutdown_function(array(&$this, '__destruct')); + } + call_user_func_array(array(&$this, '__construct'), $args); + } + + function __construct() { + } +} + class SingletonInterface extends Object { function __construct() { // Perform object initialization here. @@ -64,7 +77,7 @@ class AuthMethodFactory extends SingletonInterface { return parent::__getInstanceImp('AuthMethodFactory'); } - function &getBackendByName($name) { + function &getAuthMethodByName($name) { $result = null; /* Each name links to an entry in config.xml @@ -103,7 +116,7 @@ class BackendFactory extends SingletonInterface { return parent::__getInstanceImp('BackendFactory'); } - function &getAuthMethodByName($name) { + function &getBackendByName($name) { $result = null; /* Each name links to an entry in config.xml diff --git a/packages/authng/pkg/authng_peers.inc b/packages/authng/pkg/authng_peers.inc index 65546c41..e1640edc 100644 --- a/packages/authng/pkg/authng_peers.inc +++ b/packages/authng/pkg/authng_peers.inc @@ -36,7 +36,7 @@ */ /* ========================================================================== */ -require_once("authng_classdefs"); +require_once("authng_classdefs.inc"); class PeerFactory extends SingletonInterface { function __construct() { @@ -54,7 +54,7 @@ class PeerFactory extends SingletonInterface { /* Each name links to an entry in config.xml * Example: xml */ - switch ($name) { + switch ($store) { case "xml": $result = new XMLGroupPeer(); break; @@ -76,7 +76,7 @@ class PeerFactory extends SingletonInterface { /* Each name links to an entry in config.xml * Example: xml */ - switch ($name) { + switch ($store) { case "xml": $result = new XMLUserPeer(); break; @@ -201,7 +201,7 @@ class AbstractUserPeer { function isSystemAdmin($username) { $result = false; - $user = getUserByName($username); + $user = $this->getUserByName($username); if ($user) { $result = $user->isSystemAdmin(); @@ -252,7 +252,7 @@ class AbstractGroupPeer { function getGroupHomePage($groupname) { $result = false; - $group = getGroupByName($groupname); + $group = $this->getGroupByName($groupname); if ($group) { $result = $group->getHome(); @@ -355,6 +355,7 @@ class XMLUserPeer extends AbstractUserPeer { foreach($config['system']['user'] as $userent) { $this->user_index[$userent['name']] = $i; + $this->addUserFromEnt($userent); $i++; } } @@ -369,6 +370,7 @@ class XMLUserPeer extends AbstractUserPeer { /* ========================================================================== */ function addUserFromEnt(&$ent) { + print "HURTZ"; $newUser = new AuthngUser(); $newUser->setName($ent['name']); $newUser->setFullname($ent['fullname']); @@ -387,7 +389,7 @@ class XMLUserPeer extends AbstractUserPeer { } } - $this->users[] = $newUser; + $this->users["${ent['name']}"] = $newUser; } function setUserName($id, $name) { @@ -465,7 +467,7 @@ class XMLGroupPeer extends AbstractGroupPeer { } } - $this->groups[] = $newGoup; + $this->groups["${ent['name']}"] = $newGoup; } function setGroupName($id, $name) { -- cgit v1.2.3