From a733f6d43ad0cd79a818b6567dbbc6f2e0d22ee4 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 11 Apr 2009 22:32:42 +1200 Subject: [PATCH] Add configuration to allow an admin to set user default values. --- config/example-config.php | 14 +++++++++++++- inc/RSCDSUser.php | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/config/example-config.php b/config/example-config.php index 220feaea..657152a3 100644 --- a/config/example-config.php +++ b/config/example-config.php @@ -124,6 +124,18 @@ $c->collections_always_exist = false; // $c->default_relationships = array(); +/** +* An array of fields on the usr record which should be set to specific +* values when the users are created. +* Default: none +*/ +// $c->template_usr = array( 'active' => true, +// 'locale' => 'it_IT', +// 'date_format_type' => 'E', +// 'email_ok' => date('Y-m-d') +// ); + + /*************************************************************************** * * * External Authentication Sources * @@ -300,4 +312,4 @@ $c->collections_always_exist = false; * If the only person that devious is your sysadmin then you probably already * enabled this option... */ -// $c->allow_get_email_visibility = false; \ No newline at end of file +// $c->allow_get_email_visibility = false; diff --git a/inc/RSCDSUser.php b/inc/RSCDSUser.php index be5029bd..ebe9acf9 100644 --- a/inc/RSCDSUser.php +++ b/inc/RSCDSUser.php @@ -9,7 +9,7 @@ * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 */ -require_once("User.php"); +require("User.php"); require_once("classBrowser.php"); require_once("auth-functions.php"); @@ -30,8 +30,14 @@ class RSCDSUser extends User * Constructor - nothing fancy as yet. */ function RSCDSUser( $id , $prefix = "") { + global $c; $this->delete_collection_confirmation_required = null; parent::User( $id, $prefix ); + if ( $this->user_no == 0 && isset($c->template_usr) && is_array($c->template_usr) ) { + foreach( $c->template_usr AS $k => $v ) { + $this->Set($k,$v); + } + } } /** @@ -78,6 +84,8 @@ class RSCDSUser extends User return $html; } + + /** * Render input file to import ics in calendar user * @@ -100,6 +108,7 @@ class RSCDSUser extends User return $html; } + /** * Render the user's relationships to other users & resources * @@ -148,6 +157,7 @@ class RSCDSUser extends User return $html; } + /** * Render the user's relationships to other users & resources *