Vertical privileges
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@364 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
1d877586eb
commit
b76fd38c16
43
user.inc.php
43
user.inc.php
|
@ -141,50 +141,43 @@ if ($_POST) {
|
||||||
<tr><th><?php echo lang('Password'); ?></th><td><input name="pass" value="<?php echo htmlspecialchars($row["pass"]); ?>" /> <label for="hashed"><input type="checkbox" name="hashed" id="hashed" value="1"<?php if ($row["hashed"]) { ?> checked="checked"<?php } ?> /><?php echo lang('Hashed'); ?></label></td></tr>
|
<tr><th><?php echo lang('Password'); ?></th><td><input name="pass" value="<?php echo htmlspecialchars($row["pass"]); ?>" /> <label for="hashed"><input type="checkbox" name="hashed" id="hashed" value="1"<?php if ($row["hashed"]) { ?> checked="checked"<?php } ?> /><?php echo lang('Hashed'); ?></label></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><?php echo lang('Privileges'); ?></h3>
|
|
||||||
<?php
|
<?php
|
||||||
//! MAX_* limits, REQUIRE
|
//! MAX_* limits, REQUIRE
|
||||||
|
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
||||||
|
echo "<thead><tr><th colspan='2'>" . lang('Privileges') . "</th>";
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
foreach ($grants as $object => $grant) {
|
||||||
|
echo '<th>' . ($object != "*.*" ? '<input name="objects[' . $i . ']" value="' . htmlspecialchars($object) . '" size="10" />' : '<input type="hidden" name="objects[' . $i . ']" value="*.*" size="10" />*.*') . '</th>'; //! separate db, table, columns, PROCEDURE|FUNCTION, routine
|
||||||
|
//! JS checkbox for all
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
echo "</tr></thead>\n";
|
||||||
foreach (array(
|
foreach (array(
|
||||||
"Server Admin" => lang('Server'),
|
"Server Admin" => lang('Server'),
|
||||||
"Databases" => lang('Database'),
|
"Databases" => lang('Database'),
|
||||||
"Tables" => lang('Table'),
|
"Tables" => lang('Table'),
|
||||||
"Columns" => lang('Column'),
|
"Columns" => lang('Column'),
|
||||||
"Procedures" => lang('Routine'),
|
"Procedures" => lang('Routine'),
|
||||||
) as $key => $val) {
|
) as $context => $desc) {
|
||||||
if ($privileges[$key]) {
|
foreach ((array) $privileges[$context] as $privilege => $comment) {
|
||||||
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
echo '<tr><td>' . $desc . '</td><td title="' . htmlspecialchars($comment) . '"><i>' . htmlspecialchars($privilege) . '</i></td>';
|
||||||
echo "<thead><tr>";
|
$i = 0;
|
||||||
echo "<th>$val</th>";
|
|
||||||
foreach ($privileges[$key] as $privilege => $comment) {
|
|
||||||
echo '<td title="' . htmlspecialchars($comment) . '" lang="en">' . htmlspecialchars($privilege) . '</td>';
|
|
||||||
}
|
|
||||||
echo "</tr></thead>\n";
|
|
||||||
foreach ($grants as $object => $grant) {
|
foreach ($grants as $object => $grant) {
|
||||||
if ($key == "Server Admin" ? $object == (isset($grants["*.*"]) ? "*.*" : "")
|
|
||||||
: !$object || (substr($object, -1) == ")" || $key == "Columns" ? substr($object, -1) == ")" xor $key != "Columns"
|
|
||||||
: (preg_match('~(PROCEDURE|FUNCTION) ~', $object) ? $key == "Procedures"
|
|
||||||
: (substr($object, -1) == "*" || $key == "Tables"
|
|
||||||
)))) {
|
|
||||||
echo "<tr align='center'>";
|
|
||||||
echo '<th>' . ($key != "Server Admin" ? '<input name="objects[' . $i . ']" value="' . htmlspecialchars($object) . '" size="10" />' : '<input type="hidden" name="objects[' . $i . ']" value="*.*" size="10" />*.*') . '</th>'; //! separate db, table, columns, PROCEDURE|FUNCTION, routine
|
|
||||||
//! JS checkbox for all
|
|
||||||
foreach ($privileges[$key] as $privilege => $comment) {
|
|
||||||
$name = '"grants[' . $i . '][' . htmlspecialchars(strtoupper($privilege)) . ']"';
|
$name = '"grants[' . $i . '][' . htmlspecialchars(strtoupper($privilege)) . ']"';
|
||||||
$value = $grant[strtoupper($privilege)];
|
$value = $grant[strtoupper($privilege)];
|
||||||
if (isset($_GET["grant"])) {
|
if ($context == "Server Admin" && $object != (isset($grants["*.*"]) ? "*.*" : "")) {
|
||||||
|
echo "<td> </td>";
|
||||||
|
} elseif (isset($_GET["grant"])) {
|
||||||
echo "<td><select name=$name><option></option><option value='1'" . ($value ? " selected='selected'" : "") . ">" . lang('Grant') . "</option><option value='0'" . ($value == "0" ? " selected='selected'" : "") . ">" . lang('Revoke') . "</option></select></td>";
|
echo "<td><select name=$name><option></option><option value='1'" . ($value ? " selected='selected'" : "") . ">" . lang('Grant') . "</option><option value='0'" . ($value == "0" ? " selected='selected'" : "") . ">" . lang('Revoke') . "</option></select></td>";
|
||||||
} else {
|
} else {
|
||||||
echo "<td><input type='checkbox' name=$name value='1'" . ($value ? " checked='checked'" : "") . " /></td>";
|
echo "<td align='center'><input type='checkbox' name=$name value='1'" . ($value ? " checked='checked'" : "") . " /></td>";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
echo "</tr>\n";
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
echo "</tr>\n";
|
||||||
echo "</table>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo "</table>\n";
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
||||||
|
|
Loading…
Reference in a new issue