aboutsummaryrefslogtreecommitdiff
path: root/app/views/user
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2020-01-06 20:28:04 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-01-06 20:28:04 +0100
commit3c099c78537020eae3b6fe060fbe86088e996c83 (patch)
tree647ee7313f609577f98b8477e814f2e7743c06f7 /app/views/user
parentd455783a63e77c3abce76b85f68c51338c1b81d1 (diff)
Add an admin flag on users (#2709)
Now FRSS supports more than one admin. Admins have the same rights as the default user. Admins can promote or demote other users. The default user is considered as an admin even if it does not have the admin flag enabled. See #2096
Diffstat (limited to 'app/views/user')
-rw-r--r--app/views/user/details.phtml9
-rw-r--r--app/views/user/manage.phtml11
2 files changed, 19 insertions, 1 deletions
diff --git a/app/views/user/details.phtml b/app/views/user/details.phtml
index 7a4687184..e23e645ae 100644
--- a/app/views/user/details.phtml
+++ b/app/views/user/details.phtml
@@ -1,9 +1,11 @@
<?php $this->partial('aside_configure'); ?>
+<?php $isAdmin = $this->details['is_admin']; ?>
+
<div class="post">
<a href="<?= _url('user', 'manage'); ?>"><?= _t('admin.user.back_to_manage'); ?></a>
- <legend><?= $this->username; ?></legend>
+ <legend><?= $this->username ?><?php if ($isAdmin) echo ' ― ', _t('admin.user.admin'); ?></legend>
<form method="post" action="<?= _url('user', 'manage', 'username', $this->username); ?>">
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken(); ?>" />
@@ -59,6 +61,11 @@
<button type="submit" class="btn btn-important" name="action" value="update"><?= _t('gen.action.update') ?></button>
<button type="submit" class="btn btn-attention confirm" name="action" value="purge"><?= _t('gen.action.purge') ?></button>
<button type="submit" class="btn btn-attention confirm" name="action" value="delete"><?= _t('gen.action.remove') ?></button>
+ <?php if ($isAdmin && !$this->isDefaultUser): ?>
+ <button type="submit" class="btn btn-attention confirm" name="action" value="demote"><?= _t('gen.action.demote') ?></button>
+ <?php elseif (!$isAdmin): ?>
+ <button type="submit" class="btn btn-attention confirm" name="action" value="promote"><?= _t('gen.action.promote') ?></button>
+ <?php endif; ?>
<div>
</div>
</form>
diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml
index 951544248..6ab31e6c6 100644
--- a/app/views/user/manage.phtml
+++ b/app/views/user/manage.phtml
@@ -26,6 +26,15 @@
</div>
</div>
+ <div class="form-group">
+ <div class="group-controls">
+ <label for="new_user_is_admin" class="checkbox">
+ <input type="checkbox" name="new_user_is_admin" id="new_user_is_admin">
+ <?= _t('admin.user.is_admin') ?>
+ </label>
+ </div>
+ </div>
+
<?php if ($this->show_email_field) { ?>
<div class="form-group">
<label class="group-name" for="new_user_email">
@@ -62,6 +71,7 @@
<thead>
<tr>
<th><?= _t('admin.user.username') ?></th>
+ <th><?= _t('admin.user.is_admin') ?></th>
<th><?= _t('admin.user.email') ?></th>
<th><?= _t('admin.user.language') ?></th>
<th><?= _t('admin.user.feed_count') ?></th>
@@ -74,6 +84,7 @@
<?php foreach ($this->users as $username => $values) : ?>
<tr>
<td><?= $username ?></td>
+ <td><?= $values['is_admin'] ? '✔' : ' ' ?></td>
<td><?= $values['mail_login'] ?></td>
<td><?= _t("gen.lang.{$values['language']}") ?></td>
<td><?= format_number($values['feed_count']) ?></td>