From 258cee47b08a36dbf259775a0fe601c19ad0e0fc Mon Sep 17 00:00:00 2001 From: chriskl Date: Tue, 5 Aug 2003 08:54:20 +0000 Subject: [PATCH] DOH remove show all user privs feature cos it's not possible across all databases - no wonder it didn't work --- classes/database/Postgres.php | 62 +---------------------------------- users.php | 32 +----------------- 2 files changed, 2 insertions(+), 92 deletions(-) diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index 30301fff..556a4b4d 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres.php,v 1.132 2003/08/05 01:54:10 chriskl Exp $ + * $Id: Postgres.php,v 1.133 2003/08/05 08:54:20 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -2086,66 +2086,6 @@ class Postgres extends BaseDB { else return $this->_parseACL($acl); } - /** - * Grabs an array of privileges that a user has - * @param $username The user who we are checking - * @return Privileges array - */ - function getUserPrivileges($username) { - $this->clean($username); - - $sql = " - SELECT - CASE WHEN relkind='r' THEN 'TABLE' WHEN relkind='v' THEN 'VIEW' WHEN relkind='S' THEN 'SEQUENCE' END AS type, - CAST('public' AS TEXT) AS schemaname, - CAST(NULL AS TEXT) AS relname, - relname AS name, - relacl - FROM - pg_class - WHERE - relkind IN ('r', 'v', 'S') - AND (relacl IS NOT NULL OR relowner=(SELECT usesysid FROM pg_user WHERE usename='{$username}')) - ORDER BY - 1, 2, 3, 4"; - - // Fetch the ACL for object - $acls = $this->selectSet($sql); - if (!is_object($acls)) return array(); - - // RETURN FORMAT: - // ARRAY(type, schemaname, relname, name, ARRAY(privs), grantor, ARRAY(grantoptions)) - - // Loop over the results and check to see if any of the ACLs apply to the user - $temp = array(); - while (!$acls->EOF) { - // If they own the table, then do an 'all privileges simulation' - if ($acls->f['relacl'] == null) { - $temp[] = array($acls->f['type'], $acls->f['schemaname'], $acls->f['relname'], $acls->f['name'], - array(), $username, array()); - } - else { - $privs = $this->_parseACL($acls->f['relacl']); - - // Loop over all privs to see if we're in there - foreach ($privs as $v) { - // Skip non-user ACEs - if ($v[0] != 'user') continue; - // Skip entities that aren't us - if ($v[1] != $username) continue; - echo "
", var_dump($v), "
"; - // OK, so it's for us... - $temp[] = array($acls->f['type'], $acls->f['schemaname'], $acls->f['relname'], $acls->f['name'], - $v[2], $v[3], $v[4]); - } - } - - $acls->moveNext(); - } -echo "
", var_dump($temp), "
"; - return $temp; - } - /** * Grants a privilege to a user, group or public * @param $mode 'GRANT' or 'REVOKE'; diff --git a/users.php b/users.php index 12279132..9fccc909 100644 --- a/users.php +++ b/users.php @@ -3,7 +3,7 @@ /** * Manage users in a database cluster * - * $Id: users.php,v 1.15 2003/07/31 08:39:03 chriskl Exp $ + * $Id: users.php,v 1.16 2003/08/05 08:54:20 chriskl Exp $ */ // Include application functions @@ -12,36 +12,6 @@ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : ''; if (!isset($msg)) $msg = ''; $PHP_SELF = $_SERVER['PHP_SELF']; - - /** - * Show access privileges that a user posesses - */ - function doPrivileges($msg = '') { - global $data, $misc; - global $PHP_SELF, $lang; - - echo "

{$lang['strusers']}: ", $misc->printVal($_REQUEST['username']), ": {$lang['strprivileges']}

\n"; - $misc->printMsg($msg); - - $userdata = &$data->getUserPrivileges($_REQUEST['username']); - - if ($userdata->recordCount() > 0) { - $userdata->f[$data->uFields['usuper']] = $data->phpBool($userdata->f[$data->uFields['usuper']]); - $userdata->f[$data->uFields['ucreatedb']] = $data->phpBool($userdata->f[$data->uFields['ucreatedb']]); - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
{$lang['strusername']}{$lang['strsuper']}{$lang['strcreatedb']}{$lang['strexpires']}
", $misc->printVal($userdata->f[$data->uFields['uname']]), "", (($userdata->f[$data->uFields['usuper']]) ? $lang['stryes'] : $lang['strno']), "", (($userdata->f[$data->uFields['ucreatedb']]) ? $lang['stryes'] : $lang['strno']), "", $misc->printVal($userdata->f[$data->uFields['uexpires']]), "
\n"; - } - else echo "

{$lang['strnodata']}

\n"; - - echo "

{$lang['strshowallusers']} |\n"; - echo "{$lang['stredit']}

\n"; - } /** * If a user is not a superuser, then we have an 'account management' page -- 2.39.5