This commit is contained in:
Marcin Kurczewski 2013-10-25 17:25:05 +02:00
parent db180376d4
commit 0712f15ee4
4 changed files with 15 additions and 10 deletions

View file

@ -81,6 +81,8 @@ changeUserEmail.own=registered
changeUserEmail.all=admin changeUserEmail.all=admin
changeUserAccessRank=admin changeUserAccessRank=admin
changeUserName=moderator changeUserName=moderator
changeUserSettings.all=nobody
changeUserSettings.own=registered
acceptUserRegistration=moderator acceptUserRegistration=moderator
banUser.own=nobody banUser.own=nobody
banUser.all=admin banUser.all=admin

View file

@ -226,6 +226,7 @@ class UserController
{ {
$user = Model_User::locate($name); $user = Model_User::locate($name);
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user)); PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
PrivilegesHelper::confirmWithException(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($user));
$this->context->handleExceptions = true; $this->context->handleExceptions = true;
$this->context->transport->user = $user; $this->context->transport->user = $user;
@ -444,8 +445,7 @@ class UserController
*/ */
public function toggleSafetyAction($safety) public function toggleSafetyAction($safety)
{ {
if (!$this->context->loggedIn) PrivilegesHelper::confirmWithException(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->user));
throw new SimpleException('Not logged in');
if (!in_array($safety, PostSafety::getAll())) if (!in_array($safety, PostSafety::getAll()))
throw new SimpleExcetpion('Invalid safety'); throw new SimpleExcetpion('Invalid safety');

View file

@ -23,6 +23,7 @@ class Privilege extends Enum
const ChangeUserAccessRank = 16; const ChangeUserAccessRank = 16;
const ChangeUserEmail = 17; const ChangeUserEmail = 17;
const ChangeUserName = 18; const ChangeUserName = 18;
const ChangeUserSettings = 28;
const DeleteUser = 19; const DeleteUser = 19;
const ListComments = 20; const ListComments = 20;

View file

@ -121,15 +121,17 @@
</a> </a>
</li> </li>
<?php if ($this->context->transport->tab == 'settings'): ?> <?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<li class="selected settings"> <?php if ($this->context->transport->tab == 'settings'): ?>
<?php else: ?> <li class="selected settings">
<li class="settings"> <?php else: ?>
<li class="settings">
<?php endif ?>
<a href="<?php echo \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>">
Browsing settings
</a>
</li>
<?php endif ?> <?php endif ?>
<a href="<?php echo \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>">
Browsing settings
</a>
</li>
<?php if ($canModifyAnything): ?> <?php if ($canModifyAnything): ?>
<?php if ($this->context->transport->tab == 'edit'): ?> <?php if ($this->context->transport->tab == 'edit'): ?>