diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-11-15 19:21:18 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-11-15 19:21:18 -0200 |
commit | 7997ed4440ce34234f20b3525ee7641d164914c7 (patch) | |
tree | e9371e932799303f6d774338c818fbc8d70a101a /etc/inc/upgrade_config.inc | |
parent | 2d845db7b85c222e5cb7a6adb7ecd5c6502de4af (diff) | |
download | pfsense-7997ed4440ce34234f20b3525ee7641d164914c7.zip pfsense-7997ed4440ce34234f20b3525ee7641d164914c7.tar.gz |
Many fixes on privileges, ticket #3216:
- Rename some privileges:
page-diag-system-activity => page-diagnostics-system-activity
page-interfacess-groups => page-interfaces-groups
page-interfacess-lagg => page-interfaces-lagg
page-interfacess-qinq => page-interfaces-qinq
- Write an upgrade function to replace above privileges by the new name
- Remove unused privilege page-diagnostics-logs-wireless
- Remove duplicated privileges
- Fix limiter-info, pf-info and system-pftop that were using wrong name
- Add privs for edit pages (interfaces_groups, interfaces_lagg,
interfaces_qinq and services-igmpproxy)
- Fix ID for acptiveportal allowedhostnames and editallowedhostnames
- Fix some wrong matches
Diffstat (limited to 'etc/inc/upgrade_config.inc')
-rw-r--r-- | etc/inc/upgrade_config.inc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 6cce866..53d0cd8 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -3213,4 +3213,38 @@ function upgrade_102_to_103() { unset($config['nat']['advancedoutbound']); } +function upgrade_103_to_104() { + global $config; + + $changed_privs = array( + "page-diag-system-activity" => "page-diagnostics-system-activity", + "page-interfacess-groups" => "page-interfaces-groups", + "page-interfacess-lagg" => "page-interfaces-lagg", + "page-interfacess-qinq" => "page-interfaces-qinq" + ); + + /* update user privileges */ + foreach ($config['system']['user'] as & $user) { + if (!is_array($user['priv'])) + continue; + foreach ($user['priv'] as & $priv) { + if (array_key_exists($priv, $changed_privs)) + $priv = $changed_privs[$priv]; + } + } + + /* update group privileges */ + foreach ($config['system']['group'] as & $group) { + if (!is_array($group['priv'])) + continue; + foreach ($group['priv'] as & $priv) { + if (array_key_exists($priv, $changed_privs)) + $priv = $changed_privs[$priv]; + } + } + + /* sync all local account information */ + local_sync_accounts(); +} + ?> |