Rename and check "can see extra data" permission.

This commit is contained in:
Emanuel Schütze 2020-06-16 08:43:49 +02:00
parent bc1373b696
commit 68c77fe52c
8 changed files with 55 additions and 23 deletions

View File

@ -347,7 +347,7 @@ _('Can manage motion polls');
// users
_('Can see names of users');
_('Can see extra data of users (e.g. present and comment)');
_('Can see extra data of users (e.g. email and comment)');
_('Can manage users');
_('Can change its own password');

View File

@ -1,5 +1,5 @@
<h4>
<span>{{ 'Submitters' | translate }}</span>
<span class="title-font">{{ 'Submitters' | translate }}</span>
<button
class="small-button"
type="button"

View File

@ -250,8 +250,10 @@
<h4>{{ 'Name' | translate }}</h4>
<span class="state-icons">
<span>{{ user.short_name }}</span>
<mat-icon *ngIf="user.is_present" matTooltip="{{ 'Is present' | translate }}">check_box</mat-icon>
<mat-icon *ngIf="user.is_committee" matTooltip="{{ 'Is committee' | translate }}"
<mat-icon *ngIf="user.is_present && isAllowed('seeName')" matTooltip="{{ 'Is present' | translate }}"
>check_box</mat-icon
>
<mat-icon *ngIf="user.is_committee && isAllowed('seeName')" matTooltip="{{ 'Is committee' | translate }}"
>account_balance</mat-icon
>
<mat-icon *ngIf="!user.is_active && isAllowed('seeExtra')" matTooltip="{{ 'Inactive' | translate }}"
@ -260,18 +262,18 @@
</span>
</div>
<!-- Mail -->
<div *ngIf="isAllowed('seePersonal')">
<!-- Mail -->
<div *ngIf="user.email">
<h4>{{ 'Email' | translate }}</h4>
<span>{{ user.email }}</span>
</div>
</div>
<!-- Gender -->
<div *ngIf="user.gender">
<h4>{{ 'Gender' | translate }}</h4>
<span>{{ user.gender | translate }}</span>
</div>
<!-- Gender -->
<div *ngIf="user.gender">
<h4>{{ 'Gender' | translate }}</h4>
<span>{{ user.gender | translate }}</span>
</div>
<!-- Structure Level -->
@ -305,6 +307,12 @@
<span>{{ user.vote_weight }}</span>
</div>
<!-- Username -->
<div *ngIf="user.username">
<h4>{{ 'Username' | translate }}</h4>
<span>{{ user.username }}</span>
</div>
<!-- Initial Password -->
<div *ngIf="user.default_password">
<h4>{{ 'Initial password' | translate }}</h4>
@ -312,18 +320,12 @@
</div>
</div>
<div *ngIf="isAllowed('seePersonal')">
<div *ngIf="isAllowed('seeName')">
<!-- About me -->
<div *ngIf="user.about_me">
<h4>{{ 'About me' | translate }}</h4>
<div [innerHTML]="user.about_me | trust: 'html'"></div>
</div>
<!-- Username -->
<div *ngIf="user.username">
<h4>{{ 'Username' | translate }}</h4>
<span>{{ user.username }}</span>
</div>
</div>
<div *ngIf="isAllowed('seeExtra')">

View File

@ -193,10 +193,10 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit {
*
* actions might be:
* - delete (deleting the user) (users.can_manage and not ownPage)
* - seeName (title, first, last) (user.can_see_name or ownPage)
* - seeOtherUsers (title, first, last) (user.can_see_name)
* - seeExtra (checkboxes, comment) (user.can_see_extra_data)
* - seePersonal (mail, username, about, gender, structure level) (user.can_see_extra_data or ownPage)
* - seeName (title, first, last, gender, about) (user.can_see_name or ownPage)
* - seeOtherUsers (title, first, last, gender, about) (user.can_see_name)
* - seeExtra (email, comment, is_active, last_email_send) (user.can_see_extra_data)
* - seePersonal (mail, username, structure level) (user.can_see_extra_data or ownPage)
* - manage (everything) (user.can_manage)
* - changePersonal (mail, username, about) (user.can_manage or ownPage)
* - changePassword (user.can_change_password)

View File

@ -80,6 +80,7 @@ body {
h1,
h2,
h3,
h4,
.title-font,
.slidetitle h1,
.slidetitle h2 {

View File

@ -0,0 +1,29 @@
# Generated by Django 2.2.12 on 2020-06-15 19:59
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("users", "0013_user_vote_weight"),
]
operations = [
migrations.AlterModelOptions(
name="user",
options={
"default_permissions": (),
"ordering": ("last_name", "first_name", "username"),
"permissions": (
("can_see_name", "Can see names of users"),
(
"can_see_extra_data",
"Can see extra data of users (e.g. email and comment)",
),
("can_change_password", "Can change its own password"),
("can_manage", "Can manage users"),
),
},
),
]

View File

@ -172,7 +172,7 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser):
("can_see_name", "Can see names of users"),
(
"can_see_extra_data",
"Can see extra data of users (e.g. present and comment)",
"Can see extra data of users (e.g. email and comment)",
),
("can_change_password", "Can change its own password"),
("can_manage", "Can manage users"),

View File

@ -26,11 +26,11 @@ USERCANSEESERIALIZER_FIELDS = (
"is_present",
"is_committee",
"vote_weight",
"gender",
)
USERCANSEEEXTRASERIALIZER_FIELDS = USERCANSEESERIALIZER_FIELDS + (
"gender",
"email",
"last_email_send",
"comment",