Skip to content

Commit

Permalink
Factorize decalreconfig in parent
Browse files Browse the repository at this point in the history
  • Loading branch information
olberger committed Mar 24, 2011
1 parent 60e721e commit 0559d7f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/common/include/AuthPlugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ abstract class ForgeAuthPlugin extends Plugin {
* ForgeAuthPlugin() - constructor
*
*/
function ForgeAuthPlugin() {
function ForgeAuthPlugin($name) {
$this->Plugin();
$this->name = $name;

// Common hooks that can be enabled per plugin:
// check_auth_session - is there a valid session?
// fetch_authenticated_user - what GFUser is logged in?
Expand All @@ -52,6 +54,8 @@ function ForgeAuthPlugin() {
// close_auth_session - terminate an authentication session

$this->saved_user = NULL;

$this->declareConfigVars();
}

// Hook dispatcher
Expand Down
19 changes: 16 additions & 3 deletions src/plugins/authbuiltin/common/AuthBuiltinPlugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ class AuthBuiltinPlugin extends ForgeAuthPlugin {
*
*/
function AuthBuiltinPlugin() {
$this->ForgeAuthPlugin();
$this->ForgeAuthPlugin('authbuiltin');

$this->name = 'authbuiltin';
$this->text = 'Built-in authentication';

$this->_addHook('check_auth_session');
Expand All @@ -47,7 +46,7 @@ function AuthBuiltinPlugin() {
// restrict_roles - filter out unwanted roles
$this->_addHook('close_auth_session');

$this->declareConfigVars();
//$this->declareConfigVars();
}

/**
Expand Down Expand Up @@ -90,6 +89,20 @@ function displayAuthForm(&$params) {

$params['html_snippets'][$this->name] = $result;
}
/**
* TODO: Enter description here ...
*/
protected function declareConfigVars() {
parent::declareConfigVars();

// Change vs default
forge_define_config_item ('required', $this->name, 'yes');
forge_set_config_item_bool ('required', $this->name) ;

// Change vs default
forge_define_config_item ('sufficient', $this->name, 'yes');
forge_set_config_item_bool ('sufficient', $this->name) ;
}
}

// Local Variables:
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/authcas/include/AuthCASPlugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function AuthCASPlugin () {
//$this->saved_login = '';
//$this->saved_user = NULL;

$this->declareConfigVars();
//$this->declareConfigVars();
}

private static $init = false;
Expand Down Expand Up @@ -170,6 +170,14 @@ function closeAuthSession($params) {
protected function declareConfigVars() {
parent::declareConfigVars();

// Change vs default
forge_define_config_item ('required', $this->name, 'yes');
forge_set_config_item_bool ('required', $this->name) ;

// Change vs default
forge_define_config_item ('sufficient', $this->name, 'yes');
forge_set_config_item_bool ('sufficient', $this->name) ;

forge_define_config_item ('cas_server', $this->name, 'cas.example.com');
forge_define_config_item ('cas_port', $this->name, 443);
forge_define_config_item ('cas_version', $this->name, '2.0');
Expand Down
16 changes: 15 additions & 1 deletion src/plugins/authhttpd/include/AuthHTTPDPlugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function AuthHTTPDPlugin () {
//$this->saved_login = '';
//$this->saved_user = NULL;

$this->declareConfigVars();
//$this->declareConfigVars();
}

private static $init = false;
Expand Down Expand Up @@ -125,6 +125,20 @@ function closeAuthSession($params) {
// No way to close an HTTPD session from the server, unfortunately
return true;
}
/**
* TODO: Enter description here ...
*/
protected function declareConfigVars() {
parent::declareConfigVars();

// Change vs default
forge_define_config_item ('required', $this->name, 'yes');
forge_set_config_item_bool ('required', $this->name) ;

// Change vs default
forge_define_config_item ('sufficient', $this->name, 'yes');
forge_set_config_item_bool ('sufficient', $this->name) ;
}
}

// Local Variables:
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/authldap/include/AuthLDAPPlugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function AuthLDAPPlugin() {
$this->saved_password = '';
$this->saved_data = array();

$this->declareConfigVars();
//$this->declareConfigVars();
}

function syncAccountInfo($params) {
Expand Down Expand Up @@ -216,6 +216,14 @@ function displayAuthForm(&$params) {
protected function declareConfigVars() {
parent::declareConfigVars();

// Change vs default
forge_define_config_item ('required', $this->name, 'yes');
forge_set_config_item_bool ('required', $this->name) ;

// Change vs default
forge_define_config_item ('sufficient', $this->name, 'yes');
forge_set_config_item_bool ('sufficient', $this->name) ;

forge_define_config_item('start_tls', $this->name, 'no');
forge_set_config_item_bool('start_tls', $this->name);

Expand Down

0 comments on commit 0559d7f

Please sign in to comment.