Merge pull request #5423 from emanuelschuetze/rename-permission

Rename and check "can see extra data" permission.
This commit is contained in:
Emanuel Schütze 2020-06-16 21:15:56 +02:00 committed by GitHub
commit d53e85b853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 23 deletions

View File

@ -347,7 +347,7 @@ _('Can manage motion polls');
// users // users
_('Can see names of 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 manage users');
_('Can change its own password'); _('Can change its own password');

View File

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

View File

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

View File

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

View File

@ -80,6 +80,7 @@ body {
h1, h1,
h2, h2,
h3, h3,
h4,
.title-font, .title-font,
.slidetitle h1, .slidetitle h1,
.slidetitle h2 { .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_name", "Can see names of users"),
( (
"can_see_extra_data", "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_change_password", "Can change its own password"),
("can_manage", "Can manage users"), ("can_manage", "Can manage users"),

View File

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