diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-10 07:58:34 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-10 07:58:34 +0000 |
commit | 6cde9118b11c0ca82ef415ea30a54db1b30fc1ce (patch) | |
tree | 2a4c7398906c27fd0114486c48107943b3405a18 /lib | |
parent | 46ffeca144b7ef44572a5805061da246c8be5f3c (diff) | |
download | ampache-6cde9118b11c0ca82ef415ea30a54db1b30fc1ce.tar.gz ampache-6cde9118b11c0ca82ef415ea30a54db1b30fc1ce.tar.bz2 ampache-6cde9118b11c0ca82ef415ea30a54db1b30fc1ce.zip |
added basic MPD user permissions in, I didnt force a level for everyone so any existing setups will be defaulted to DENIED until they update their Localplay Level
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/access.class.php | 34 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rw-r--r-- | lib/preferences.php | 2 |
3 files changed, 35 insertions, 3 deletions
diff --git a/lib/class/access.class.php b/lib/class/access.class.php index 59289c7c..3e8331e3 100644 --- a/lib/class/access.class.php +++ b/lib/class/access.class.php @@ -181,13 +181,13 @@ class Access { */ case 'init-xml-rpc': $sql = "SELECT `id` FROM `access_list`" . - " WHERE `start` <= '$ip' AND `end` >= '$ip' AND `type`='xml-rpc' AND `level` >= '$level'"; + " WHERE `start` <= '$ip' AND `end` >= '$ip' AND `type`='rpc' AND `level` >= '$level'"; break; case 'rpc': case 'xml-rpc': $sql = "SELECT `id` FROM `access_list`" . " WHERE `start` <= '$ip' AND `end` >= '$ip'" . - " AND `key` = '$key' AND `level` >= '$level' AND (`type`='xml-rpc' OR `type`='rpc')"; + " AND `key` = '$key' AND `level` >= '$level' AND `type`='rpc'"; break; case 'network': case 'interface': @@ -216,6 +216,36 @@ class Access { } // check_network /** + * check_access + * This is the global 'has_access' function it can check for any 'type' of object + * everything uses the global 0,5,25,50,75,100 stuff. GLOBALS['user'] is always used + */ + public static function check($type,$level) { + + $level = intval($level); + + // Switch on the type + switch ($type) { + case 'localplay': + // Check their localplay_level + if ($GLOBALS['user']->prefs['localplay_level'] >= $level) { + return true; + } + else { + return false; + } + break; + default: + return false; + break; + } // end switch on type + + // Default false + return false; + + } // check + + /** * validate_type * This cleans up and validates the specified type */ diff --git a/lib/init.php b/lib/init.php index 0342b01f..4611e4f0 100644 --- a/lib/init.php +++ b/lib/init.php @@ -81,7 +81,7 @@ if (!count($results)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.4-Alpha4 Build (003)'; +$results['version'] = '3.4-Alpha4 Build (004)'; $results['int_config_version'] = '6'; $results['raw_web_path'] = $results['web_path']; diff --git a/lib/preferences.php b/lib/preferences.php index 793b1db4..6a5b2bd5 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -263,9 +263,11 @@ function create_preference_input($name,$value) { case 'localplay_level': if ($value == '25') { $is_user = 'selected="selected"'; } elseif ($value == '100') { $is_admin = 'selected="selected"'; } + elseif ($value == '50') { $is_manager = 'selected="selected"'; } echo "<select name=\"$name\">\n"; echo "<option value=\"0\">" . _('Disabled') . "</option>\n"; echo "<option value=\"25\" $is_user>" . _('User') . "</option>\n"; + echo "<option value=\"50\" $is_manager>" . _('Manager') . "</option>\n"; echo "<option value=\"100\" $is_admin>" . _('Admin') . "</option>\n"; echo "</select>\n"; break; |