permission name tweaks

This commit is contained in:
Shish 2012-03-14 19:24:10 +00:00
parent cf7d1dded5
commit 6632521218
7 changed files with 27 additions and 20 deletions

View File

@ -82,7 +82,7 @@ class ReportImage extends Extension {
public function onDisplayingImage(DisplayingImageEvent $event) { public function onDisplayingImage(DisplayingImageEvent $event) {
global $config, $user, $page; global $config, $user, $page;
if($user->can('report_image')) { if($user->can('create_image_report')) {
$reps = $this->get_reporters($event->image); $reps = $this->get_reporters($event->image);
$this->theme->display_image_banner($event->image, $reps); $this->theme->display_image_banner($event->image, $reps);
} }

View File

@ -45,7 +45,7 @@ define("EXTRA_USER_CLASSES", serialize(array(
"moderator", # name for the new class "moderator", # name for the new class
"user", # class to base it on "user", # class to base it on
array( # parts of the base class to override array( # parts of the base class to override
"lock_image" => True, "edit_image_lock" => True,
"view_ip" => True, "view_ip" => True,
"ban_ip" => True, "ban_ip" => True,
"delete_image" => True, "delete_image" => True,

View File

@ -36,41 +36,48 @@ $_user_class_base = new UserClass("base", null, array(
"change_setting" => False, # modify web-level settings, eg the config table "change_setting" => False, # modify web-level settings, eg the config table
"override_config" => False, # modify sys-level settings, eg config.php "override_config" => False, # modify sys-level settings, eg config.php
"big_search" => False, # search for more than 3 tags at once (speed mode only) "big_search" => False, # search for more than 3 tags at once (speed mode only)
"manage_extension_list" => False,
"manage_alias_list" => False,
"mass_tag_edit" => False,
"view_ip" => False, # view IP addresses associated with things "view_ip" => False, # view IP addresses associated with things
"ban_ip" => False, "ban_ip" => False,
"edit_user_password" => False, "edit_user_password" => False,
"edit_user_info" => False, # email address, etc "edit_user_info" => False, # email address, etc
"delete_user" => False, "delete_user" => False,
"delete_image" => False,
"delete_comment" => False, "delete_comment" => False,
"replace_image" => False, "replace_image" => False,
"manage_extension_list" => False,
"manage_alias_list" => False,
"edit_image_tag" => False, "edit_image_tag" => False,
"edit_image_source" => False, "edit_image_source" => False,
"edit_image_owner" => False, "edit_image_owner" => False,
"lock_image" => False, "edit_image_lock" => False,
"mass_tag_edit" => False, "delete_image" => False,
"report_image" => False,
"create_image_report" => False,
"view_image_report" => False, # deal with reported images "view_image_report" => False, # deal with reported images
"protected" => False, # only admins can modify protected users (stops a moderator changing an admin's password) "protected" => False, # only admins can modify protected users (stops a moderator changing an admin's password)
)); ));
$_user_classes["anonymous"] = new UserClass("anonymous", $_user_class_base, array( $_user_classes["anonymous"] = new UserClass("anonymous", $_user_class_base, array(
"edit_image_tag" => "tag_edit_anon", "edit_image_tag" => "tag_edit_anon",
"edit_image_source" => "source_edit_anon", "edit_image_source" => "source_edit_anon",
"report_image" => "report_image_anon", "create_image_report" => "create_image_report_anon",
)); ));
$_user_classes["user"] = new UserClass("user", $_user_class_base, array( $_user_classes["user"] = new UserClass("user", $_user_class_base, array(
"big_search" => True, "big_search" => True,
"edit_image_tag" => True, "edit_image_tag" => True,
"edit_image_source" => True, "edit_image_source" => True,
"report_image" => True, "create_image_report" => True,
)); ));
$_user_classes["admin"] = new UserClass("admin", $_user_class_base, array( $_user_classes["admin"] = new UserClass("admin", $_user_class_base, array(
"change_setting" => True, "change_setting" => True,
"override_config" => True, "override_config" => True,
"big_search" => True, "big_search" => True,
"lock_image" => True, "edit_image_lock" => True,
"view_ip" => True, "view_ip" => True,
"ban_ip" => True, "ban_ip" => True,
"edit_user_password" => True, "edit_user_password" => True,
@ -85,7 +92,7 @@ $_user_classes["admin"] = new UserClass("admin", $_user_class_base, array(
"edit_image_source" => True, "edit_image_source" => True,
"edit_image_owner" => True, "edit_image_owner" => True,
"mass_tag_edit" => True, "mass_tag_edit" => True,
"report_image" => True, "create_image_report" => True,
"view_image_report" => True, "view_image_report" => True,
"protected" => True, "protected" => True,
)); ));

View File

@ -100,7 +100,7 @@ class TagEdit extends Extension {
if($this->can_source($event->image)) { if($this->can_source($event->image)) {
send_event(new SourceSetEvent($event->image, $_POST['tag_edit__source'])); send_event(new SourceSetEvent($event->image, $_POST['tag_edit__source']));
} }
if($user->can("lock_image")) { if($user->can("edit_image_lock")) {
$locked = isset($_POST['tag_edit__locked']) && $_POST['tag_edit__locked']=="on"; $locked = isset($_POST['tag_edit__locked']) && $_POST['tag_edit__locked']=="on";
send_event(new LockSetEvent($event->image, $locked)); send_event(new LockSetEvent($event->image, $locked));
} }
@ -108,28 +108,28 @@ class TagEdit extends Extension {
public function onOwnerSet(OwnerSetEvent $event) { public function onOwnerSet(OwnerSetEvent $event) {
global $user; global $user;
if($user->can("edit_image_owner") && (!$event->image->is_locked() || $user->can("lock_image"))) { if($user->can("edit_image_owner") && (!$event->image->is_locked() || $user->can("edit_image_lock"))) {
$event->image->set_owner($event->owner); $event->image->set_owner($event->owner);
} }
} }
public function onTagSet(TagSetEvent $event) { public function onTagSet(TagSetEvent $event) {
global $user; global $user;
if($user->can("edit_image_tag") && (!$event->image->is_locked() || $user->can("lock_image"))) { if($user->can("edit_image_tag") && (!$event->image->is_locked() || $user->can("edit_image_lock"))) {
$event->image->set_tags($event->tags); $event->image->set_tags($event->tags);
} }
} }
public function onSourceSet(SourceSetEvent $event) { public function onSourceSet(SourceSetEvent $event) {
global $user; global $user;
if($user->can("edit_image_source") && (!$event->image->is_locked() || $user->can("lock_image"))) { if($user->can("edit_image_source") && (!$event->image->is_locked() || $user->can("edit_image_lock"))) {
$event->image->set_source($event->source); $event->image->set_source($event->source);
} }
} }
public function onLockSet(LockSetEvent $event) { public function onLockSet(LockSetEvent $event) {
global $user; global $user;
if($user->can("lock_image")) { if($user->can("edit_image_lock")) {
$event->image->set_locked($event->locked); $event->image->set_locked($event->locked);
} }
} }

View File

@ -99,7 +99,7 @@ class TagEditTheme extends Themelet {
<tr> <tr>
<th>Locked</th> <th>Locked</th>
<td> <td>
".($user->can("lock_image") ? " ".($user->can("edit_image_lock") ? "
<span class='view'>$b_locked</span> <span class='view'>$b_locked</span>
<input class='edit' type='checkbox' name='tag_edit__locked'$h_locked> <input class='edit' type='checkbox' name='tag_edit__locked'$h_locked>
" : " " : "

View File

@ -341,7 +341,7 @@ class Upload extends Extension {
} }
// Checks if user is admin > check if you want locked. // Checks if user is admin > check if you want locked.
if($user->can("lock_image") && !empty($_GET['locked'])){ if($user->can("edit_image_lock") && !empty($_GET['locked'])){
$locked = bool_escape($_GET['locked']); $locked = bool_escape($_GET['locked']);
} }

View File

@ -73,7 +73,7 @@ class ViewImageTheme extends Themelet {
$html .= $part; $html .= $part;
} }
if( if(
(!$image->is_locked() || $user->can("lock_image")) && (!$image->is_locked() || $user->can("edit_image_lock")) &&
$user->can("edit_image_tag") $user->can("edit_image_tag")
) { ) {
$html .= " $html .= "