First cut of field locks support. functional but missing strings and support for LDAP/DB modules.
- Extended set_config() - Implemented get_config() which takes over $CFG loading in setup.php - admin/auth.php has special handling if post vars starting in pluginconfig_ - admin/auth.php print_auth_lock_options() prints a form fragment -- being called from most plugins now - user/edit.php follows the new convention when locking down fields, both javascript UI and on POST.
This commit is contained in:
+11
-7
@@ -126,11 +126,13 @@
|
||||
// override locked values
|
||||
if (!isadmin()) {
|
||||
$fields = get_user_fieldnames();
|
||||
$authconfig = get_config( 'auth/' . $user->auth );
|
||||
foreach ($fields as $field) {
|
||||
$configvariable = 'auth_user_'.$field.'_editlock';
|
||||
if (!empty($CFG->$configvariable)) {
|
||||
if (isset($usernew->$field) && $user->$field !== $usernew->$field) {
|
||||
$usernew->$field = $user->$field;
|
||||
$configvariable = 'field_lock_' . $field;
|
||||
if ( $authconfig->{$configvariable} === 'locked'
|
||||
|| ($authconfig->{$configvariable} === 'unlockedifempty' && !empty($user->$field)) ) {
|
||||
if (!empty( $user->$field)) {
|
||||
$usernew->$field = $user->$field;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,9 +325,11 @@
|
||||
echo '<script type="text/javascript">'."\n";
|
||||
echo '<!--'."\n";
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$configvariable = 'auth_user_'.$field.'_editlock';
|
||||
if (!empty($CFG->$configvariable)) {
|
||||
$authconfig = get_config( 'auth/' . $user->auth );
|
||||
foreach ($fields as $field) {
|
||||
$configvariable = 'field_lock_' . $field;
|
||||
if ( $authconfig->{$configvariable} === 'locked'
|
||||
|| ($authconfig->{$configvariable} === 'unlockedifempty' && !empty($user->$field)) ) {
|
||||
echo "eval('document.form.$field.disabled=true');\n";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user