diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-17 00:24:05 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2018-09-17 00:24:05 +0300 |
commit | f0a9628bccad7cbb0005669f39578b122849a573 (patch) | |
tree | ac9aa9adce0c42c74a755d4bf94bd044f3cc92a3 /plugins/UsersManager | |
parent | 4b5d0df3f707ba028be67865c59ac5560e029959 (diff) |
Limit of editing of anonymous user in UI. (#13416)
* Limit of editing of anonymous user in UI.
* Move some email styles to EmailStyles class.
* Show special warning when giving anonymous user view role.
* Make new text large.
* remove accidentally added files
Diffstat (limited to 'plugins/UsersManager')
4 files changed, 13 insertions, 4 deletions
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index 03c1c5ff1d..6f5c881001 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -281,5 +281,7 @@ class UsersManager extends \Piwik\Plugin $translationKeys[] = 'General_Warning'; $translationKeys[] = 'General_Add'; $translationKeys[] = 'UsersManager_AreYouSureChangePassword'; + $translationKeys[] = 'General_Note'; + $translationKeys[] = 'UsersManager_AnonymousUserRoleChangeWarning'; } } diff --git a/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.html b/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.html index 1b75f3ebc8..99f7bb99ed 100644 --- a/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.html +++ b/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.html @@ -154,7 +154,7 @@ piwik-field uicontrol="select" ng-model="user.role" - options="$ctrl.accessLevels" + options="user.login != 'anonymous' ? $ctrl.accessLevels : $ctrl.anonymousAccessLevels" ng-change="$ctrl.userToChange = user; $ctrl.roleToChangeTo = user.role; $ctrl.previousRole = '{{ user.role }}'; $ctrl.showAccessChangeConfirm();" disabled="user.role == 'superuser'" ></div> @@ -164,10 +164,10 @@ {{ user.last_seen ? (user.last_seen + ' ago') : '-' }} </td> <td class="center actions-cell"> - <button class="edituser table-action" title="Edit" ng-click="$ctrl.onEditUser({ user: user })"> + <button class="edituser table-action" title="Edit" ng-click="$ctrl.onEditUser({ user: user })" ng-if="user.login != 'anonymous'"> <span class="icon-edit"></span> </button> - <button class="deleteuser table-action" title="Delete" ng-click="$ctrl.userToChange = user; $ctrl.showDeleteConfirm()" ng-if="$ctrl.currentUserRole == 'superuser'"> + <button class="deleteuser table-action" title="Delete" ng-click="$ctrl.userToChange = user; $ctrl.showDeleteConfirm()" ng-if="$ctrl.currentUserRole == 'superuser' && user.login != 'anonymous'"> <span class="icon-delete"></span> </button> </td> @@ -191,6 +191,7 @@ <div class="change-user-role-confirm-modal modal"> <div class="modal-content"> <h3 ng-if="$ctrl.userToChange" piwik-translate="UsersManager_DeleteUserPermConfirmSingle"><strong>{{ $ctrl.userToChange.login }}</strong>::<strong>{{ $ctrl.getRoleDisplay($ctrl.roleToChangeTo) }}</strong>::<strong ng-bind-html="$ctrl.permissionsForSite.name"></strong></h3> + <h3 ng-if="$ctrl.userToChange && $ctrl.userToChange.login == 'anonymous' && $ctrl.roleToChangeTo == 'view'"><em>{{ 'General_Note'|translate }}: <span piwik-translate="UsersManager_AnonymousUserRoleChangeWarning">anonymous::{{ $ctrl.getRoleDisplay($ctrl.roleToChangeTo) }}</span></em></h3> <p ng-if="!$ctrl.userToChange" piwik-translate="UsersManager_DeleteUserPermConfirmMultiple"><strong>{{ $ctrl.getAffectedUsersCount() }}</strong>::<strong>{{ $ctrl.getRoleDisplay($ctrl.roleToChangeTo) }}</strong>::<strong ng-bind-html="$ctrl.permissionsForSite.name"></strong></p> </div> <div class="modal-footer"> diff --git a/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.js b/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.js index c7b0d4ee49..7647a669fc 100644 --- a/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.js +++ b/plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.js @@ -80,10 +80,15 @@ }; vm.bulkActionAccessLevels = []; + vm.anonymousAccessLevels = []; vm.accessLevels.forEach(function (entry) { if (entry.key !== 'noaccess' && entry.key !== 'superuser') { vm.bulkActionAccessLevels.push(entry); } + + if (entry.key === 'noaccess' || entry.key === 'view') { + vm.anonymousAccessLevels.push(entry); + } }); } diff --git a/plugins/UsersManager/lang/en.json b/plugins/UsersManager/lang/en.json index e212db2693..4a5af09f02 100644 --- a/plugins/UsersManager/lang/en.json +++ b/plugins/UsersManager/lang/en.json @@ -136,6 +136,7 @@ "DeleteUserConfirmMultiple": "Are you sure you want to delete the %1$s selected users?", "DeleteUserPermConfirmSingle": "Are you sure you want to change %1$s's role to %2$s for %3$s?", "DeleteUserPermConfirmMultiple": "Are you sure you want to change the %1$s selected users' role to %2$s for %3$s?", - "AreYouSureChangePassword": "Are you sure you want to change the password for %s?" + "AreYouSureChangePassword": "Are you sure you want to change the password for %s?", + "AnonymousUserRoleChangeWarning": "Giving the %1$s user the %2$s role will make this website's data public and available to everyone, even if they do not have a Matomo login." } } |