* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: BaseDB.php,v 1.9 2003/01/27 15:18:03 chriskl Exp $
+ * $Id: BaseDB.php,v 1.10 2003/02/09 10:22:38 chriskl Exp $
*/
include_once('classes/database/ADODB_base.php');
function hasLanguages() { return false; }
function hasSchemas() { return false; }
function hasConversions() { return false; }
+ function hasGrantOption() { return false; }
}
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.50 2003/02/09 09:23:39 chriskl Exp $
+ * $Id: Postgres.php,v 1.51 2003/02/09 10:22:39 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
$sql = "SELECT datacl AS acl FROM pg_database WHERE datname = '{$object}'";
break;
case 'function':
- $sql = "SELECT proacl AS acl FROM pg_proc WHERE proname = '{$object}'";
+ $sql = "SELECT proacl AS acl FROM pg_proc WHERE oid = '{$object}'";
break;
case 'language':
$sql = "SELECT lanacl AS acl FROM pg_language WHERE lanname = '{$object}'";
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres74.php,v 1.2 2003/01/18 06:38:37 chriskl Exp $
+ * $Id: Postgres74.php,v 1.3 2003/02/09 10:22:39 chriskl Exp $
*/
include_once('classes/database/Postgres73.php');
return $this->selectSet($sql);
}
+ // Capabilities
+ function hasGrantOption() { return true; }
+
}
?>
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.3 2003/02/07 17:34:34 xzilla Exp $
+ * $Id: database.php,v 1.4 2003/02/09 10:22:38 chriskl Exp $
*/
// Include application functions
*/
function doDefault($msg = '') {
global $data, $localData, $misc;
- global $PHP_SELF, $strName, $strOwner, $strSchemas, $strDrop, $strActions, $strCreateSchema, $strNoSchemas;
+ global $PHP_SELF, $strName, $strOwner, $strSchemas, $strDrop, $strActions;
+ global $strCreateSchema, $strNoSchemas, $strPrivileges;
$misc->printDatabaseNav();
echo "<h2>", htmlspecialchars($_REQUEST['database']), ": {$strSchemas}</h2>\n";
if ($schemas->recordCount() > 0) {
echo "<table>\n";
- echo "<tr><th class=data>{$strName}</th><th class=data>{$strOwner}</th><th class=data>{$strActions}</th>\n";
+ echo "<tr><th class=data>{$strName}</th><th class=data>{$strOwner}</th><th colspan=\"2\" class=data>{$strActions}</th>\n";
$i = 0;
while (!$schemas->EOF) {
$id = (($i % 2) == 0 ? '1' : '2');
echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_drop&database=",
htmlspecialchars($_REQUEST['database']), "&schema=",
htmlspecialchars($schemas->f[$data->nspFields['nspname']]), "\">{$strDrop}</a></td>\n";
+ echo "<td class=opbutton{$id}><a href=\"privileges.php?database=",
+ htmlspecialchars($_REQUEST['database']), "&object=",
+ htmlspecialchars($schemas->f[$data->nspFields['nspname']]), "&type=schema\">{$strPrivileges}</a></td>\n";
echo "</tr>\n";
$schemas->moveNext();
$i++;
/**
* Manage functions in a database
*
- * $Id: functions.php,v 1.2 2003/02/07 17:34:34 xzilla Exp $
+ * $Id: functions.php,v 1.3 2003/02/09 10:22:38 chriskl Exp $
*/
// Include application functions
function doDefault($msg = '') {
global $data, $localData, $misc, $database, $func;
global $PHP_SELF, $strFunctions, $strArguments, $strReturns, $strActions, $strNoFunctions;
+ global $strCreateFunction, $strProperties, $strEdit, $strDrop, $strPrivileges;
echo "<h2>", htmlspecialchars($_REQUEST['database']), ": Functions</h2>\n";
$misc->printMsg($msg);
if ($funcs->recordCount() > 0) {
echo "<table>\n";
- echo "<tr><th class=data>{$strFunctions}</th><th class=data>{$strReturns}</th><th class=data>{$strArguments}</th><th colspan=3 class=data>{$strActions}</th>\n";
+ echo "<tr><th class=data>{$strFunctions}</th><th class=data>{$strReturns}</th><th class=data>{$strArguments}</th><th colspan=\"4\" class=data>{$strActions}</th>\n";
$i = 0;
while (!$funcs->EOF) {
$func_full = $funcs->f[$data->fnFields['fnname']] . "(". $funcs->f[$data->fnFields['fnarguments']] .")";
echo "<td class=data{$id}>", htmlspecialchars($funcs->f[$data->fnFields['fnreturns']]), "</td>\n";
echo "<td class=data{$id}>", htmlspecialchars($funcs->f[$data->fnFields['fnarguments']]), "</td>\n";
echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=properties&{$misc->href}&function=",
- urlencode($func_full), "&function_oid=", $funcs->f[$data->fnFields['fnoid']], "\">Properties</a></td>\n";
+ urlencode($func_full), "&function_oid=", $funcs->f[$data->fnFields['fnoid']], "\">{$strProperties}</a></td>\n";
echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=edit&{$misc->href}&function=",
- urlencode($func_full), "&function_oid=", $funcs->f[$data->fnFields['fnoid']], "\">Edit</a></td>\n";
- echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&function=",
- urlencode($func_full), "&function_oid=", $funcs->f[$data->fnFields['fnoid']], "\">Drop</a></td>\n";
+ urlencode($func_full), "&function_oid=", $funcs->f[$data->fnFields['fnoid']], "\">{$strEdit}</a></td>\n";
+ echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&function=",
+ urlencode($func_full), "&function_oid=", $funcs->f[$data->fnFields['fnoid']], "\">{$strDrop}</a></td>\n";
+ echo "<td class=opbutton{$id}><a href=\"privileges.php?{$misc->href}&function=",
+ urlencode($func_full), "&object=",
+ $funcs->f[$data->fnFields['fnoid']], "&type=function\">{$strPrivileges}</a></td>\n";
echo "</tr>\n";
$funcs->moveNext();
$i++;
echo "<p>{$strNoFunctions}</p>\n";
}
- echo "<p><a class=navlink href=\"$PHP_SELF?action=create&{$misc->href}\">Create Function</a></p>\n";
+ echo "<p><a class=navlink href=\"$PHP_SELF?action=create&{$misc->href}\">{$strCreateFunction}</a></p>\n";
}
* Language template file for WebDB. Use this to base language
* files.
*
- * $Id: english.php,v 1.49 2003/01/27 15:18:03 chriskl Exp $
+ * $Id: english.php,v 1.50 2003/02/09 10:22:39 chriskl Exp $
*/
// Language and character set
// Privilges
$strPrivileges = 'Privileges';
+ $strNoPrivileges = 'This object has no privileges.';
$strGrant = 'Grant';
$strRevoke = 'Revoke';
* Language template file for WebDB. Use this to base language
* files.
*
- * $Id: english.php,v 1.5 2003/01/27 15:19:49 chriskl Exp $
+ * $Id: english.php,v 1.6 2003/02/09 10:22:39 chriskl Exp $
*/
// Language and character set
// Privilges
$strPrivileges = 'Privileges';
+ $strNoPrivileges = 'This object has no privileges.';
$strGrant = 'Grant';
$strRevoke = 'Revoke';
/**
* Manage privileges in a database
*
- * $Id: privileges.php,v 1.4 2003/02/09 09:23:37 chriskl Exp $
+ * $Id: privileges.php,v 1.5 2003/02/09 10:22:38 chriskl Exp $
*/
// Include application functions
function doDefault($msg = '') {
global $data, $localData, $misc, $database;
global $PHP_SELF, $strPrivileges, $strGrant, $strRevoke;
- global $strUser, $strGroup, $strSelect, $strInsert, $strUpdate, $strDelete, $strRule;
- global $strReferences, $strTrigger, $strAction, $strYes, $strNo, $strType;
+ global $strUser, $strGroup, $strYes, $strNo, $strType;
+ global $strShowAllViews, $strShowAllSequences, $strShowAllFunctions, $strNoPrivileges;
+ global $strShowAllSchemas;
switch ($_REQUEST['type']) {
case 'database':
$misc->printDatabaseNav();
+ $name = $_REQUEST['object'];
break;
case 'table':
$misc->printTableNav();
+ $name = $_REQUEST['object'];
break;
+ case 'function':
+ $name = $_REQUEST['function'];
+ break;
+ default:
+ $name = $_REQUEST['object'];
}
- echo "<h2>$strPrivileges: ", htmlspecialchars($_REQUEST['object']), "</h2>\n";
+ echo "<h2>$strPrivileges: ", htmlspecialchars($name), "</h2>\n";
$misc->printMsg($msg);
// Get the privileges on the object, given its type
$privileges = $localData->getPrivileges($_REQUEST['object'], $_REQUEST['type']);
- echo "<table>\n";
- echo "<tr><th class=\"data\">{$strType}</th><th class=\"data\">User/Group</th><th class=\"data\">",
- join('</th><th class="data">', $data->privlist[$_REQUEST['type']]), "</th>";
- echo "<th class=\"data\">Grant Option?</th><th class=\"data\">Grantor</th></tr>\n";
-
- // Loop over privileges, outputting them
- $i = 0;
- foreach ($privileges as $v) {
- $id = (($i % 2) == 0 ? '1' : '2');
- echo "<tr>\n";
- echo "<td class=\"data{$id}\">", htmlspecialchars($v[0]), "</td>\n";
- echo "<td class=\"data{$id}\">", htmlspecialchars($v[1]), "</td>\n";
+ if (sizeof($privileges) > 0) {
+ echo "<table>\n";
+ echo "<tr><th class=\"data\">{$strType}</th><th class=\"data\">{$strUser}/{$strGroup}</th>";
foreach ($data->privlist[$_REQUEST['type']] as $v2) {
- if (in_array($v2, $v[2]))
- echo "<td class=\"data{$id}\">$strYes</td>\n";
- else
- echo "<td class=\"data{$id}\">$strNo</td>\n";
+ // Skip over ALL PRIVILEGES
+ if ($v2 == 'ALL PRIVILEGES') continue;
+ echo "<th class=\"data\">{$v2}</th>\n";
+ }
+ if ($data->hasGrantOption()) {
+ echo "<th class=\"data\">Grant Option?</th><th class=\"data\">Grantor</th>";
}
- echo "<td class=\"data{$id}\">", ($v[3]) ? $strYes : $strNo, "</td>\n";
- echo "<td class=\"data{$id}\">", htmlspecialchars($v[4]), "</td>\n";
echo "</tr>\n";
- $i++;
+
+ // Loop over privileges, outputting them
+ $i = 0;
+ foreach ($privileges as $v) {
+ $id = (($i % 2) == 0 ? '1' : '2');
+ echo "<tr>\n";
+ echo "<td class=\"data{$id}\">", htmlspecialchars($v[0]), "</td>\n";
+ echo "<td class=\"data{$id}\">", htmlspecialchars($v[1]), "</td>\n";
+ foreach ($data->privlist[$_REQUEST['type']] as $v2) {
+ // Skip over ALL PRIVILEGES
+ if ($v2 == 'ALL PRIVILEGES') continue;
+ if (in_array($v2, $v[2]))
+ echo "<td class=\"data{$id}\">$strYes</td>\n";
+ else
+ echo "<td class=\"data{$id}\">$strNo</td>\n";
+ }
+ if ($data->hasGrantOption()) {
+ echo "<td class=\"data{$id}\">", ($v[3]) ? $strYes : $strNo, "</td>\n";
+ echo "<td class=\"data{$id}\">", htmlspecialchars($v[4]), "</td>\n";
+ }
+ echo "</tr>\n";
+ $i++;
+ }
+
+ echo "</table>";
+ }
+ else {
+ echo "<p>{$strNoPrivileges}</p>\n";
}
- echo "</table>";
+ switch ($_REQUEST['type']) {
+ case 'view':
+ echo "<p><a class=\"navlink\" href=\"views.php?{$misc->href}\">{$strShowAllViews}</a></p>\n";
+ break;
+ case 'sequence':
+ echo "<p><a class=\"navlink\" href=\"sequences.php?{$misc->href}\">{$strShowAllSequences}</a></p>\n";
+ break;
+ case 'function':
+ echo "<p><a class=\"navlink\" href=\"functions.php?{$misc->href}\">$strShowAllFunctions</a></p>\n";
+ break;
+ case 'schema':
+ echo "<p><a class=\"navlink\" href=\"database.php?database=", htmlspecialchars($_REQUEST['database']),
+ "\">$strShowAllSchemas</a></p>\n";
+ break;
+ }
}
$misc->printHeader($strPrivileges);
/**
* FILENAME: sequence.php
*
- * $Id: sequences.php,v 1.2 2003/02/07 17:34:35 xzilla Exp $
+ * $Id: sequences.php,v 1.3 2003/02/09 10:22:38 chriskl Exp $
*/
include_once( 'libraries/lib.inc.php' );
echo "<td class=\"data{$id}\">";
echo "<a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&sequence=", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "\">$strDrop</td>\n";
echo "<td class=\"data{$id}\">";
- echo "<a href=\"privileges.php?action=priviledges&{$misc->href}&sequence=", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "\">$strPrivileges</td></tr>\n";
+ echo "<a href=\"privileges.php?{$misc->href}&object=", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]),
+ "&type=sequence\">$strPrivileges</td></tr>\n";
$sequences->movenext();
$i++;
/**
* Manage views in a database
*
- * $Id: views.php,v 1.2 2003/02/07 17:34:35 xzilla Exp $
+ * $Id: views.php,v 1.3 2003/02/09 10:22:38 chriskl Exp $
*/
// Include application functions
global $data, $localData, $misc;
global $PHP_SELF, $strView, $strOwner, $strActions, $strNoViews, $strViews;
global $strBrowse, $strProperties, $strDrop, $strCreateView, $strBack;
+ global $strPrivileges;
echo "<h2>", htmlspecialchars($_REQUEST['database']), ": {$strViews}</h2>\n";
$misc->printMsg($msg);
if ($views->recordCount() > 0) {
echo "<table>\n";
- echo "<tr><th class=data>{$strView}</th><th class=data>{$strOwner}</th><th colspan=4 class=data>{$strActions}</th>\n";
+ echo "<tr><th class=data>{$strView}</th><th class=data>{$strOwner}</th><th colspan=\"5\" class=data>{$strActions}</th>\n";
$i = 0;
while (!$views->EOF) {
// @@@@@@@@@ FIX THIS!!!!!
echo "<td class=opbutton{$id}><a href=\"display.php?{$misc->href}&query={$query}&count={$count}&return_url={$return_url}&return_desc={$strBack}\">{$strBrowse}</a></td>\n";
echo "<td class=opbutton{$id}>Select</td>\n";
echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=properties&{$misc->href}&view=", urlencode($views->f[$data->vwFields['vwname']]), "\">{$strProperties}</a></td>\n";
- echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&view=", urlencode($views->f[$data->vwFields['vwname']]), "\">{$strDrop}</a></td>\n";
+ echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&view=", urlencode($views->f[$data->vwFields['vwname']]), "\">{$strDrop}</a></td>\n";
+ echo "<td class=opbutton{$id}><a href=\"privileges.php?{$misc->href}&object=", urlencode($views->f[$data->vwFields['vwname']]),
+ "&type=view\">{$strPrivileges}</a></td>\n";
echo "</tr>\n";
$views->moveNext();
$i++;