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) {
global $config, $user, $page;
if($user->can('report_image')) {
if($user->can('create_image_report')) {
$reps = $this->get_reporters($event->image);
$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
"user", # class to base it on
array( # parts of the base class to override
"lock_image" => True,
"edit_image_lock" => True,
"view_ip" => True,
"ban_ip" => 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
"override_config" => False, # modify sys-level settings, eg config.php
"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
"ban_ip" => False,
"edit_user_password" => False,
"edit_user_info" => False, # email address, etc
"delete_user" => False,
"delete_image" => False,
"delete_comment" => False,
"replace_image" => False,
"manage_extension_list" => False,
"manage_alias_list" => False,
"edit_image_tag" => False,
"edit_image_source" => False,
"edit_image_owner" => False,
"lock_image" => False,
"mass_tag_edit" => False,
"report_image" => False,
"edit_image_lock" => False,
"delete_image" => False,
"create_image_report" => False,
"view_image_report" => False, # deal with reported images
"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(
"edit_image_tag" => "tag_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(
"big_search" => True,
"edit_image_tag" => True,
"edit_image_source" => True,
"report_image" => True,
"create_image_report" => True,
));
$_user_classes["admin"] = new UserClass("admin", $_user_class_base, array(
"change_setting" => True,
"override_config" => True,
"big_search" => True,
"lock_image" => True,
"edit_image_lock" => True,
"view_ip" => True,
"ban_ip" => 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_owner" => True,
"mass_tag_edit" => True,
"report_image" => True,
"create_image_report" => True,
"view_image_report" => True,
"protected" => True,
));

View file

@ -100,7 +100,7 @@ class TagEdit extends Extension {
if($this->can_source($event->image)) {
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";
send_event(new LockSetEvent($event->image, $locked));
}
@ -108,28 +108,28 @@ class TagEdit extends Extension {
public function onOwnerSet(OwnerSetEvent $event) {
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);
}
}
public function onTagSet(TagSetEvent $event) {
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);
}
}
public function onSourceSet(SourceSetEvent $event) {
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);
}
}
public function onLockSet(LockSetEvent $event) {
global $user;
if($user->can("lock_image")) {
if($user->can("edit_image_lock")) {
$event->image->set_locked($event->locked);
}
}

View file

@ -99,7 +99,7 @@ class TagEditTheme extends Themelet {
<tr>
<th>Locked</th>
<td>
".($user->can("lock_image") ? "
".($user->can("edit_image_lock") ? "
<span class='view'>$b_locked</span>
<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.
if($user->can("lock_image") && !empty($_GET['locked'])){
if($user->can("edit_image_lock") && !empty($_GET['locked'])){
$locked = bool_escape($_GET['locked']);
}

View file

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