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/class | |
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/class')
-rw-r--r-- | lib/class/access.class.php | 34 |
1 files changed, 32 insertions, 2 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 */ |