more perms

This commit is contained in:
Shish 2012-03-31 12:33:55 +01:00
parent 7ef52c853f
commit 4856af9c49
4 changed files with 4 additions and 86 deletions

View file

@ -35,7 +35,7 @@ class Tag_History extends Extension {
}
}
else if($event->page_matches("tag_history/bulk_revert")) {
if($user->is_admin() && $user->check_auth_token()) {
if($user->can("bulk_edit_image_tag") && $user->check_auth_token()) {
$this->process_bulk_revert_request();
}
}
@ -78,7 +78,7 @@ class Tag_History extends Extension {
public function onUserBlockBuilding(UserBlockBuildingEvent $event) {
global $user;
if($user->is_admin()) {
if($user->can("bulk_edit_image_tag")) {
$event->add_link("Tag Changes", make_link("tag_history/all/1"));
}
}

View file

@ -63,6 +63,7 @@ new UserClass("base", null, array(
"edit_image_source" => False,
"edit_image_owner" => False,
"edit_image_lock" => False,
"bulk_edit_image_tag" => False,
"delete_image" => False,
"ban_image" => False,
@ -121,6 +122,7 @@ new UserClass("admin", "base", array(
"edit_image_tag" => True,
"edit_image_source" => True,
"edit_image_owner" => True,
"bulk_edit_image_tag" => True,
"mass_tag_edit" => True,
"create_image_report" => True,
"view_image_report" => True,

View file

@ -98,47 +98,5 @@ class CustomUserPageTheme extends UserPageTheme {
$page->disable_left();
parent::display_user_page($duser, $stats);
}
protected function build_options($duser) {
global $database;
global $config;
global $user;
$html = "";
$html .= "
<form action='".make_link("user_admin/change_pass")."' method='POST'>
<input type='hidden' name='name' value='{$duser->name}'>
<input type='hidden' name='id' value='{$duser->id}'>
<table style='width: 300px;'>
<tr><td colspan='2'>Change Password</td></tr>
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
<tr><td colspan='2'><input type='Submit' value='Change Password'></td></tr>
</table>
</form>
<p><form action='".make_link("user_admin/change_email")."' method='POST'>
<input type='hidden' name='id' value='{$duser->id}'>
<table style='width: 300px;'>
<tr><th colspan='2'>Change Email</th></tr>
<tr><td>Address</td><td><input type='text' name='address' value='".html_escape($duser->email)."'></td></tr>
<tr><td colspan='2'><input type='Submit' value='Set'></td></tr>
</table>
</form></p>
";
if($user->is_admin()) {
$i_user_id = int_escape($duser->id);
$h_is_admin = $duser->is_admin() ? " checked" : "";
$html .= "
<p>".make_form(make_link("user_admin/set_more"))."
<input type='hidden' name='id' value='$i_user_id'>
Admin: <input name='admin' type='checkbox'$h_is_admin>
<input type='submit' value='Set'>
</form>
";
}
return $html;
}
}
?>

View file

@ -95,47 +95,5 @@ class CustomUserPageTheme extends UserPageTheme {
$page->disable_left();
parent::display_user_page($duser, $stats);
}
protected function build_options($duser) {
global $database;
global $config;
global $user;
$html = "";
$html .= "
<form action='".make_link("user_admin/change_pass")."' method='POST'>
<input type='hidden' name='name' value='{$duser->name}'>
<input type='hidden' name='id' value='{$duser->id}'>
<table style='width: 300px;'>
<tr><th colspan='2'>Change Password</th></tr>
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
<tr><td colspan='2'><input type='Submit' value='Change Password'></td></tr>
</table>
</form>
<p><form action='".make_link("user_admin/change_email")."' method='POST'>
<input type='hidden' name='id' value='{$duser->id}'>
<table style='width: 300px;'>
<tr><th colspan='2'>Change Email</th></tr>
<tr><td>Address</td><td><input type='text' name='address' value='".html_escape($duser->email)."'></td></tr>
<tr><td colspan='2'><input type='Submit' value='Set'></td></tr>
</table>
</form></p>
";
if($user->is_admin()) {
$i_user_id = int_escape($duser->id);
$h_is_admin = $duser->is_admin() ? " checked" : "";
$html .= "
<p>".make_form(make_link("user_admin/set_more"))."
<input type='hidden' name='id' value='$i_user_id'>
Admin: <input name='admin' type='checkbox'$h_is_admin>
<input type='submit' value='Set'>
</form>
";
}
return $html;
}
}
?>