From: Florent Bruneau Date: Wed, 22 Sep 2010 07:53:11 +0000 (+0200) Subject: Can create accounts with school or fx permission in addition to those with X-Git-Tag: xorg/1.0.1~160 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=67cff5203241447af50960985f0d46637bbf86c1;p=platal.git Can create accounts with school or fx permission in addition to those with ax permission in admin/accounts. Signed-off-by: Florent Bruneau --- diff --git a/modules/admin.php b/modules/admin.php index 04d17b8..e0c5d04 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -1151,9 +1151,10 @@ class AdminModule extends PLModule S::assert_xsrf_token(); $firstname = Post::t('firstname'); $lastname = strtoupper(Post::t('lastname')); - $sex = Post::b('sex') ? User::GENDER_FEMALE : User::GENDER_FEMALE; + $sex = Post::b('sex') ? User::GENDER_FEMALE : User::GENDER_MALE; $email = Post::t('email'); - $login = PlUser::makeHrid($firstname, $lastname, 'ax'); + $type = Post::s('type'); + $login = PlUser::makeHrid($firstname, $lastname, $type); if (!isvalid_email($email)) { $page->trigError("Invalid email address: $email"); } else if (strlen(Post::s('pwhash')) != 40) { @@ -1164,14 +1165,14 @@ class AdminModule extends PLModule XDB::execute("INSERT INTO accounts (hruid, type, state, password, registration_date, email, full_name, display_name, sex, directory_name) - VALUES ({?}, 'ax', 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?})", - $login, Post::s('pwhash'), $email, $full_name, $full_name, $sex, + VALUES ({?}, {?}, 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?})", + $login, $type, Post::s('pwhash'), $email, $full_name, $full_name, $sex, $directory_name); } } - $uf = new UserFilter(new UFC_AccountType('ax')); - $page->assign('users', $uf->iterUsers(new PlLimit(10))); + $uf = new UserFilter(new UFC_AccountType('ax', 'school', 'fx')); + $page->assign('users', $uf->iterUsers()); } diff --git a/templates/admin/accounts.tpl b/templates/admin/accounts.tpl index 5488d05..a61bc3b 100644 --- a/templates/admin/accounts.tpl +++ b/templates/admin/accounts.tpl @@ -71,6 +71,16 @@ function add_user_to_url(f) { {xsrf_token_field} + + + +
Type de compte + +
Nom