diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-02-11 00:25:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 00:25:52 +0300 |
commit | f82326bcad877763b0151df6ccb23a9deaf34494 (patch) | |
tree | 2ef18d0c6c92eff81502798b3365ee110df0b7e8 /plugins/UsersManager | |
parent | a36b45a3764cd28303d2ce27c600c7d6f5a5ed20 (diff) |
[Vue] migrate user edit form directive to Vue component (#18576)
* force a digest after a location change
* use proper abortcontroller method instead of promise hack, have to add new polyfill + try to fix random test failure
* some UI test fixes
* fix some report export issues
* several save button fixes + make replace approximation in createAngularJsAdapter better
* fix sparkline
* apply after manual click triggering in savebutton
* css fixes and piwik-content-table was never applied by angularjs in installtion
* rebuild vue
* add names to divs so they can still be queried as they were in angularjs
* rebuild vue
* rebuild vue
* now that format_metrics checkbox works, need to check it
* small delay before processing first popover
* fix dropdown class/directive name
* fix overlay test
* remove unintended changes
* remove unintended changes
* migrate archiving controller
* do not do a passthrough transpile of vue typescript, and fix many typescript errors in existing code
* more typescript fixes
* even more fixes
* workarounds to fix recursive typing issues
* get corehome to build w/ full typescript build and output type definitions to local dir
* get outputted typings to be used when compiling other plugins and fix typescript issues in CorePluginsAdmin
* readd corehome umd
* fix typescript errors in ExampleVue plugin
* fix feedback typescript errors
* rebuild
* migrate branding controller and get to build
* fix issues and get to work
* rebuild
* fix notification scroll
* migrate smtp settings controller in coreadminhome
* get to work
* migrate js tracking code generator and get to build
* migrate image tracking code generator and get to build
* get to work in UI
* get UI tests to pass locally
* forgot to add files + rebuild vue
* update screenshots
* Show a summary of new features (#18065)
* Added "What is new" notification display, populated by a new event
* Removed test example event hook
* Added support for applying a link attribute to menu items, fixes layout issue for mobile with html menu items
* Updated UI test screenshots
* Revert accidental edit
* Hide the "What's new" icon if there are no new features to show
* Changed to use changes.json, track user last viewed, added ui test
* Fix UserManager unit tests broken by new ts_changes_viewed user field
* Moved getChanges to separate helper class, added unit test, added user view access check
* Updated to add new changes table and populate only on plugin update/install
* Added missing fixture class, updated UI screenshots
* Updated matomo font to add ringing bell and new releases icons
* Fix for integration test
* Reworked class structure, removed unnecessary angular directive, merged templates, other tidy ups
* built vue files
* built vue files
* Added null user check, missing table exception handling, show plugin name in change title, better handling of missing change fields
* Added sample changes file, moved UserChanges db code to changes model, added return type hints, better db error code handling, various other improvements
* Revert accidental UI screenshot commit
* Fix for incorrect link name parameter in sample changes, switched back to using $db->query for INSERT IGNORE
* Integration test fix, UI screenshot updates
* Test fix
* Added link styling, show CoreHome changes without plugin prefix in title
* Update UI test screenshot
* Added styles to the popover, added event for filtering changes
* Test fix
* UI test screenshot updates
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
* Update test translation (#18531)
update a test failed XML
* updates all submodules (#18541)
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
* Translations update from Hosted Weblate (#18529)
* Translated using Weblate (Greek)
Currently translated at 100.0% (162 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/el/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
* Translated using Weblate (Chinese (Simplified))
Currently translated at 83.9% (136 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/zh_Hans/
[ci skip]
Translated using Weblate (Chinese (Simplified))
Currently translated at 99.6% (620 of 622 strings)
Translation: Matomo/Matomo Base
Translate-URL: https://hosted.weblate.org/projects/matomo/matomo-base/zh_Hans/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* Update translation files
Updated by "Squash Git commits" hook in Weblate.
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/
[ci skip]
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* [Vue] migrate report export directive and popover (#18440)
* update files
* sidenav start
* make getRef a utility method
* tweak
* add return type
* finish converting side-nav directive
* starting on reporting menu conversion
* remove unused properties
* convert reporting pages service
* migrate report metadata store
* remove angularjs files
* migrating reporting pages store
* make store adapters more immutable
* get service adapters to work
* fix a UI test
* another html fix
* migrate most of reporting menu directive and model
* Use themed font family for input forms to override materialize.css styling
* rebuild vue
* add a missing div
* ui test fixes
* update styling
* get to build
* get to load in the UI w/o error
* clone result of functions
* fix compile issue
* migrate widget loader and get to load in UI
* rebuild vue
* migrate widgetcontainer
* migrate widget bydimension container
* migrate widget + add tooltips directive
* quick fix
* Updating version to 4.6.0
* loading in page
* update expected screenshot
* add wait just in case travis is slow
* fix ordering bug
* add another wait
* rebuild vue
* css tweak
* fix some bugs and tests
* undo screenshot changes
* Menus test passing locally
* [Vue] date picker viewDate property is not kept up to date (#18385)
* viewDate ref is not kept up to date
* rebuild corehome
* reporting menu subcategory items are meant to be normal links
* update some screenshots
* use innerText instead of text() since angularjs maintains newlines in HTML that vue does not add
* trigger angularjs digest after ajaxhelper request
* rebuild vue
* update screenshots, fix bug in link generation in reporting menu and allow syncing multiple screenshot regexes at a time
* undo box-shadow change for UI tests
* fix more issues & update more tests
* update some screenshots
* fix some tests
* rebuild CoreHome
* quick fix
* built vue files
* fix angularjs issue
* add comment
* update umd files
* 4.6.1-rc1
* 4.6.1
* fix field array title
* apply some pr feedback
* apply more pr feedback
* another fix
* tweak
* fix ng-change not executed before ng-model
* fix another set of issues
* fix another issue
* rebuild vue
* better ng-change/ng-model fix
* update some screenshots
* rebuild vue
* remove some TODOs
* initiate initial ng-change ONLY for site selectors where this behavior applies
* emit/broadcast on correct scope in wrapper
* rebuild vue
* fix some issues
* couple more fixes
* fix another title issue
* rebuild vue
* do not report on ajax errors in notifications if not logged in
* migrate reporting page and model
* rebuild vue
* create sites selector model adapter
* fix siteselector vue bug, initial site is only set if there is just one site available
* rebuild vue
* migrate plugin settings directive
* remove TODO
* migrate plugin filter directive
* migrate two more plugins directives
* migrate save button
* fix a bunch of bugs
* fix another widget bug
* allow change event name between angularjs and vue
* rebuild vue
* migrate plugin form directive
* get to work
* migrate select-on-focus directive and start migrating report-export directive
* finish migrating report export directive & popover component + create reusable function to create vue app and add globals to it
* rebuild vue
* remove angularjs files and move less contents to vue dir
* built vue files
* fix function signature
* fix vue warning
* fix ajax request race condition
* rebuild vue
* add new notification type "help" so the help notification is not cleared when clearing transient notifications
* fix some bugs and tests
* update screenshot
* update screenshot & fix a test
* allow using unminified jquery ui + fix bug in last fix
* fix error when enrichedheadline is used in modal
* add polyfill min.js
* remove two todos
* fix widget url logic
* update some screenshots and fix sanitization/escape issue
* update screenshots
* rebuild vue
* fix url location updating regression in MatomoUrl.updateLocation use
* submodule
* update screenshots and fix possible error in json parse
* built vue files
* Merge branch 'vue-period-selector-regression' into vue-reporting-menu
* rebuild vue
* use correct variable
* rebuild vue
* fix widget url logic
* segment parameter can be undefined now for some reason
* fix ngmodel binding in siteselector adapter (for last time hopefully)
* the original site selector only set the first site to the first site in the initial sites query if there was only one site in the entire matomo instance
* fix sitesmanager ui test failure
* fix usersettings test failure
* rebuild vue
* more siteselector tweaks.
* build CoreHome
* more siteselector tweaks.
* another siteselector issue
* update screenshots
* update screenshot and try to fix random failure
* fix some issues in widget.vue when containerid is specified
* fix couple tests
* fix several test failures
* fix string concat
* fix test failure
* extra change
* fix last change and random failure
* styling fix
* fix last fix
* real fix this time
* fix stray request
* proper fix
* update build files
* try to fix random failure
* do not submit form
* check for api errors in promise chain in ajaxhelper.ts
* force a digest after a location change
* use proper abortcontroller method instead of promise hack, have to add new polyfill + try to fix random test failure
* some UI test fixes
* fix some report export issues
* several save button fixes + make replace approximation in createAngularJsAdapter better
* apply after manual click triggering in savebutton
* add names to divs so they can still be queried as they were in angularjs
* rebuild vue
* now that format_metrics checkbox works, need to check it
* fix unintended changes
* updated expected screenshots
* update two more
* go back to previous format_metrics behavior in popover
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
* [Vue] remove support in vue for FormField.allSettings (#18542)
* deprecate support in vue for FormField.allSettings since deep watching the property doesnt quite work
* built vue files
* update screenshots
* update screenshot
* Show a summary of new features (#18065)
* Added "What is new" notification display, populated by a new event
* Removed test example event hook
* Added support for applying a link attribute to menu items, fixes layout issue for mobile with html menu items
* Updated UI test screenshots
* Revert accidental edit
* Hide the "What's new" icon if there are no new features to show
* Changed to use changes.json, track user last viewed, added ui test
* Fix UserManager unit tests broken by new ts_changes_viewed user field
* Moved getChanges to separate helper class, added unit test, added user view access check
* Updated to add new changes table and populate only on plugin update/install
* Added missing fixture class, updated UI screenshots
* Updated matomo font to add ringing bell and new releases icons
* Fix for integration test
* Reworked class structure, removed unnecessary angular directive, merged templates, other tidy ups
* built vue files
* built vue files
* Added null user check, missing table exception handling, show plugin name in change title, better handling of missing change fields
* Added sample changes file, moved UserChanges db code to changes model, added return type hints, better db error code handling, various other improvements
* Revert accidental UI screenshot commit
* Fix for incorrect link name parameter in sample changes, switched back to using $db->query for INSERT IGNORE
* Integration test fix, UI screenshot updates
* Test fix
* Added link styling, show CoreHome changes without plugin prefix in title
* Update UI test screenshot
* Added styles to the popover, added event for filtering changes
* Test fix
* UI test screenshot updates
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
* Update test translation (#18531)
update a test failed XML
* updates all submodules (#18541)
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
* Translations update from Hosted Weblate (#18529)
* Translated using Weblate (Greek)
Currently translated at 100.0% (162 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/el/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
* Translated using Weblate (Chinese (Simplified))
Currently translated at 83.9% (136 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/zh_Hans/
[ci skip]
Translated using Weblate (Chinese (Simplified))
Currently translated at 99.6% (620 of 622 strings)
Translation: Matomo/Matomo Base
Translate-URL: https://hosted.weblate.org/projects/matomo/matomo-base/zh_Hans/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* Update translation files
Updated by "Squash Git commits" hook in Weblate.
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/
[ci skip]
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* [Vue] migrate report export directive and popover (#18440)
* update files
* sidenav start
* make getRef a utility method
* tweak
* add return type
* finish converting side-nav directive
* starting on reporting menu conversion
* remove unused properties
* convert reporting pages service
* migrate report metadata store
* remove angularjs files
* migrating reporting pages store
* make store adapters more immutable
* get service adapters to work
* fix a UI test
* another html fix
* migrate most of reporting menu directive and model
* Use themed font family for input forms to override materialize.css styling
* rebuild vue
* add a missing div
* ui test fixes
* update styling
* get to build
* get to load in the UI w/o error
* clone result of functions
* fix compile issue
* migrate widget loader and get to load in UI
* rebuild vue
* migrate widgetcontainer
* migrate widget bydimension container
* migrate widget + add tooltips directive
* quick fix
* Updating version to 4.6.0
* loading in page
* update expected screenshot
* add wait just in case travis is slow
* fix ordering bug
* add another wait
* rebuild vue
* css tweak
* fix some bugs and tests
* undo screenshot changes
* Menus test passing locally
* [Vue] date picker viewDate property is not kept up to date (#18385)
* viewDate ref is not kept up to date
* rebuild corehome
* reporting menu subcategory items are meant to be normal links
* update some screenshots
* use innerText instead of text() since angularjs maintains newlines in HTML that vue does not add
* trigger angularjs digest after ajaxhelper request
* rebuild vue
* update screenshots, fix bug in link generation in reporting menu and allow syncing multiple screenshot regexes at a time
* undo box-shadow change for UI tests
* fix more issues & update more tests
* update some screenshots
* fix some tests
* rebuild CoreHome
* quick fix
* built vue files
* fix angularjs issue
* add comment
* update umd files
* 4.6.1-rc1
* 4.6.1
* fix field array title
* apply some pr feedback
* apply more pr feedback
* another fix
* tweak
* fix ng-change not executed before ng-model
* fix another set of issues
* fix another issue
* rebuild vue
* better ng-change/ng-model fix
* update some screenshots
* rebuild vue
* remove some TODOs
* initiate initial ng-change ONLY for site selectors where this behavior applies
* emit/broadcast on correct scope in wrapper
* rebuild vue
* fix some issues
* couple more fixes
* fix another title issue
* rebuild vue
* do not report on ajax errors in notifications if not logged in
* migrate reporting page and model
* rebuild vue
* create sites selector model adapter
* fix siteselector vue bug, initial site is only set if there is just one site available
* rebuild vue
* migrate plugin settings directive
* remove TODO
* migrate plugin filter directive
* migrate two more plugins directives
* migrate save button
* fix a bunch of bugs
* fix another widget bug
* allow change event name between angularjs and vue
* rebuild vue
* migrate plugin form directive
* get to work
* migrate select-on-focus directive and start migrating report-export directive
* finish migrating report export directive & popover component + create reusable function to create vue app and add globals to it
* rebuild vue
* remove angularjs files and move less contents to vue dir
* built vue files
* fix function signature
* fix vue warning
* fix ajax request race condition
* rebuild vue
* add new notification type "help" so the help notification is not cleared when clearing transient notifications
* fix some bugs and tests
* update screenshot
* update screenshot & fix a test
* allow using unminified jquery ui + fix bug in last fix
* fix error when enrichedheadline is used in modal
* add polyfill min.js
* remove two todos
* fix widget url logic
* update some screenshots and fix sanitization/escape issue
* update screenshots
* rebuild vue
* fix url location updating regression in MatomoUrl.updateLocation use
* submodule
* update screenshots and fix possible error in json parse
* built vue files
* Merge branch 'vue-period-selector-regression' into vue-reporting-menu
* rebuild vue
* use correct variable
* rebuild vue
* fix widget url logic
* segment parameter can be undefined now for some reason
* fix ngmodel binding in siteselector adapter (for last time hopefully)
* the original site selector only set the first site to the first site in the initial sites query if there was only one site in the entire matomo instance
* fix sitesmanager ui test failure
* fix usersettings test failure
* rebuild vue
* more siteselector tweaks.
* build CoreHome
* more siteselector tweaks.
* another siteselector issue
* update screenshots
* update screenshot and try to fix random failure
* fix some issues in widget.vue when containerid is specified
* fix couple tests
* fix several test failures
* fix string concat
* fix test failure
* extra change
* fix last change and random failure
* styling fix
* fix last fix
* real fix this time
* fix stray request
* proper fix
* update build files
* try to fix random failure
* do not submit form
* check for api errors in promise chain in ajaxhelper.ts
* force a digest after a location change
* use proper abortcontroller method instead of promise hack, have to add new polyfill + try to fix random test failure
* some UI test fixes
* fix some report export issues
* several save button fixes + make replace approximation in createAngularJsAdapter better
* apply after manual click triggering in savebutton
* add names to divs so they can still be queried as they were in angularjs
* rebuild vue
* now that format_metrics checkbox works, need to check it
* fix unintended changes
* updated expected screenshots
* update two more
* go back to previous format_metrics behavior in popover
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
* [Vue] remove support in vue for FormField.allSettings (#18542)
* deprecate support in vue for FormField.allSettings since deep watching the property doesnt quite work
* built vue files
* update screenshots
* update screenshot
* fix tests
* rebuild
* rebuild
* order plugins by dependencies in vue:build and fix warning in corehome build
* built vue files
* built vue files
* remove unused imports
* built vue files
* remove multilinefield component, fieldtextareaarray does the same thing
* edit-trigger is not used anywhere
* migrate sitetypes model to store
* do not load nonexistant files
* remove reference nonexistant files
* start converting sitefields component
* more work on sitefields component
* undo submodule change
* rebuild
* get sitesmanager to build
* get SiteFields component to work in UI
* datepicker does not format times
* export other stores
* fix some typing issues and rebuild
* start on site management conversion
* add more comma delimited props to list + remove controller JS
* rebuild
* convert sites manager controller to sitesmanagement component
* remove TODOs
* finish migrating sitesmanager
* remove some TODO
* get to build
* fixes from testing
* rebuild
* rebuild and fix issue w/ globalsettings hash detection
* migrate capabilities-edit component.
* some fixes and get to build
* get to work
* built vue files
* get to work and rebuild
* migrate user edit form component
* some fixes
* fixes
* another fix
* more fixes
* update file
* more fixes
* fix ref
* rebuild vue
* couple more fixes
* fix bug and rebuild
* fix bug and rebuild
* fix issue
* fix issues and rebuild
* fix ui test
* fix UI test failure
* fixing some issues
* complete fixes
* fix some more issues
* fix ui test failures
* another fix
* several more fixes
* fix delete dialog
* more fixes
* fix styling issue
* more fixes
* fix another ui test + update other UI tests
* fixing edisiteid handling
* update screenshots
* fix UI tests somre more
* fix random failure
* fixes
* reference css class not attribute (since that is what is added in vue)
* fixing more ui tests
* try to fix vue css class in directive issue
* tweak
* in groupedsetting handle templateFile property for angularjs BC
* rebuild vue
* fix view tracking code link
* fixing UI tests
* fix selector in test for this branch only
* Update screenshot.
* update screenshot
* update screenshots
* style fix
* fix selectors and update screenshot
* built vue files
* Update screenshot + fix title and spacing.
* fix password changing
* fixing tests
* fix styling
* built vue files
* more styling fixes
* disable inputs while confirm user password modal is displayed for autofill browser features/extensions
* update screenshots
* fix test
Co-authored-by: Ben Burgess <88810029+bx80@users.noreply.github.com>
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
Co-authored-by: Peter Zhang <peter@innocraft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
Diffstat (limited to 'plugins/UsersManager')
15 files changed, 1336 insertions, 455 deletions
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index b47b20f592..9f4d4857d4 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -130,7 +130,6 @@ class UsersManager extends \Piwik\Plugin { $jsFiles[] = "plugins/UsersManager/angularjs/users-manager/users-manager.component.js"; $jsFiles[] = "plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.js"; - $jsFiles[] = "plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js"; $jsFiles[] = "plugins/UsersManager/angularjs/personal-settings/personal-settings.controller.js"; $jsFiles[] = "plugins/UsersManager/angularjs/personal-settings/anonymous-settings.controller.js"; } @@ -144,7 +143,7 @@ class UsersManager extends \Piwik\Plugin $stylesheets[] = "plugins/UsersManager/angularjs/users-manager/users-manager.component.less"; $stylesheets[] = "plugins/UsersManager/angularjs/paged-users-list/paged-users-list.component.less"; - $stylesheets[] = "plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.less"; + $stylesheets[] = "plugins/UsersManager/vue/src/UserEditForm/UserEditForm.less"; $stylesheets[] = "plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.less"; $stylesheets[] = "plugins/UsersManager/vue/src/CapabilitiesEdit/CapabilitiesEdit.less"; } diff --git a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html b/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html deleted file mode 100644 index af48840665..0000000000 --- a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html +++ /dev/null @@ -1,208 +0,0 @@ -<div - piwik-content-block - content-title="{{ $ctrl.getFormTitle() }} {{ !$ctrl.isAdd ? ('\'' + $ctrl.user.login + '\'') : '' }}" - class="userEditForm" - ng-class="{ loading: $ctrl.isSavingUserInfo }" -> - - <div class="row" piwik-form> - <div class="col m2 entityList" ng-if="!$ctrl.isAdd"> - <ul class="listCircle"> - <li ng-class="{active: $ctrl.activeTab === 'basic'}" class="menuBasicInfo"> - <a href="" ng-click="$ctrl.activeTab = 'basic'">{{:: 'UsersManager_BasicInformation'|translate }}</a> - </li> - - <li ng-class="{active: $ctrl.activeTab === 'permissions'}" class="menuPermissions"> - <a href="" ng-click="$ctrl.activeTab = 'permissions'"> - {{:: 'UsersManager_Permissions'|translate }} - </a> - <span class="icon-warning" ng-if="!$ctrl.userHasAccess && !$ctrl.user.superuser_access"></span> - </li> - - <li ng-class="{active: $ctrl.activeTab === 'superuser'}" class="menuSuperuser" ng-if="$ctrl.currentUserRole == 'superuser'"> - <a href="" ng-click="$ctrl.activeTab = 'superuser'">{{:: 'UsersManager_SuperUserAccess'|translate }}</a> - </li> - - <li ng-class="{active: $ctrl.activeTab === '2fa'}" class="menuUserTwoFa" ng-if="$ctrl.currentUserRole == 'superuser' && $ctrl.user.uses_2fa && !$ctrl.isAdd"> - <a href="" ng-click="$ctrl.activeTab = '2fa'">{{:: 'UsersManager_TwoFactorAuthentication'|translate }}</a> - </li> - </ul> - - <div class="save-button-spacer hide-on-small-only"> - </div> - - <div class='entityCancel' ng-click="$ctrl.onDoneEditing({ isUserModified: $ctrl.isUserModified })"> - <a href="" class="entityCancelLink">{{:: 'Mobile_NavigationBack'|translate }}</a> - </div> - </div> - - <div class="visibleTab col m10"> - <div ng-if="$ctrl.activeTab === 'basic'" class="basic-info-tab"> - <div - piwik-field - uicontrol="text" - name="user_login" - ng-model="$ctrl.user.login" - data-title="{{ 'General_Username'|translate }}" - maxlength="100" - data-disabled="$ctrl.isSavingUserInfo || !$ctrl.isAdd" - > - </div> - - <div - piwik-field - uicontrol="password" - name="user_password" - ng-model="$ctrl.user.password" - data-title="{{ 'General_Password'|translate }}" - data-disabled="$ctrl.isSavingUserInfo || ($ctrl.currentUserRole != 'superuser' && !$ctrl.isAdd)" - ng-change="$ctrl.isPasswordModified = true" - > - </div> - - <div - piwik-field - uicontrol="text" - name="user_email" - ng-model="$ctrl.user.email" - data-title="{{ 'UsersManager_Email'|translate }}" - maxlength="100" - data-disabled="$ctrl.isSavingUserInfo || ($ctrl.currentUserRole != 'superuser' && !$ctrl.isAdd)" - ng-if="$ctrl.currentUserRole == 'superuser' || $ctrl.isAdd" - > - </div> - - <div - piwik-field - uicontrol="site" - name="user_site" - ng-model="$ctrl.firstSiteAccess" - data-title="{{ 'UsersManager_FirstWebsitePermission'|translate }}" - data-disabled="$ctrl.isSavingUserInfo" - ng-if="$ctrl.isAdd" - ui-control-attributes="{ onlySitesWithAdminAccess: true }" - ng-attr-inline-help="{{:: 'UsersManager_FirstSiteInlineHelp'|translate }}" - > - </div> - - <div piwik-save-button - saving="$ctrl.isSavingUserInfo" - onconfirm="$ctrl.saveUserInfo()" - ng-value="$ctrl.getSaveButtonLabel()" - data-disabled="$ctrl.isAdd && (!$ctrl.firstSiteAccess || !$ctrl.firstSiteAccess.id)" - ng-if="$ctrl.currentUserRole == 'superuser' || $ctrl.isAdd" - ></div> - - <div class='entityCancel' ng-if="$ctrl.isAdd"> - <a href="" class="entityCancelLink" ng-click="$ctrl.onDoneEditing({ isUserModified: $ctrl.isUserModified })">{{:: 'General_Cancel'|translate }}</a> - </div> - </div> - - <div ng-if="!$ctrl.isAdd" ng-show="$ctrl.activeTab === 'permissions'" class="user-permissions"> - <piwik-user-permissions-edit - ng-if="!$ctrl.user.superuser_access" - user-login="$ctrl.user.login" - on-user-has-access-detected="$ctrl.userHasAccess = hasAccess" - on-access-change="$ctrl.isUserModified = true" - access-levels="$ctrl.accessLevels" - filter-access-levels="$ctrl.filterAccessLevels" - > - </piwik-user-permissions-edit> - <div ng-if="$ctrl.user.superuser_access" class="alert alert-info"> - {{:: 'UsersManager_SuperUsersPermissionsNotice'|translate }} - </div> - </div> - - <div ng-if="$ctrl.activeTab === 'superuser' && $ctrl.currentUserRole == 'superuser' && !$ctrl.isAdd" class="superuser-access"> - <p>{{:: 'UsersManager_SuperUserIntro1'|translate }}</p> - - <p><strong>{{:: 'UsersManager_SuperUserIntro2'|translate }}</strong></p> - - <div - piwik-field - uicontrol="checkbox" - name="superuser_access" - ng-model="$ctrl.superUserAccessChecked" - ng-attr-title="{{:: 'UsersManager_HasSuperUserAccess'|translate }}" - ng-click="$ctrl.confirmSuperUserChange()" - data-disabled="$ctrl.isSavingUserInfo" - > - </div> - - <div class="superuser-confirm-modal modal"> - <div class="modal-content"> - <h2>{{:: 'UsersManager_AreYouSure'|translate }}</h2> - <p ng-if="$ctrl.user.superuser_access"> - {{:: 'UsersManager_RemoveSuperuserAccessConfirm'|translate }} - </p> - <p ng-if="!$ctrl.user.superuser_access"> - {{:: 'UsersManager_AddSuperuserAccessConfirm'|translate }} - </p> - - <div piwik-field uicontrol="password" name="currentUserPasswordForSuperUser" autocomplete="off" - ng-model="$ctrl.passwordConfirmationForSuperUser" - full-width="true" - title="{{ 'UsersManager_YourCurrentPassword'|translate }}" - value=""> - </div> - </div> - <div class="modal-footer"> - <a href="" class="modal-action modal-close btn" ng-click="$ctrl.toggleSuperuserAccess()">{{:: 'General_Yes'|translate }}</a> - <a href="" class="modal-action modal-close modal-no" ng-click="$ctrl.setSuperUserAccessChecked()">{{:: 'General_No'|translate }}</a> - </div> - </div> - </div> - - <div ng-show="$ctrl.activeTab === '2fa'" ng-if="$ctrl.currentUserRole == 'superuser' && !$ctrl.isAdd" class="twofa-reset"> - <p>{{:: 'UsersManager_ResetTwoFactorAuthenticationInfo'|translate }}</p> - - <div piwik-save-button - class="resetTwoFa" - saving="$ctrl.isResetting2FA" - onconfirm="$ctrl.confirmReset2FA()" - value="{{ 'UsersManager_ResetTwoFactorAuthentication'|translate }}" - ></div> - - <div class="twofa-confirm-modal modal"> - <div class="modal-content"> - <h2>{{:: 'UsersManager_AreYouSure'|translate }}</h2> - <p>{{:: 'UsersManager_ConfirmWithPassword'|translate }}</p> - - <div piwik-field uicontrol="password" name="currentUserPassword" autocomplete="off" - ng-model="$ctrl.passwordConfirmation" - full-width="true" - title="{{ 'UsersManager_YourCurrentPassword'|translate }}" - value=""> - </div> - </div> - - <div class="modal-footer"> - <a href="" class="modal-action modal-close btn" ng-click="$ctrl.reset2FA()">{{:: 'General_Yes'|translate }}</a> - <a href="" class="modal-action modal-close modal-no">{{:: 'General_No'|translate }}</a> - </div> - </div> - - </div> - </div> - </div> - - - <div class="change-password-modal modal"> - <div class="modal-content"> - <h2 piwik-translate="UsersManager_AreYouSureChangeDetails"><strong>{{ $ctrl.user.login }}</strong></h2> - <p>{{:: 'UsersManager_ConfirmWithPassword'|translate }}</p> - - <div piwik-field uicontrol="password" name="currentUserPassword" autocomplete="off" - ng-model="$ctrl.passwordConfirmation" - full-width="true" - title="{{ 'UsersManager_YourCurrentPassword'|translate }}" - value=""> - </div> - </div> - <div class="modal-footer"> - <a href="" class="modal-action modal-close btn" ng-click="$ctrl.updateUser()">{{:: 'General_Yes'|translate }}</a> - <a href="" class="modal-action modal-close modal-no">{{:: 'General_No'|translate }}</a> - </div> - </div> - -</div> diff --git a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js b/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js deleted file mode 100644 index 9b6792ea41..0000000000 --- a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js +++ /dev/null @@ -1,210 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Usage: - * <piwik-user-edit-form> - */ -(function () { - angular.module('piwikApp').component('piwikUserEditForm', { - templateUrl: 'plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html?cb=' + piwik.cacheBuster, - bindings: { - user: '<', - onDoneEditing: '&', - currentUserRole: '<', - accessLevels: '<', - filterAccessLevels: '<', - initialSiteId: '<', - initialSiteName: '<' - }, - controller: UserEditFormController - }); - - UserEditFormController.$inject = ['$element', 'piwikApi', '$q']; - - function UserEditFormController($element, piwikApi, $q) { - var vm = this; - vm.activeTab = 'basic'; - vm.permissionsForIdSite = 1; - vm.isSavingUserInfo = false; - vm.userHasAccess = true; - vm.firstSiteAccess = null; - vm.isUserModified = false; - vm.passwordConfirmation = ''; - vm.isPasswordModified = false; - - vm.$onInit = $onInit; - vm.$onChanges = $onChanges; - vm.confirmSuperUserChange = confirmSuperUserChange; - vm.confirmReset2FA = confirmReset2FA; - vm.getFormTitle = getFormTitle; - vm.getSaveButtonLabel = getSaveButtonLabel; - vm.toggleSuperuserAccess = toggleSuperuserAccess; - vm.saveUserInfo = saveUserInfo; - vm.reset2FA = reset2FA; - vm.updateUser = updateUser; - vm.setSuperUserAccessChecked = setSuperUserAccessChecked; - - function $onInit() { - vm.firstSiteAccess = { - id: vm.initialSiteId, - name: vm.initialSiteName - }; - } - - function $onChanges() { - if (vm.user) { - vm.isAdd = false; - } else { - vm.isAdd = true; - vm.user = {}; - } - - if (!vm.isAdd) { - vm.user.password = 'XXXXXXXX'; // make sure password is not stored in the client after update/save - } - - setSuperUserAccessChecked(); - } - - function getFormTitle() { - return vm.isAdd ? _pk_translate('UsersManager_AddNewUser') : _pk_translate('UsersManager_EditUser'); - } - - function getSaveButtonLabel() { - return vm.isAdd ? _pk_translate('UsersManager_CreateUser') : _pk_translate('UsersManager_SaveBasicInfo'); - } - - function confirmSuperUserChange() { - $element.find('.superuser-confirm-modal').modal({ dismissible: false }).modal('open'); - } - - function confirmReset2FA() { - $element.find('.twofa-confirm-modal').modal({ dismissible: false }).modal('open'); - } - - function confirmUserChange() { - vm.passwordConfirmation = ''; - function onEnter(event){ - var keycode = (event.keyCode ? event.keyCode : event.which); - if (keycode == '13'){ - $element.find('.change-password-modal').modal('close'); - vm.updateUser(); - } - } - - $element.find('.change-password-modal').modal({ dismissible: false, onOpenEnd: function () { - $('.modal.open #currentUserPassword').focus(); - $('.modal.open #currentUserPassword').off('keypress').keypress(onEnter); - }}).modal('open'); - } - - function toggleSuperuserAccess() { - vm.isSavingUserInfo = true; - piwikApi.post({ - method: 'UsersManager.setSuperUserAccess' - }, { - userLogin: vm.user.login, - hasSuperUserAccess: vm.user.superuser_access ? '0' : '1', - passwordConfirmation: vm.passwordConfirmationForSuperUser, - }).then(function () { - vm.user.superuser_access = !vm.user.superuser_access; - }).catch(function () { - // ignore error (still displayed to user) - }).then(function () { - vm.isSavingUserInfo = false; - vm.isUserModified = true; - vm.passwordConfirmationForSuperUser = null; - setSuperUserAccessChecked(); - }); - } - - function setSuperUserAccessChecked() { - vm.superUserAccessChecked = !! vm.user.superuser_access; - } - - function saveUserInfo() { - if (vm.isAdd) { - createUser(); - } else { - confirmUserChange(); - } - } - - function reset2FA() { - vm.isResetting2FA = true; - return piwikApi.post({ - method: 'TwoFactorAuth.resetTwoFactorAuth', - userLogin: vm.user.login, - passwordConfirmation: vm.passwordConfirmation - }).catch(function (e) { - vm.isResetting2FA = false; - throw e; - }).then(function () { - vm.isResetting2FA = false; - vm.user.uses_2fa = false; - vm.activeTab = 'basic'; - - showUserSavedNotification(); - }).finally(function () { - vm.passwordConfirmation = ''; - }); - } - - function showUserSavedNotification() { - var UI = require('piwik/UI'); - var notification = new UI.Notification(); - notification.show(_pk_translate('General_YourChangesHaveBeenSaved'), { context: 'success', type: 'toast' }); - } - - function createUser() { - vm.isSavingUserInfo = true; - return piwikApi.post({ - method: 'UsersManager.addUser' - }, { - userLogin: vm.user.login, - password: vm.user.password, - email: vm.user.email, - initialIdSite: vm.firstSiteAccess ? vm.firstSiteAccess.id : undefined - }).catch(function (e) { - vm.isSavingUserInfo = false; - throw e; - }).then(function () { - vm.firstSiteAccess = null; - vm.isSavingUserInfo = false; - vm.isAdd = false; - vm.isEmailChanged = false; - vm.isUserModified = true; - - showUserSavedNotification(); - }); - } - - function updateUser() { - vm.isSavingUserInfo = true; - return piwikApi.post({ - method: 'UsersManager.updateUser' - }, { - userLogin: vm.user.login, - password: (vm.isPasswordModified && vm.user.password) ? vm.user.password : undefined, - passwordConfirmation: vm.passwordConfirmation ? vm.passwordConfirmation : undefined, - email: vm.user.email - }).catch(function (e) { - vm.isSavingUserInfo = false; - vm.passwordConfirmation = false; - throw e; - }).then(function () { - vm.isSavingUserInfo = false; - vm.passwordConfirmation = false; - vm.isUserModified = true; - vm.isPasswordModified = false; - - showUserSavedNotification(); - }); - } - } -})(); diff --git a/plugins/UsersManager/angularjs/users-manager/users-manager.component.html b/plugins/UsersManager/angularjs/users-manager/users-manager.component.html index 4b996e92d7..2aa773d9b7 100644 --- a/plugins/UsersManager/angularjs/users-manager/users-manager.component.html +++ b/plugins/UsersManager/angularjs/users-manager/users-manager.component.html @@ -60,6 +60,7 @@ filter-access-levels="$ctrl.filterAccessLevels" initial-site-id="$ctrl.initialSiteId" initial-site-name="$ctrl.initialSiteName" + on-updated="$ctrl.userBeingEdited = user" ></piwik-user-edit-form> </div> diff --git a/plugins/UsersManager/tests/UI/UsersManager_spec.js b/plugins/UsersManager/tests/UI/UsersManager_spec.js index e1c06bce75..0fd1ff813a 100644 --- a/plugins/UsersManager/tests/UI/UsersManager_spec.js +++ b/plugins/UsersManager/tests/UI/UsersManager_spec.js @@ -197,10 +197,10 @@ describe("UsersManager", function () { await page.type('#user_password', 'thepassword'); await page.type('#user_email', 'theuser@email.com'); - await page.click('piwik-user-edit-form .siteSelector a.title'); - await (await page.jQuery('piwik-user-edit-form .siteSelector .custom_select_ul_list a:eq(1):visible', { waitFor: true })).click(); + await page.click('.userEditForm .siteSelector a.title'); + await (await page.jQuery('.userEditForm .siteSelector .custom_select_ul_list a:eq(1):visible', { waitFor: true })).click(); - await page.evaluate(() => $('piwik-user-edit-form [piwik-save-button] input').click()); + await page.evaluate(() => $('.userEditForm .matomo-save-button input').click()); await page.waitForNetworkIdle(); expect(await page.screenshotSelector('.usersManager')).to.matchImage('user_created'); @@ -485,8 +485,9 @@ describe("UsersManager", function () { await page.evaluate(function () { $('.userEditForm #user_email').val('testlogin3@example.com').change(); }); + await page.waitFor(100); - var btnSave = await page.jQuery('.userEditForm .basic-info-tab [piwik-save-button] .btn', { waitFor: true }); + var btnSave = await page.jQuery('.userEditForm .basic-info-tab .matomo-save-button .btn', { waitFor: true }); await btnSave.click(); await page.waitForTimeout(500); // animation @@ -546,9 +547,7 @@ describe("UsersManager", function () { }); it('should not allow editing basic info for admin users', async function () { - await page.evaluate(function () { - $('.userEditForm .entityCancelLink').click(); - }); + await page.click('.userEditForm .entityCancelLink'); await (await page.jQuery('button.edituser:eq(0)')).click(); await page.waitForNetworkIdle(); @@ -563,9 +562,7 @@ describe("UsersManager", function () { }); it('should show the add existing user modal', async function () { - await page.evaluate(function () { - $('.userEditForm .entityCancelLink').click(); - }); + await page.click('.userEditForm .entityCancelLink'); await page.click('.add-existing-user'); await page.waitForTimeout(500); // wait for animation diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_edit_user_basic_asks_confirmation.png b/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_edit_user_basic_asks_confirmation.png index 76143a2279..e44dd90328 100644 --- a/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_edit_user_basic_asks_confirmation.png +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_edit_user_basic_asks_confirmation.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2ce73a9225be72d455b4518c70ca315c48f1c4c4e5281aa854dd6128b4d5a14 -size 21832 +oid sha256:3b47b430f67f92811615b9b10dafc3137923b849580f50256598bc33e92d3bc5 +size 21831 diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_superuser_confirm.png b/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_superuser_confirm.png index 40e6e80ae1..9794675211 100644 --- a/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_superuser_confirm.png +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_superuser_confirm.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e5115bf7f5420691d5549811e999b4ead5fb21eedccda6c5527c6e1648a0b11 +oid sha256:2777d9df6068d8f669d5fe6087b33e54c8e13eafebe43534340bc96d671503c5 size 19854 diff --git a/plugins/UsersManager/vue/dist/UsersManager.umd.js b/plugins/UsersManager/vue/dist/UsersManager.umd.js index 36b9629aab..0068cb98a0 100644 --- a/plugins/UsersManager/vue/dist/UsersManager.umd.js +++ b/plugins/UsersManager/vue/dist/UsersManager.umd.js @@ -127,6 +127,7 @@ __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, "CapabilitiesEdit", function() { return /* reexport */ CapabilitiesEdit; }); __webpack_require__.d(__webpack_exports__, "UserPermissionsEdit", function() { return /* reexport */ UserPermissionsEdit; }); +__webpack_require__.d(__webpack_exports__, "UserEditForm", function() { return /* reexport */ UserEditForm; }); // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js // This file is imported into lib/wc client bundles. @@ -576,36 +577,36 @@ CapabilitiesEditvue_type_script_lang_ts.render = render } } })); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue?vue&type=template&id=b8ef996c +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue?vue&type=template&id=46f39bbd -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_1 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_1 = { key: 0, class: "row" }; -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_2 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_2 = { class: "row to-all-websites" }; -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_3 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_3 = { class: "col s12" }; -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_4 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_4 = { style: { "margin-right": "3.5px" } }; -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_5 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_5 = { id: "all-sites-access-select", style: { "margin-right": "3.5px" } }; -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_6 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, " ", -1); +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_6 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, " ", -1); -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_7 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_7 = { class: "filters row" }; -var UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_8 = { +var UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_8 = { class: "col s12 m12 l8" }; var _hoisted_9 = { @@ -756,7 +757,7 @@ var _hoisted_62 = ["innerHTML"]; var _hoisted_63 = { class: "modal-footer" }; -function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $props, $setup, $data, $options) { +function UserPermissionsEditvue_type_template_id_46f39bbd_render(_ctx, _cache, $props, $setup, $data, $options) { var _component_Notification = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Notification"); var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); @@ -771,7 +772,7 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["userPermissionsEdit", { loading: _ctx.isLoadingAccess }]) - }, [!_ctx.hasAccessToAtLeastOneSite ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Notification, { + }, [!_ctx.hasAccessToAtLeastOneSite ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Notification, { context: "warning", type: "transient", noclear: true @@ -780,7 +781,7 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Warning')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_NoAccessWarning')), 1)]; }), _: 1 - })])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_GiveAccessToAll')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + })])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_GiveAccessToAll')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { modelValue: _ctx.allWebsitesAccssLevelSet, "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { return _ctx.allWebsitesAccssLevelSet = $event; @@ -796,7 +797,7 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ onClick: _cache[1] || (_cache[1] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { return _ctx.showChangeAccessAllSitesModal(); }, ["prevent"])) - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Apply')), 3)]), UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_OrManageIndividually')) + ":", 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_b8ef996c_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Apply')), 3)]), UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_OrManageIndividually')) + ":", 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserPermissionsEditvue_type_template_id_46f39bbd_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["dropdown-trigger btn", { disabled: _ctx.isBulkActionsDisabled }]), @@ -977,7 +978,10 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ class: "modal-action modal-close btn", onClick: _cache[15] || (_cache[15] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { return _ctx.changeUserRole(); - }, ["prevent"])) + }, ["prevent"])), + style: { + "margin-right": "3.5px" + } }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Yes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { href: "", class: "modal-action modal-close modal-no", @@ -996,7 +1000,10 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ class: "modal-action modal-close btn", onClick: _cache[17] || (_cache[17] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { return _ctx.changeUserRole(); - }, ["prevent"])) + }, ["prevent"])), + style: { + "margin-right": "3.5px" + } }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Yes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { href: "", class: "modal-action modal-close modal-no", @@ -1012,7 +1019,10 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ class: "modal-action modal-close btn", onClick: _cache[19] || (_cache[19] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { return _ctx.giveAccessToAllSites(); - }, ["prevent"])) + }, ["prevent"])), + style: { + "margin-right": "3.5px" + } }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Yes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { href: "", class: "modal-action modal-close modal-no", @@ -1021,7 +1031,7 @@ function UserPermissionsEditvue_type_template_id_b8ef996c_render(_ctx, _cache, $ }) }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_No')), 1)])], 512)], 2); } -// CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue?vue&type=template&id=b8ef996c +// CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue?vue&type=template&id=46f39bbd // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue?vue&type=script&lang=ts @@ -1386,7 +1396,7 @@ var UserPermissionsEditvue_type_script_lang_ts_window = window, -UserPermissionsEditvue_type_script_lang_ts.render = UserPermissionsEditvue_type_template_id_b8ef996c_render +UserPermissionsEditvue_type_script_lang_ts.render = UserPermissionsEditvue_type_template_id_46f39bbd_render /* harmony default export */ var UserPermissionsEdit = (UserPermissionsEditvue_type_script_lang_ts); // CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.adapter.ts @@ -1425,6 +1435,646 @@ UserPermissionsEditvue_type_script_lang_ts.render = UserPermissionsEditvue_type_ directiveName: 'piwikUserPermissionsEdit', restrict: 'E' })); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue?vue&type=template&id=40878ae4 + +var UserEditFormvue_type_template_id_40878ae4_hoisted_1 = { + class: "row" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_2 = { + key: 0, + class: "col m2 entityList" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_3 = { + class: "listCircle" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_4 = { + key: 0, + class: "icon-warning" +}; + +var UserEditFormvue_type_template_id_40878ae4_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "save-button-spacer hide-on-small-only" +}, null, -1); + +var UserEditFormvue_type_template_id_40878ae4_hoisted_6 = { + href: "", + class: "entityCancelLink" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_7 = { + class: "visibleTab col m10" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_8 = { + key: 0, + class: "basic-info-tab" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_9 = { + key: 0, + class: "entityCancel" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_10 = { + key: 1, + class: "user-permissions" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_11 = { + key: 0 +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_12 = { + key: 1, + class: "alert alert-info" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_13 = { + key: 2, + class: "superuser-access" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_14 = { + class: "superuser-confirm-modal modal", + ref: "superUserConfirmModal" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_15 = { + class: "modal-content" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_16 = { + key: 0 +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_17 = { + key: 1 +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_18 = { + class: "modal-footer" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_19 = { + key: 3, + class: "twofa-reset" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_20 = { + class: "resetTwoFa" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_21 = { + class: "twofa-confirm-modal modal", + ref: "twofaConfirmModal" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_22 = { + class: "modal-content" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_23 = { + class: "modal-footer" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_24 = { + class: "change-password-modal modal", + ref: "changePasswordModal" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_25 = { + class: "modal-content" +}; +var UserEditFormvue_type_template_id_40878ae4_hoisted_26 = ["innerHTML"]; +var UserEditFormvue_type_template_id_40878ae4_hoisted_27 = { + class: "modal-footer" +}; +function UserEditFormvue_type_template_id_40878ae4_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + + var _component_UserPermissionsEdit = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("UserPermissionsEdit"); + + var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + + var _directive_form = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("form"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContentBlock, { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["userEditForm", { + loading: _ctx.isSavingUserInfo + }]), + "content-title": "".concat(_ctx.formTitle, " ").concat(!_ctx.isAdd ? "'".concat(_ctx.theUser.login, "'") : '') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_1, [!_ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", UserEditFormvue_type_template_id_40878ae4_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])([{ + active: _ctx.activeTab === 'basic' + }, "menuBasicInfo"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + onClick: _cache[0] || (_cache[0] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.activeTab = 'basic'; + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_BasicInformation')), 1)], 2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])([{ + active: _ctx.activeTab === 'permissions' + }, "menuPermissions"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + onClick: _cache[1] || (_cache[1] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.activeTab = 'permissions'; + }, ["prevent"])), + style: { + "margin-right": "3.5px" + } + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_Permissions')), 1), !_ctx.userHasAccess && !_ctx.theUser.superuser_access ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", UserEditFormvue_type_template_id_40878ae4_hoisted_4)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 2), _ctx.currentUserRole === 'superuser' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: 0, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])([{ + active: _ctx.activeTab === 'superuser' + }, "menuSuperuser"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + onClick: _cache[2] || (_cache[2] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.activeTab = 'superuser'; + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_SuperUserAccess')), 1)], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.currentUserRole === 'superuser' && _ctx.theUser.uses_2fa && !_ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: 1, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])([{ + active: _ctx.activeTab === '2fa' + }, "menuUserTwoFa"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + onClick: _cache[3] || (_cache[3] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.activeTab = '2fa'; + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_TwoFactorAuthentication')), 1)], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), UserEditFormvue_type_template_id_40878ae4_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "entityCancel", + onClick: _cache[4] || (_cache[4] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.onDoneEditing(); + }, ["prevent"])) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", UserEditFormvue_type_template_id_40878ae4_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Mobile_NavigationBack')), 1)])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_7, [_ctx.activeTab === 'basic' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.theUser.login, + "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) { + return _ctx.theUser.login = $event; + }), + disabled: _ctx.isSavingUserInfo || !_ctx.isAdd || _ctx.isShowingPasswordConfirm, + uicontrol: "text", + name: "user_login", + maxlength: 100, + title: _ctx.translate('General_Username') + }, null, 8, ["modelValue", "disabled", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + "model-value": _ctx.theUser.password, + disabled: _ctx.isSavingUserInfo || _ctx.currentUserRole !== 'superuser' && !_ctx.isAdd || _ctx.isShowingPasswordConfirm, + "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { + _ctx.theUser.password = $event; + _ctx.isPasswordModified = true; + }), + uicontrol: "password", + name: "user_password", + title: _ctx.translate('General_Password') + }, null, 8, ["model-value", "disabled", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [_ctx.currentUserRole === 'superuser' || _ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_Field, { + key: 0, + modelValue: _ctx.theUser.email, + "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) { + return _ctx.theUser.email = $event; + }), + disabled: _ctx.isSavingUserInfo || _ctx.currentUserRole !== 'superuser' && !_ctx.isAdd || _ctx.isShowingPasswordConfirm, + uicontrol: "text", + name: "user_email", + maxlength: 100, + title: _ctx.translate('UsersManager_Email') + }, null, 8, ["modelValue", "disabled", "title"])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [_ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_Field, { + key: 0, + modelValue: _ctx.firstSiteAccess, + "onUpdate:modelValue": _cache[8] || (_cache[8] = function ($event) { + return _ctx.firstSiteAccess = $event; + }), + disabled: _ctx.isSavingUserInfo, + uicontrol: "site", + name: "user_site", + "ui-control-attributes": { + onlySitesWithAdminAccess: true + }, + title: _ctx.translate('UsersManager_FirstWebsitePermission'), + "inline-help": _ctx.translate('UsersManager_FirstSiteInlineHelp') + }, null, 8, ["modelValue", "disabled", "title", "inline-help"])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [_ctx.currentUserRole === 'superuser' || _ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_SaveButton, { + key: 0, + value: _ctx.saveButtonLabel, + disabled: _ctx.isAdd && (!_ctx.firstSiteAccess || !_ctx.firstSiteAccess.id), + saving: _ctx.isSavingUserInfo, + onConfirm: _cache[9] || (_cache[9] = function ($event) { + return _ctx.saveUserInfo(); + }) + }, null, 8, ["value", "disabled", "saving"])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), _ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "entityCancelLink", + onClick: _cache[10] || (_cache[10] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.onDoneEditing(); + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Cancel')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.isAdd ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_10, [!_ctx.theUser.superuser_access ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_UserPermissionsEdit, { + "user-login": _ctx.theUser.login, + onUserHasAccessDetected: _cache[11] || (_cache[11] = function ($event) { + return _ctx.userHasAccess = $event.hasAccess; + }), + onAccessChanged: _cache[12] || (_cache[12] = function ($event) { + return _ctx.isUserModified = true; + }), + "access-levels": _ctx.accessLevels, + "filter-access-levels": _ctx.filterAccessLevels + }, null, 8, ["user-login", "access-levels", "filter-access-levels"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.theUser.superuser_access ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_12, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_SuperUsersPermissionsNotice')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.activeTab === 'permissions']]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.activeTab === 'superuser' && _ctx.currentUserRole === 'superuser' && !_ctx.isAdd ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_SuperUserIntro1')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_SuperUserIntro2')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.superUserAccessChecked, + "onUpdate:modelValue": _cache[13] || (_cache[13] = function ($event) { + return _ctx.superUserAccessChecked = $event; + }), + onClick: _cache[14] || (_cache[14] = function ($event) { + return _ctx.confirmSuperUserChange(); + }), + disabled: _ctx.isSavingUserInfo, + uicontrol: "checkbox", + name: "superuser_access", + title: _ctx.translate('UsersManager_HasSuperUserAccess') + }, null, 8, ["modelValue", "disabled", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_AreYouSure')), 1), _ctx.theUser.superuser_access ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", UserEditFormvue_type_template_id_40878ae4_hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_RemoveSuperuserAccessConfirm')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.theUser.superuser_access ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", UserEditFormvue_type_template_id_40878ae4_hoisted_17, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_AddSuperuserAccessConfirm')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.passwordConfirmationForSuperUser, + "onUpdate:modelValue": _cache[15] || (_cache[15] = function ($event) { + return _ctx.passwordConfirmationForSuperUser = $event; + }), + uicontrol: "password", + name: "currentUserPasswordForSuperUser", + autocomplete: false, + "full-width": true, + title: _ctx.translate('UsersManager_YourCurrentPassword') + }, null, 8, ["modelValue", "title"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "modal-action modal-close btn", + onClick: _cache[16] || (_cache[16] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.toggleSuperuserAccess(); + }, ["prevent"])), + style: { + "margin-right": "3.5px" + } + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Yes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "modal-action modal-close modal-no", + onClick: _cache[17] || (_cache[17] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + _ctx.setSuperUserAccessChecked(); + + _ctx.passwordConfirmationForSuperUser = ''; + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_No')), 1)])], 512)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.currentUserRole === 'superuser' && !_ctx.isAdd ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_ResetTwoFactorAuthenticationInfo')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_20, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + saving: _ctx.isResetting2FA, + onConfirm: _cache[18] || (_cache[18] = function ($event) { + return _ctx.confirmReset2FA(); + }), + value: _ctx.translate('UsersManager_ResetTwoFactorAuthentication') + }, null, 8, ["saving", "value"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_21, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_22, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_AreYouSure')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_ConfirmWithPassword')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.passwordConfirmation, + "onUpdate:modelValue": _cache[19] || (_cache[19] = function ($event) { + return _ctx.passwordConfirmation = $event; + }), + uicontrol: "password", + name: "currentUserPassword", + autocomplete: false, + "full-width": true, + title: _ctx.translate('UsersManager_YourCurrentPassword') + }, null, 8, ["modelValue", "title"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_23, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "modal-action modal-close btn", + onClick: _cache[20] || (_cache[20] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.reset2FA(); + }, ["prevent"])), + style: { + "margin-right": "3.5px" + } + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Yes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "modal-action modal-close modal-no", + onClick: _cache[21] || (_cache[21] = function ($event) { + $event.preventDefault(); + _ctx.passwordConfirmation = ''; + }) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_No')), 1)])], 512)], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.activeTab === '2fa']]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])], 512), [[_directive_form]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_24, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_25, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", { + innerHTML: _ctx.changePasswordTitle + }, null, 8, UserEditFormvue_type_template_id_40878ae4_hoisted_26), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersManager_ConfirmWithPassword')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.passwordConfirmation, + "onUpdate:modelValue": _cache[22] || (_cache[22] = function ($event) { + return _ctx.passwordConfirmation = $event; + }), + uicontrol: "password", + name: "currentUserPassword", + autocomplete: false, + "full-width": true, + title: _ctx.translate('UsersManager_YourCurrentPassword') + }, null, 8, ["modelValue", "title"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", UserEditFormvue_type_template_id_40878ae4_hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "modal-action modal-close btn", + onClick: _cache[23] || (_cache[23] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.updateUser(); + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Yes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "", + class: "modal-action modal-close modal-no", + onClick: _cache[24] || (_cache[24] = function ($event) { + $event.preventDefault(); + _ctx.passwordConfirmation = ''; + }) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_No')), 1)])], 512)]; + }), + _: 1 + }, 8, ["class", "content-title"]); +} +// CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue?vue&type=template&id=40878ae4 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue?vue&type=script&lang=ts + + + + +var DEFAULT_USER = { + login: '', + superuser_access: false, + uses_2fa: false, + password: '', + email: '' +}; +var UserEditFormvue_type_script_lang_ts_window = window, + UserEditFormvue_type_script_lang_ts_$ = UserEditFormvue_type_script_lang_ts_window.$; +/* harmony default export */ var UserEditFormvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + user: Object, + currentUserRole: { + type: String, + required: true + }, + accessLevels: { + type: Array, + required: true + }, + filterAccessLevels: { + type: Array, + required: true + }, + initialSiteId: { + type: [String, Number], + required: true + }, + initialSiteName: { + type: String, + required: true + } + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"], + SaveButton: external_CorePluginsAdmin_["SaveButton"], + UserPermissionsEdit: UserPermissionsEdit + }, + directives: { + Form: external_CorePluginsAdmin_["Form"] + }, + data: function data() { + return { + theUser: this.user || Object.assign({}, DEFAULT_USER), + activeTab: 'basic', + permissionsForIdSite: 1, + isSavingUserInfo: false, + userHasAccess: true, + firstSiteAccess: { + id: this.initialSiteId, + name: this.initialSiteName + }, + isUserModified: false, + passwordConfirmation: '', + isPasswordModified: false, + superUserAccessChecked: null, + passwordConfirmationForSuperUser: '', + isResetting2FA: false, + isShowingPasswordConfirm: false + }; + }, + emits: ['done', 'updated'], + watch: { + user: function user(newVal) { + this.theUser = newVal || Object.assign({}, DEFAULT_USER); + + if (!this.theUser.password) { + this.resetPasswordVar(); + } + + this.setSuperUserAccessChecked(); + } + }, + methods: { + confirmSuperUserChange: function confirmSuperUserChange() { + UserEditFormvue_type_script_lang_ts_$(this.$refs.superUserConfirmModal).modal({ + dismissible: false + }).modal('open'); + }, + confirmReset2FA: function confirmReset2FA() { + UserEditFormvue_type_script_lang_ts_$(this.$refs.twofaConfirmModal).modal({ + dismissible: false + }).modal('open'); + }, + toggleSuperuserAccess: function toggleSuperuserAccess() { + var _this = this; + + this.isSavingUserInfo = true; + external_CoreHome_["AjaxHelper"].post({ + method: 'UsersManager.setSuperUserAccess' + }, { + userLogin: this.theUser.login, + hasSuperUserAccess: this.theUser.superuser_access ? '0' : '1', + passwordConfirmation: this.passwordConfirmationForSuperUser + }).then(function () { + _this.theUser.superuser_access = !_this.theUser.superuser_access; + }).catch(function () {// ignore error (still displayed to user) + }).then(function () { + _this.isSavingUserInfo = false; + _this.isUserModified = true; + _this.passwordConfirmationForSuperUser = ''; + + _this.setSuperUserAccessChecked(); + }); + }, + saveUserInfo: function saveUserInfo() { + var _this2 = this; + + return Promise.resolve().then(function () { + if (_this2.isAdd) { + return _this2.createUser(); + } + + return _this2.confirmUserChange(); + }).then(function () { + _this2.$emit('updated', { + user: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(_this2.theUser) + }); + }); + }, + createUser: function createUser() { + var _this3 = this; + + this.isSavingUserInfo = true; + return external_CoreHome_["AjaxHelper"].post({ + method: 'UsersManager.addUser' + }, { + userLogin: this.theUser.login, + password: this.theUser.password, + email: this.theUser.email, + initialIdSite: this.firstSiteAccess ? this.firstSiteAccess.id : undefined + }).catch(function (e) { + _this3.isSavingUserInfo = false; + throw e; + }).then(function () { + _this3.firstSiteAccess = null; + _this3.isSavingUserInfo = false; + _this3.isUserModified = true; + + _this3.resetPasswordVar(); + + _this3.showUserSavedNotification(); + }); + }, + resetPasswordVar: function resetPasswordVar() { + if (!this.isAdd) { + // make sure password is not stored in the client after update/save + this.theUser.password = 'XXXXXXXX'; + } + }, + confirmUserChange: function confirmUserChange() { + var _this4 = this; + + this.passwordConfirmation = ''; + this.isShowingPasswordConfirm = true; + + var onEnter = function onEnter(event) { + var keycode = event.keyCode ? event.keyCode : event.which; + + if (keycode === 13) { + UserEditFormvue_type_script_lang_ts_$(_this4.$refs.changePasswordModal).modal('close'); + + _this4.updateUser(); + } + }; + + UserEditFormvue_type_script_lang_ts_$(this.$refs.changePasswordModal).modal({ + dismissible: false, + onOpenEnd: function onOpenEnd() { + _this4.isShowingPasswordConfirm = false; + UserEditFormvue_type_script_lang_ts_$('.modal.open #currentUserPassword').focus().off('keypress').keypress(onEnter); + } + }).modal('open'); + }, + showUserSavedNotification: function showUserSavedNotification() { + external_CoreHome_["NotificationsStore"].show({ + message: Object(external_CoreHome_["translate"])('General_YourChangesHaveBeenSaved'), + context: 'success', + type: 'toast' + }); + }, + reset2FA: function reset2FA() { + var _this5 = this; + + this.isResetting2FA = true; + return external_CoreHome_["AjaxHelper"].post({ + method: 'TwoFactorAuth.resetTwoFactorAuth', + userLogin: this.theUser.login, + passwordConfirmation: this.passwordConfirmation + }).catch(function (e) { + _this5.isResetting2FA = false; + throw e; + }).then(function () { + _this5.isResetting2FA = false; + _this5.theUser.uses_2fa = false; + _this5.activeTab = 'basic'; + + _this5.showUserSavedNotification(); + }).finally(function () { + _this5.passwordConfirmation = ''; + }); + }, + updateUser: function updateUser() { + var _this6 = this; + + this.isSavingUserInfo = true; + return external_CoreHome_["AjaxHelper"].post({ + method: 'UsersManager.updateUser' + }, { + userLogin: this.theUser.login, + password: this.isPasswordModified && this.theUser.password ? this.theUser.password : undefined, + passwordConfirmation: this.passwordConfirmation ? this.passwordConfirmation : undefined, + email: this.theUser.email + }).catch(function (e) { + _this6.isSavingUserInfo = false; + _this6.passwordConfirmation = ''; + throw e; + }).then(function () { + _this6.isSavingUserInfo = false; + _this6.passwordConfirmation = ''; + _this6.isUserModified = true; + _this6.isPasswordModified = false; + + _this6.resetPasswordVar(); + + _this6.showUserSavedNotification(); + }); + }, + setSuperUserAccessChecked: function setSuperUserAccessChecked() { + this.superUserAccessChecked = !!this.theUser.superuser_access; + }, + onDoneEditing: function onDoneEditing() { + this.$emit('done', { + isUserModified: this.isUserModified + }); + } + }, + computed: { + formTitle: function formTitle() { + return this.isAdd ? Object(external_CoreHome_["translate"])('UsersManager_AddNewUser') : Object(external_CoreHome_["translate"])('UsersManager_EditUser'); + }, + saveButtonLabel: function saveButtonLabel() { + return this.isAdd ? Object(external_CoreHome_["translate"])('UsersManager_CreateUser') : Object(external_CoreHome_["translate"])('UsersManager_SaveBasicInfo'); + }, + isAdd: function isAdd() { + return !this.user; // purposefully checking input property not theUser state + }, + changePasswordTitle: function changePasswordTitle() { + return Object(external_CoreHome_["translate"])('UsersManager_AreYouSureChangeDetails', "<strong>".concat(this.theUser.login, "</strong>")); + } + } +})); +// CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue + + + +UserEditFormvue_type_script_lang_ts.render = UserEditFormvue_type_template_id_40878ae4_render + +/* harmony default export */ var UserEditForm = (UserEditFormvue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/UsersManager/vue/src/UserEditForm/UserEditForm.adapter.ts +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + + +/* harmony default export */ var UserEditForm_adapter = (Object(external_CoreHome_["createAngularJsAdapter"])({ + component: UserEditForm, + scope: { + user: { + angularJsBind: '<' + }, + onDoneEditing: { + angularJsBind: '&', + vue: 'done' + }, + currentUserRole: { + angularJsBind: '<' + }, + accessLevels: { + angularJsBind: '<' + }, + filterAccessLevels: { + angularJsBind: '<' + }, + initialSiteId: { + angularJsBind: '<' + }, + initialSiteName: { + angularJsBind: '<' + }, + onUpdated: { + angularJsBind: '&', + vue: 'updated' + } + }, + directiveName: 'piwikUserEditForm', + restrict: 'E' +})); // CONCATENATED MODULE: ./plugins/UsersManager/vue/src/index.ts /*! * Matomo - free/libre analytics platform @@ -1436,6 +2086,8 @@ UserPermissionsEditvue_type_script_lang_ts.render = UserPermissionsEditvue_type_ + + // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js diff --git a/plugins/UsersManager/vue/dist/UsersManager.umd.min.js b/plugins/UsersManager/vue/dist/UsersManager.umd.min.js index 64e638b725..b82517440a 100644 --- a/plugins/UsersManager/vue/dist/UsersManager.umd.min.js +++ b/plugins/UsersManager/vue/dist/UsersManager.umd.min.js @@ -1,20 +1,26 @@ -(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["UsersManager"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["UsersManager"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,i){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="plugins/UsersManager/vue/dist/",i(i.s="fae3")}({"19dc":function(t,i){t.exports=e},"8bbf":function(e,i){e.exports=t},a5a2:function(e,t){e.exports=i},fae3:function(e,t,i){"use strict";if(i.r(t),i.d(t,"CapabilitiesEdit",(function(){return E})),i.d(t,"UserPermissionsEdit",(function(){return Pe})),"undefined"!==typeof window){var n=window.document.currentScript,s=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);s&&(i.p=s[1])}var c=i("19dc"),l=i("8bbf"),a=["title"],o=["onClick"],r={key:0,class:"addCapability"},d={class:"ui-confirm confirmCapabilityToggle modal",ref:"confirmCapabilityToggleModal"},u={class:"modal-content"},b=["innerHTML"],m=["innerHTML"],p={class:"modal-footer"};function h(e,t,i,n,s,c){var h=Object(l["resolveComponent"])("Field");return Object(l["openBlock"])(),Object(l["createElementBlock"])("div",{class:Object(l["normalizeClass"])(["capabilitiesEdit",{busy:e.isBusy}])},[(Object(l["openBlock"])(!0),Object(l["createElementBlock"])(l["Fragment"],null,Object(l["renderList"])(e.actualCapabilities,(function(t){return Object(l["openBlock"])(),Object(l["createElementBlock"])("div",{key:t.id,class:"chip"},[Object(l["createElementVNode"])("span",{class:"capability-name",title:"".concat(t.description," ").concat(e.isIncludedInRole(t)?"<br/><br/>".concat(e.translate("UsersManager_IncludedInUsersRole")):"")},Object(l["toDisplayString"])(t.category)+": "+Object(l["toDisplayString"])(t.name),9,a),e.isIncludedInRole(t)?Object(l["createCommentVNode"])("",!0):(Object(l["openBlock"])(),Object(l["createElementBlock"])("span",{key:0,class:"icon-close",onClick:function(i){e.capabilityToRemoveId=t.id,e.onToggleCapability(!1)}},null,8,o))])})),128)),e.availableCapabilitiesGrouped.length?(Object(l["openBlock"])(),Object(l["createElementBlock"])("div",r,[Object(l["createVNode"])(h,{"model-value":e.capabilityToAddId,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.capabilityToAddId=t,e.onToggleCapability(!0)}),disabled:e.isBusy,uicontrol:"expandable-select",name:"add_capability","full-width":!0,options:e.availableCapabilitiesGrouped},null,8,["model-value","disabled","options"])])):Object(l["createCommentVNode"])("",!0),Object(l["createElementVNode"])("div",d,[Object(l["createElementVNode"])("div",u,[e.isAddingCapability?(Object(l["openBlock"])(),Object(l["createElementBlock"])("h2",{key:0,innerHTML:e.$sanitize(e.confirmAddCapabilityToggleContent)},null,8,b)):Object(l["createCommentVNode"])("",!0),e.isAddingCapability?Object(l["createCommentVNode"])("",!0):(Object(l["openBlock"])(),Object(l["createElementBlock"])("h2",{key:1,innerHTML:e.$sanitize(e.confirmCapabilityToggleContent)},null,8,m))]),Object(l["createElementVNode"])("div",p,[Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[1]||(t[1]=Object(l["withModifiers"])((function(t){return e.toggleCapability()}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_Yes")),1),Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[2]||(t[2]=Object(l["withModifiers"])((function(t){e.capabilityToAddOrRemove=null,e.capabilityToAddId=null,e.capabilityToRemoveId=null}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_No")),1)])],512)],2)}var f=i("a5a2");function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(e,t,i){return t&&O(e.prototype,t),i&&O(e,i),e}function v(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e} +(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["UsersManager"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["UsersManager"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,s){return function(e){var t={};function s(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="plugins/UsersManager/vue/dist/",s(s.s="fae3")}({"19dc":function(t,s){t.exports=e},"8bbf":function(e,s){e.exports=t},a5a2:function(e,t){e.exports=s},fae3:function(e,t,s){"use strict";if(s.r(t),s.d(t,"CapabilitiesEdit",(function(){return V})),s.d(t,"UserPermissionsEdit",(function(){return He})),s.d(t,"UserEditForm",(function(){return jt})),"undefined"!==typeof window){var n=window.document.currentScript,i=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(s.p=i[1])}var a=s("19dc"),r=s("8bbf"),o=["title"],c=["onClick"],l={key:0,class:"addCapability"},d={class:"ui-confirm confirmCapabilityToggle modal",ref:"confirmCapabilityToggleModal"},u={class:"modal-content"},m=["innerHTML"],b=["innerHTML"],p={class:"modal-footer"};function f(e,t,s,n,i,a){var f=Object(r["resolveComponent"])("Field");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["capabilitiesEdit",{busy:e.isBusy}])},[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.actualCapabilities,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:t.id,class:"chip"},[Object(r["createElementVNode"])("span",{class:"capability-name",title:"".concat(t.description," ").concat(e.isIncludedInRole(t)?"<br/><br/>".concat(e.translate("UsersManager_IncludedInUsersRole")):"")},Object(r["toDisplayString"])(t.category)+": "+Object(r["toDisplayString"])(t.name),9,o),e.isIncludedInRole(t)?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:0,class:"icon-close",onClick:function(s){e.capabilityToRemoveId=t.id,e.onToggleCapability(!1)}},null,8,c))])})),128)),e.availableCapabilitiesGrouped.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",l,[Object(r["createVNode"])(f,{"model-value":e.capabilityToAddId,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.capabilityToAddId=t,e.onToggleCapability(!0)}),disabled:e.isBusy,uicontrol:"expandable-select",name:"add_capability","full-width":!0,options:e.availableCapabilitiesGrouped},null,8,["model-value","disabled","options"])])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",d,[Object(r["createElementVNode"])("div",u,[e.isAddingCapability?(Object(r["openBlock"])(),Object(r["createElementBlock"])("h2",{key:0,innerHTML:e.$sanitize(e.confirmAddCapabilityToggleContent)},null,8,m)):Object(r["createCommentVNode"])("",!0),e.isAddingCapability?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("h2",{key:1,innerHTML:e.$sanitize(e.confirmCapabilityToggleContent)},null,8,b))]),Object(r["createElementVNode"])("div",p,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.toggleCapability()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[2]||(t[2]=Object(r["withModifiers"])((function(t){e.capabilityToAddOrRemove=null,e.capabilityToAddId=null,e.capabilityToRemoveId=null}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512)],2)}var h=s("a5a2");function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(e,t,s){return t&&O(e.prototype,t),s&&O(e,s),e}function v(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var C=function(){function e(){var t=this;g(this,e),v(this,"privateState",Object(l["reactive"])({isLoading:!1,capabilities:[]})),v(this,"state",Object(l["computed"])((function(){return Object(l["readonly"])(t.privateState)}))),v(this,"capabilities",Object(l["computed"])((function(){return t.state.value.capabilities}))),v(this,"isLoading",Object(l["computed"])((function(){return t.state.value.isLoading}))),v(this,"fetchPromise",void 0),this.fetchCapabilities()}return j(e,[{key:"fetchCapabilities",value:function(){var e=this;return this.fetchPromise||(this.privateState.isLoading=!0,this.fetchPromise=c["AjaxHelper"].fetch({method:"UsersManager.getAvailableCapabilities"}).then((function(t){return e.privateState.capabilities=t,e.capabilities.value})).finally((function(){e.privateState.isLoading=!1}))),this.fetchPromise}}]),e}(),A=Object(c["lazyInitSingleton"])(C),y=window,T=y.$,N=Object(l["defineComponent"])({props:{idsite:[String,Number],siteName:{type:String,required:!0},userLogin:{type:String,required:!0},userRole:{type:String,required:!0},capabilities:Array},components:{Field:f["Field"]},data:function(){return{theCapabilities:this.capabilities||[],isBusy:!1,isAddingCapability:!1,capabilityToAddId:null,capabilityToRemoveId:null,capabilityToAddOrRemove:null}},emits:["change"],watch:{capabilities:function(e){e&&(this.theCapabilities=e)}},created:function(){var e=this;this.capabilities?this.theCapabilities=this.capabilities:(this.isBusy=!0,c["AjaxHelper"].fetch({method:"UsersManager.getUsersPlusRole",limit:"1",filter_search:this.userLogin}).then((function(e){return e&&e.capabilities?e.capabilities:[]})).then((function(t){e.theCapabilities=t})).finally((function(){e.isBusy=!1})))},methods:{onToggleCapability:function(e){var t=this;this.isAddingCapability=e;var i=e?this.capabilityToAddId:this.capabilityToRemoveId;this.capabilityToAddOrRemove=null,this.availableCapabilities.forEach((function(e){e.id===i&&(t.capabilityToAddOrRemove=e)})),this.$refs.confirmCapabilityToggleModal&&T(this.$refs.confirmCapabilityToggleModal).modal({dismissible:!1,yes:function(){return null}}).modal("open")},toggleCapability:function(){this.isAddingCapability?this.addCapability(this.capabilityToAddOrRemove):this.removeCapability(this.capabilityToAddOrRemove)},isIncludedInRole:function(e){return-1!==(e.includedInRoles||[]).indexOf(this.userRole)},getCapabilitiesList:function(){var e=this,t=[];return this.availableCapabilities.forEach((function(i){e.isIncludedInRole(i)||e.capabilitiesSet[i.id]&&t.push(i.id)})),t},addCapability:function(e){var t=this;this.isBusy=!0,c["AjaxHelper"].post({method:"UsersManager.addCapabilities"},{userLogin:this.userLogin,capabilities:e.id,idSites:this.idsite}).then((function(){t.$emit("change",t.getCapabilitiesList())})).finally((function(){t.isBusy=!1,t.capabilityToAddOrRemove=null,t.capabilityToAddId=null,t.capabilityToRemoveId=null}))},removeCapability:function(e){var t=this;this.isBusy=!0,c["AjaxHelper"].post({method:"UsersManager.removeCapabilities"},{userLogin:this.userLogin,capabilities:e.id,idSites:this.idsite}).then((function(){t.$emit("change",t.getCapabilitiesList())})).finally((function(){t.isBusy=!1,t.capabilityToAddOrRemove=null,t.capabilityToAddId=null,t.capabilityToRemoveId=null}))}},computed:{availableCapabilities:function(){return A.capabilities.value},confirmAddCapabilityToggleContent:function(){return Object(c["translate"])("UsersManager_AreYouSureAddCapability","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.capabilityToAddOrRemove?this.capabilityToAddOrRemove.name:"","</strong>"),"<strong>".concat(this.siteNameText,"</strong>"))},confirmCapabilityToggleContent:function(){return Object(c["translate"])("UsersManager_AreYouSureRemoveCapability","<strong>".concat(this.capabilityToAddOrRemove?this.capabilityToAddOrRemove.name:"","</strong>"),"<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.siteNameText,"</strong>"))},siteNameText:function(){return c["Matomo"].helper.htmlEntities(this.siteName)},availableCapabilitiesGrouped:function(){var e=this,t=this.availableCapabilities.filter((function(t){return!e.capabilitiesSet[t.id]})).map((function(e){return{group:e.category,key:e.id,value:e.name,tooltip:e.description}}));return t.sort((function(e,t){return e.group===t.group?e.value===t.value?0:e.value<t.value?-1:1:e.group<t.group?-1:1})),t},capabilitiesSet:function(){var e=this,t={},i=this.theCapabilities;return(i||[]).forEach((function(e){t[e]=!0})),(this.availableCapabilities||[]).forEach((function(i){e.isIncludedInRole(i)&&(t[i.id]=!0)})),t},actualCapabilities:function(){var e=this.capabilitiesSet;return this.availableCapabilities.filter((function(t){return!!e[t.id]}))}}});N.render=h;var E=N,S=(Object(c["createAngularJsAdapter"])({component:E,scope:{idsite:{angularJsBind:"<"},siteName:{angularJsBind:"<"},userLogin:{angularJsBind:"<"},userRole:{angularJsBind:"<"},capabilities:{angularJsBind:"<"},onCapabilitiesChange:{angularJsBind:"&",vue:"change"}},directiveName:"piwikCapabilitiesEdit",restrict:"E",$inject:["$timeout"],events:{change:function(e,t,i,n,s,c,l){l((function(){i.onCapabilitiesChange&&i.onCapabilitiesChange.call({capabilities:e})}))}}}),{key:0,class:"row"}),k={class:"row to-all-websites"},V={class:"col s12"},M={style:{"margin-right":"3.5px"}},L={id:"all-sites-access-select",style:{"margin-right":"3.5px"}},x=Object(l["createElementVNode"])("p",null," ",-1),w={class:"filters row"},B={class:"col s12 m12 l8"},R={class:"input-field bulk-actions",style:{"margin-right":"3.5px"}},_={id:"user-permissions-edit-bulk-actions",class:"dropdown-content"},H={class:"dropdown-trigger","data-target":"user-permissions-bulk-set-access"},D={id:"user-permissions-bulk-set-access",class:"dropdown-content"},U=["onClick"],P={class:"input-field site-filter",style:{"margin-right":"3.5px"}},F=["value","placeholder"],I={class:"input-field access-filter",style:{"margin-right":"3.5px"}},$={key:0,class:"col s12 m12 l4 sites-for-permission-pagination-container"},G={class:"sites-for-permission-pagination"},z={class:"counter"},W=["textContent"],q={class:"roles-help-notification"},J=["innerHTML"],Y={class:"capabilities-help-notification"},K={id:"sitesForPermission"},Q={class:"select-cell"},X={class:"checkbox-container"},Z=["checked"],ee=Object(l["createElementVNode"])("span",null,null,-1),te={class:"role_header"},ie=["innerHTML"],ne=Object(l["createElementVNode"])("span",{class:"icon-help"},null,-1),se=[ne],ce={class:"capabilities_header"},le=["innerHTML"],ae=Object(l["createElementVNode"])("span",{class:"icon-help"},null,-1),oe=[ae],re={key:0,class:"select-all-row"},de={colspan:"4"},ue={key:0},be=["innerHTML"],me=["innerHTML"],pe={key:1},he=["innerHTML"],fe=["innerHTML"],ge={class:"select-cell"},Oe={class:"checkbox-container"},je=["id","onUpdate:modelValue"],ve=Object(l["createElementVNode"])("span",null,null,-1),Ce={class:"role-select"},Ae={class:"delete-access-confirm-modal modal",ref:"deleteAccessConfirmModal"},ye={class:"modal-content"},Te=["innerHTML"],Ne=["innerHTML"],Ee={class:"modal-footer"},Se={class:"change-access-confirm-modal modal",ref:"changeAccessConfirmModal"},ke={class:"modal-content"},Ve=["innerHTML"],Me=["innerHTML"],Le={class:"modal-footer"},xe={class:"confirm-give-access-all-sites modal",ref:"confirmGiveAccessAllSitesModal"},we={class:"modal-content"},Be=["innerHTML"],Re={class:"modal-footer"}; + */var C=function(){function e(){var t=this;g(this,e),v(this,"privateState",Object(r["reactive"])({isLoading:!1,capabilities:[]})),v(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),v(this,"capabilities",Object(r["computed"])((function(){return t.state.value.capabilities}))),v(this,"isLoading",Object(r["computed"])((function(){return t.state.value.isLoading}))),v(this,"fetchPromise",void 0),this.fetchCapabilities()}return j(e,[{key:"fetchCapabilities",value:function(){var e=this;return this.fetchPromise||(this.privateState.isLoading=!0,this.fetchPromise=a["AjaxHelper"].fetch({method:"UsersManager.getAvailableCapabilities"}).then((function(t){return e.privateState.capabilities=t,e.capabilities.value})).finally((function(){e.privateState.isLoading=!1}))),this.fetchPromise}}]),e}(),A=Object(a["lazyInitSingleton"])(C),y=window,S=y.$,N=Object(r["defineComponent"])({props:{idsite:[String,Number],siteName:{type:String,required:!0},userLogin:{type:String,required:!0},userRole:{type:String,required:!0},capabilities:Array},components:{Field:h["Field"]},data:function(){return{theCapabilities:this.capabilities||[],isBusy:!1,isAddingCapability:!1,capabilityToAddId:null,capabilityToRemoveId:null,capabilityToAddOrRemove:null}},emits:["change"],watch:{capabilities:function(e){e&&(this.theCapabilities=e)}},created:function(){var e=this;this.capabilities?this.theCapabilities=this.capabilities:(this.isBusy=!0,a["AjaxHelper"].fetch({method:"UsersManager.getUsersPlusRole",limit:"1",filter_search:this.userLogin}).then((function(e){return e&&e.capabilities?e.capabilities:[]})).then((function(t){e.theCapabilities=t})).finally((function(){e.isBusy=!1})))},methods:{onToggleCapability:function(e){var t=this;this.isAddingCapability=e;var s=e?this.capabilityToAddId:this.capabilityToRemoveId;this.capabilityToAddOrRemove=null,this.availableCapabilities.forEach((function(e){e.id===s&&(t.capabilityToAddOrRemove=e)})),this.$refs.confirmCapabilityToggleModal&&S(this.$refs.confirmCapabilityToggleModal).modal({dismissible:!1,yes:function(){return null}}).modal("open")},toggleCapability:function(){this.isAddingCapability?this.addCapability(this.capabilityToAddOrRemove):this.removeCapability(this.capabilityToAddOrRemove)},isIncludedInRole:function(e){return-1!==(e.includedInRoles||[]).indexOf(this.userRole)},getCapabilitiesList:function(){var e=this,t=[];return this.availableCapabilities.forEach((function(s){e.isIncludedInRole(s)||e.capabilitiesSet[s.id]&&t.push(s.id)})),t},addCapability:function(e){var t=this;this.isBusy=!0,a["AjaxHelper"].post({method:"UsersManager.addCapabilities"},{userLogin:this.userLogin,capabilities:e.id,idSites:this.idsite}).then((function(){t.$emit("change",t.getCapabilitiesList())})).finally((function(){t.isBusy=!1,t.capabilityToAddOrRemove=null,t.capabilityToAddId=null,t.capabilityToRemoveId=null}))},removeCapability:function(e){var t=this;this.isBusy=!0,a["AjaxHelper"].post({method:"UsersManager.removeCapabilities"},{userLogin:this.userLogin,capabilities:e.id,idSites:this.idsite}).then((function(){t.$emit("change",t.getCapabilitiesList())})).finally((function(){t.isBusy=!1,t.capabilityToAddOrRemove=null,t.capabilityToAddId=null,t.capabilityToRemoveId=null}))}},computed:{availableCapabilities:function(){return A.capabilities.value},confirmAddCapabilityToggleContent:function(){return Object(a["translate"])("UsersManager_AreYouSureAddCapability","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.capabilityToAddOrRemove?this.capabilityToAddOrRemove.name:"","</strong>"),"<strong>".concat(this.siteNameText,"</strong>"))},confirmCapabilityToggleContent:function(){return Object(a["translate"])("UsersManager_AreYouSureRemoveCapability","<strong>".concat(this.capabilityToAddOrRemove?this.capabilityToAddOrRemove.name:"","</strong>"),"<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.siteNameText,"</strong>"))},siteNameText:function(){return a["Matomo"].helper.htmlEntities(this.siteName)},availableCapabilitiesGrouped:function(){var e=this,t=this.availableCapabilities.filter((function(t){return!e.capabilitiesSet[t.id]})).map((function(e){return{group:e.category,key:e.id,value:e.name,tooltip:e.description}}));return t.sort((function(e,t){return e.group===t.group?e.value===t.value?0:e.value<t.value?-1:1:e.group<t.group?-1:1})),t},capabilitiesSet:function(){var e=this,t={},s=this.theCapabilities;return(s||[]).forEach((function(e){t[e]=!0})),(this.availableCapabilities||[]).forEach((function(s){e.isIncludedInRole(s)&&(t[s.id]=!0)})),t},actualCapabilities:function(){var e=this.capabilitiesSet;return this.availableCapabilities.filter((function(t){return!!e[t.id]}))}}});N.render=f;var V=N,E=(Object(a["createAngularJsAdapter"])({component:V,scope:{idsite:{angularJsBind:"<"},siteName:{angularJsBind:"<"},userLogin:{angularJsBind:"<"},userRole:{angularJsBind:"<"},capabilities:{angularJsBind:"<"},onCapabilitiesChange:{angularJsBind:"&",vue:"change"}},directiveName:"piwikCapabilitiesEdit",restrict:"E",$inject:["$timeout"],events:{change:function(e,t,s,n,i,a,r){r((function(){s.onCapabilitiesChange&&s.onCapabilitiesChange.call({capabilities:e})}))}}}),{key:0,class:"row"}),k={class:"row to-all-websites"},U={class:"col s12"},w={style:{"margin-right":"3.5px"}},T={id:"all-sites-access-select",style:{"margin-right":"3.5px"}},M=Object(r["createElementVNode"])("p",null," ",-1),B={class:"filters row"},_={class:"col s12 m12 l8"},L={class:"input-field bulk-actions",style:{"margin-right":"3.5px"}},x={id:"user-permissions-edit-bulk-actions",class:"dropdown-content"},R={class:"dropdown-trigger","data-target":"user-permissions-bulk-set-access"},D={id:"user-permissions-bulk-set-access",class:"dropdown-content"},P=["onClick"],H={class:"input-field site-filter",style:{"margin-right":"3.5px"}},F=["value","placeholder"],I={class:"input-field access-filter",style:{"margin-right":"3.5px"}},G={key:0,class:"col s12 m12 l4 sites-for-permission-pagination-container"},$={class:"sites-for-permission-pagination"},z={class:"counter"},J=["textContent"],W={class:"roles-help-notification"},q=["innerHTML"],Y={class:"capabilities-help-notification"},X={id:"sitesForPermission"},K={class:"select-cell"},Q={class:"checkbox-container"},Z=["checked"],ee=Object(r["createElementVNode"])("span",null,null,-1),te={class:"role_header"},se=["innerHTML"],ne=Object(r["createElementVNode"])("span",{class:"icon-help"},null,-1),ie=[ne],ae={class:"capabilities_header"},re=["innerHTML"],oe=Object(r["createElementVNode"])("span",{class:"icon-help"},null,-1),ce=[oe],le={key:0,class:"select-all-row"},de={colspan:"4"},ue={key:0},me=["innerHTML"],be=["innerHTML"],pe={key:1},fe=["innerHTML"],he=["innerHTML"],ge={class:"select-cell"},Oe={class:"checkbox-container"},je=["id","onUpdate:modelValue"],ve=Object(r["createElementVNode"])("span",null,null,-1),Ce={class:"role-select"},Ae={class:"delete-access-confirm-modal modal",ref:"deleteAccessConfirmModal"},ye={class:"modal-content"},Se=["innerHTML"],Ne=["innerHTML"],Ve={class:"modal-footer"},Ee={class:"change-access-confirm-modal modal",ref:"changeAccessConfirmModal"},ke={class:"modal-content"},Ue=["innerHTML"],we=["innerHTML"],Te={class:"modal-footer"},Me={class:"confirm-give-access-all-sites modal",ref:"confirmGiveAccessAllSitesModal"},Be={class:"modal-content"},_e=["innerHTML"],Le={class:"modal-footer"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function _e(e,t,i,n,s,c){var a=Object(l["resolveComponent"])("Notification"),o=Object(l["resolveComponent"])("Field"),r=Object(l["resolveComponent"])("CapabilitiesEdit"),d=Object(l["resolveDirective"])("dropdown-menu"),u=Object(l["resolveDirective"])("content-table");return Object(l["openBlock"])(),Object(l["createElementBlock"])("div",{class:Object(l["normalizeClass"])(["userPermissionsEdit",{loading:e.isLoadingAccess}])},[e.hasAccessToAtLeastOneSite?Object(l["createCommentVNode"])("",!0):(Object(l["openBlock"])(),Object(l["createElementBlock"])("div",S,[Object(l["createElementVNode"])("div",null,[Object(l["createVNode"])(a,{context:"warning",type:"transient",noclear:!0},{default:Object(l["withCtx"])((function(){return[Object(l["createElementVNode"])("strong",null,Object(l["toDisplayString"])(e.translate("General_Warning"))+":",1),Object(l["createTextVNode"])(" "+Object(l["toDisplayString"])(e.translate("UsersManager_NoAccessWarning")),1)]})),_:1})])])),Object(l["createElementVNode"])("div",k,[Object(l["createElementVNode"])("div",V,[Object(l["createElementVNode"])("div",null,[Object(l["createElementVNode"])("span",M,Object(l["toDisplayString"])(e.translate("UsersManager_GiveAccessToAll"))+":",1),Object(l["createElementVNode"])("div",L,[Object(l["createVNode"])(o,{modelValue:e.allWebsitesAccssLevelSet,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.allWebsitesAccssLevelSet=t}),uicontrol:"select",options:e.filteredAccessLevels,"full-width":!0},null,8,["modelValue","options"])]),Object(l["createElementVNode"])("a",{href:"",class:Object(l["normalizeClass"])(["btn",{disabled:e.isGivingAccessToAllSites}]),onClick:t[1]||(t[1]=Object(l["withModifiers"])((function(t){return e.showChangeAccessAllSitesModal()}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_Apply")),3)]),x,Object(l["createElementVNode"])("p",null,Object(l["toDisplayString"])(e.translate("UsersManager_OrManageIndividually"))+":",1)])]),Object(l["createElementVNode"])("div",w,[Object(l["createElementVNode"])("div",B,[Object(l["createElementVNode"])("div",R,[Object(l["withDirectives"])(Object(l["createElementVNode"])("a",{class:Object(l["normalizeClass"])(["dropdown-trigger btn",{disabled:e.isBulkActionsDisabled}]),href:"","data-target":"user-permissions-edit-bulk-actions"},[Object(l["createTextVNode"])(Object(l["toDisplayString"])(e.translate("UsersManager_BulkActions")),1)],2),[[d,{activates:"#user-permissions-edit-bulk-actions"}]]),Object(l["createElementVNode"])("ul",_,[Object(l["createElementVNode"])("li",null,[Object(l["withDirectives"])(Object(l["createElementVNode"])("a",H,[Object(l["createTextVNode"])(Object(l["toDisplayString"])(e.translate("UsersManager_SetPermission")),1)],512),[[d,{activates:"#user-permissions-bulk-set-access"}]]),Object(l["createElementVNode"])("ul",D,[(Object(l["openBlock"])(!0),Object(l["createElementBlock"])(l["Fragment"],null,Object(l["renderList"])(e.filteredAccessLevels,(function(t){return Object(l["openBlock"])(),Object(l["createElementBlock"])("li",{key:t.key},[Object(l["createElementVNode"])("a",{href:"",onClick:Object(l["withModifiers"])((function(i){e.siteAccessToChange=null,e.roleToChangeTo=t.key,e.showChangeAccessConfirm()}),["prevent"])},Object(l["toDisplayString"])(t.value),9,U)])})),128))])]),Object(l["createElementVNode"])("li",null,[Object(l["createElementVNode"])("a",{href:"",onClick:t[2]||(t[2]=Object(l["withModifiers"])((function(t){e.siteAccessToChange=null,e.roleToChangeTo="noaccess",e.showRemoveAccessConfirm()}),["prevent"]))},Object(l["toDisplayString"])(e.translate("UsersManager_RemovePermissions")),1)])])]),Object(l["createElementVNode"])("div",P,[Object(l["createElementVNode"])("input",{type:"text",value:e.siteNameFilter,onKeydown:t[3]||(t[3]=function(t){e.onChangeSiteFilter(t)}),onChange:t[4]||(t[4]=function(t){e.onChangeSiteFilter(t)}),placeholder:e.translate("UsersManager_FilterByWebsite")},null,40,F)]),Object(l["createElementVNode"])("div",I,[Object(l["createElementVNode"])("div",null,[Object(l["createVNode"])(o,{modelValue:e.accessLevelFilter,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.accessLevelFilter=t}),uicontrol:"select",options:e.filteredSelectAccessLevels,"full-width":!0,placeholder:e.translate("UsersManager_FilterByAccess")},null,8,["modelValue","options","placeholder"])])])]),e.totalEntries>e.limit?(Object(l["openBlock"])(),Object(l["createElementBlock"])("div",$,[Object(l["createElementVNode"])("div",G,[Object(l["createElementVNode"])("a",{class:Object(l["normalizeClass"])(["prev",{disabled:e.offset<=0}])},[Object(l["createElementVNode"])("span",{class:"pointer",onClick:t[6]||(t[6]=function(t){return e.gotoPreviousPage()})},"« "+Object(l["toDisplayString"])(e.translate("General_Previous")),1)],2),Object(l["createElementVNode"])("span",z,[Object(l["createElementVNode"])("span",{textContent:Object(l["toDisplayString"])(e.paginationText)},null,8,W)]),Object(l["createElementVNode"])("a",{class:Object(l["normalizeClass"])(["next",{disabled:e.offset+e.limit>=e.totalEntries}])},[Object(l["createElementVNode"])("span",{class:"pointer",onClick:t[7]||(t[7]=function(t){return e.gotoNextPage()})},Object(l["toDisplayString"])(e.translate("General_Next"))+" »",1)],2)])])):Object(l["createCommentVNode"])("",!0)]),Object(l["createElementVNode"])("div",q,[e.isRoleHelpToggled?(Object(l["openBlock"])(),Object(l["createBlock"])(a,{key:0,context:"info",type:"persistent",noclear:!0},{default:Object(l["withCtx"])((function(){return[Object(l["createElementVNode"])("span",{innerHTML:e.$sanitize(e.rolesHelpText)},null,8,J)]})),_:1})):Object(l["createCommentVNode"])("",!0)]),Object(l["createElementVNode"])("div",Y,[e.isCapabilitiesHelpToggled?(Object(l["openBlock"])(),Object(l["createBlock"])(a,{key:0,context:"info",type:"persistent",noclear:!0},{default:Object(l["withCtx"])((function(){return[Object(l["createElementVNode"])("span",null,Object(l["toDisplayString"])(e.translate("UsersManager_CapabilitiesHelp")),1)]})),_:1})):Object(l["createCommentVNode"])("",!0)]),Object(l["withDirectives"])(Object(l["createElementVNode"])("table",K,[Object(l["createElementVNode"])("thead",null,[Object(l["createElementVNode"])("tr",null,[Object(l["createElementVNode"])("th",Q,[Object(l["createElementVNode"])("span",X,[Object(l["createElementVNode"])("label",null,[Object(l["createElementVNode"])("input",{type:"checkbox",id:"perm_edit_select_all",checked:e.isAllCheckboxSelected,onChange:t[8]||(t[8]=function(t){return e.onAllCheckboxChange(t)})},null,40,Z),ee])])]),Object(l["createElementVNode"])("th",null,Object(l["toDisplayString"])(e.translate("General_Name")),1),Object(l["createElementVNode"])("th",te,[Object(l["createElementVNode"])("span",{innerHTML:"".concat(e.translate("UsersManager_Role")," ")},null,8,ie),Object(l["createElementVNode"])("a",{href:"",class:Object(l["normalizeClass"])(["helpIcon",{sticky:e.isRoleHelpToggled}]),onClick:t[9]||(t[9]=Object(l["withModifiers"])((function(t){return e.isRoleHelpToggled=!e.isRoleHelpToggled}),["prevent"]))},se,2)]),Object(l["createElementVNode"])("th",ce,[Object(l["createElementVNode"])("span",{innerHTML:"".concat(e.translate("UsersManager_Capabilities")," ")},null,8,le),Object(l["createElementVNode"])("a",{href:"",class:Object(l["normalizeClass"])(["helpIcon",{sticky:e.isCapabilitiesHelpToggled}]),onClick:t[10]||(t[10]=Object(l["withModifiers"])((function(t){return e.isCapabilitiesHelpToggled=!e.isCapabilitiesHelpToggled}),["prevent"]))},oe,2)])])]),Object(l["createElementVNode"])("tbody",null,[e.isAllCheckboxSelected&&e.siteAccess.length<e.totalEntries?(Object(l["openBlock"])(),Object(l["createElementBlock"])("tr",re,[Object(l["createElementVNode"])("td",de,[e.areAllResultsSelected?Object(l["createCommentVNode"])("",!0):(Object(l["openBlock"])(),Object(l["createElementBlock"])("div",ue,[Object(l["createElementVNode"])("span",{innerHTML:e.$sanitize(e.theDisplayedWebsitesAreSelectedText),style:{"margin-right":"3.5px"}},null,8,be),Object(l["createElementVNode"])("a",{href:"#",onClick:t[11]||(t[11]=Object(l["withModifiers"])((function(t){return e.areAllResultsSelected=!e.areAllResultsSelected}),["prevent"])),innerHTML:e.$sanitize(e.clickToSelectAllText)},null,8,me)])),e.areAllResultsSelected?(Object(l["openBlock"])(),Object(l["createElementBlock"])("div",pe,[Object(l["createElementVNode"])("span",{innerHTML:e.$sanitize(e.allWebsitesAreSelectedText),style:{"margin-right":"3.5px"}},null,8,he),Object(l["createElementVNode"])("a",{href:"#",onClick:t[12]||(t[12]=Object(l["withModifiers"])((function(t){return e.areAllResultsSelected=!e.areAllResultsSelected}),["prevent"])),innerHTML:e.$sanitize(e.clickToSelectDisplayedWebsitesText)},null,8,fe)])):Object(l["createCommentVNode"])("",!0)])])):Object(l["createCommentVNode"])("",!0),(Object(l["openBlock"])(!0),Object(l["createElementBlock"])(l["Fragment"],null,Object(l["renderList"])(e.siteAccess,(function(i,n){return Object(l["openBlock"])(),Object(l["createElementBlock"])("tr",{key:i.idsite},[Object(l["createElementVNode"])("td",ge,[Object(l["createElementVNode"])("span",Oe,[Object(l["createElementVNode"])("label",null,[Object(l["withDirectives"])(Object(l["createElementVNode"])("input",{type:"checkbox",id:"perm_edit_select_row".concat(n),"onUpdate:modelValue":function(t){return e.selectedRows[n]=t},onClick:t[13]||(t[13]=function(t){return e.onRowSelected()})},null,8,je),[[l["vModelCheckbox"],e.selectedRows[n]]]),ve])])]),Object(l["createElementVNode"])("td",null,[Object(l["createElementVNode"])("span",null,Object(l["toDisplayString"])(i.site_name),1)]),Object(l["createElementVNode"])("td",null,[Object(l["createElementVNode"])("div",Ce,[Object(l["createVNode"])(o,{"model-value":i.role,"onUpdate:modelValue":function(t){e.onRoleChange(i,t)},uicontrol:"select",options:e.filteredAccessLevels,"full-width":!0},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(l["createElementVNode"])("td",null,[Object(l["createElementVNode"])("div",null,[Object(l["createVNode"])(r,{idsite:i.idsite,"site-name":i.site_name,"user-login":e.userLogin,"user-role":i.role,capabilities:i.capabilities,onChange:t[14]||(t[14]=function(t){return e.fetchAccess()})},null,8,["idsite","site-name","user-login","user-role","capabilities"])])])])})),128))])],512),[[u]]),Object(l["createElementVNode"])("div",Ae,[Object(l["createElementVNode"])("div",ye,[e.siteAccessToChange?(Object(l["openBlock"])(),Object(l["createElementBlock"])("h3",{key:0,innerHTML:e.$sanitize(e.deletePermConfirmSingleText)},null,8,Te)):Object(l["createCommentVNode"])("",!0),e.siteAccessToChange?Object(l["createCommentVNode"])("",!0):(Object(l["openBlock"])(),Object(l["createElementBlock"])("p",{key:1,innerHTML:e.$sanitize(e.deletePermConfirmMultipleText)},null,8,Ne))]),Object(l["createElementVNode"])("div",Ee,[Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[15]||(t[15]=Object(l["withModifiers"])((function(t){return e.changeUserRole()}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_Yes")),1),Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[16]||(t[16]=Object(l["withModifiers"])((function(t){e.siteAccessToChange=null,e.roleToChangeTo=null}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_No")),1)])],512),Object(l["createElementVNode"])("div",Se,[Object(l["createElementVNode"])("div",ke,[e.siteAccessToChange?(Object(l["openBlock"])(),Object(l["createElementBlock"])("h3",{key:0,innerHTML:e.$sanitize(e.changePermToSiteConfirmSingleText)},null,8,Ve)):Object(l["createCommentVNode"])("",!0),e.siteAccessToChange?Object(l["createCommentVNode"])("",!0):(Object(l["openBlock"])(),Object(l["createElementBlock"])("p",{key:1,innerHTML:e.$sanitize(e.changePermToSiteConfirmMultipleText)},null,8,Me))]),Object(l["createElementVNode"])("div",Le,[Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[17]||(t[17]=Object(l["withModifiers"])((function(t){return e.changeUserRole()}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_Yes")),1),Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[18]||(t[18]=Object(l["withModifiers"])((function(t){e.siteAccessToChange.role=e.previousRole,e.siteAccessToChange=null,e.roleToChangeTo=null}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_No")),1)])],512),Object(l["createElementVNode"])("div",xe,[Object(l["createElementVNode"])("div",we,[Object(l["createElementVNode"])("h3",{innerHTML:e.$sanitize(e.changePermToAllSitesConfirmText)},null,8,Be),Object(l["createElementVNode"])("p",null,Object(l["toDisplayString"])(e.translate("UsersManager_ChangePermToAllSitesConfirm2")),1)]),Object(l["createElementVNode"])("div",Re,[Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[19]||(t[19]=Object(l["withModifiers"])((function(t){return e.giveAccessToAllSites()}),["prevent"]))},Object(l["toDisplayString"])(e.translate("General_Yes")),1),Object(l["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[20]||(t[20]=function(e){return e.preventDefault()})},Object(l["toDisplayString"])(e.translate("General_No")),1)])],512)],2)}var He=window,De=He.$,Ue=Object(l["defineComponent"])({props:{userLogin:{type:String,required:!0},limit:{type:Number,default:10},accessLevels:{type:Array,required:!0},filterAccessLevels:{type:Array,required:!0}},components:{Notification:c["Notification"],Field:f["Field"],CapabilitiesEdit:E},directives:{DropdownMenu:c["DropdownMenu"],ContentTable:c["ContentTable"]},data:function(){return{siteAccess:[],offset:0,totalEntries:null,accessLevelFilter:"",siteNameFilter:"",isLoadingAccess:!1,allWebsitesAccssLevelSet:"view",isAllCheckboxSelected:!1,selectedRows:{},isBulkActionsDisabled:!0,areAllResultsSelected:!1,previousRole:null,hasAccessToAtLeastOneSite:!0,isRoleHelpToggled:!1,isCapabilitiesHelpToggled:!1,isGivingAccessToAllSites:!1,roleToChangeTo:null,siteAccessToChange:null}},emits:["userHasAccessDetected","accessChanged"],created:function(){var e=this;this.onChangeSiteFilter=Object(c["debounce"])(this.onChangeSiteFilter,300),Object(l["watch"])((function(){return e.allPropsWatch}),(function(){e.limit&&e.fetchAccess()})),this.fetchAccess()},watch:{accessLevelFilter:function(){this.offset=0,this.fetchAccess()}},methods:{onAllCheckboxChange:function(e){var t=this;this.isAllCheckboxSelected=e.target.checked,this.isAllCheckboxSelected?(this.siteAccess.forEach((function(e,i){t.selectedRows[i]=!0})),this.isBulkActionsDisabled=!1):this.clearSelection()},clearSelection:function(){this.selectedRows={},this.areAllResultsSelected=!1,this.isBulkActionsDisabled=!0,this.isAllCheckboxSelected=!1,this.siteAccessToChange=null},onRowSelected:function(){var e=this;setTimeout((function(){var t=e.selectedRowsCount;e.isBulkActionsDisabled=0===t,e.isAllCheckboxSelected=t===e.siteAccess.length}))},fetchAccess:function(){var e=this;return this.isLoadingAccess=!0,c["AjaxHelper"].fetch({method:"UsersManager.getSitesAccessForUser",limit:this.limit,offset:this.offset,filter_search:this.siteNameFilter,filter_access:this.accessLevelFilter,userLogin:this.userLogin},{returnResponseObject:!0}).then((function(t){var i=t.getRequestHandle();e.isLoadingAccess=!1,e.siteAccess=i.responseJSON,e.totalEntries=parseInt(i.getResponseHeader("x-matomo-total-results"),10)||0,e.hasAccessToAtLeastOneSite=!!i.getResponseHeader("x-matomo-has-some"),e.$emit("userHasAccessDetected",{hasAccess:e.hasAccessToAtLeastOneSite}),e.clearSelection()})).catch((function(){e.isLoadingAccess=!1,e.clearSelection()}))},gotoPreviousPage:function(){this.offset=Math.max(0,this.offset-this.limit),this.fetchAccess()},gotoNextPage:function(){var e=this.offset+this.limit;e>=(this.totalEntries||0)||(this.offset=e,this.fetchAccess())},showRemoveAccessConfirm:function(){De(this.$refs.deleteAccessConfirmModal).modal({dismissible:!1}).modal("open")},changeUserRole:function(){var e=this,t=function(){var t=[];return Object.keys(e.selectedRows).forEach((function(i){e.selectedRows[i]&&e.siteAccess[i]&&t.push(e.siteAccess[i].idsite)})),t},i=function(){return c["AjaxHelper"].fetch({method:"UsersManager.getSitesAccessForUser",filter_search:e.siteNameFilter,filter_access:e.accessLevelFilter,userLogin:e.userLogin,filter_limit:"-1"}).then((function(e){return e.map((function(e){return e.idsite}))}))};return this.isLoadingAccess=!0,Promise.resolve().then((function(){return e.siteAccessToChange?[e.siteAccessToChange.idsite]:e.areAllResultsSelected?i():t()})).then((function(t){return c["AjaxHelper"].post({method:"UsersManager.setUserAccess"},{userLogin:e.userLogin,access:e.roleToChangeTo,idSites:t})})).catch((function(){})).then((function(){return e.$emit("accessChanged"),e.fetchAccess()}))},showChangeAccessConfirm:function(){De(this.$refs.changeAccessConfirmModal).modal({dismissible:!1}).modal("open")},getRoleDisplay:function(e){var t=null;return this.filteredAccessLevels.forEach((function(i){i.key===e&&(t=i.value)})),t},giveAccessToAllSites:function(){var e=this;this.isGivingAccessToAllSites=!0,c["AjaxHelper"].fetch({method:"SitesManager.getSitesWithAdminAccess"}).then((function(t){var i=t.map((function(e){return e.idsite}));return c["AjaxHelper"].post({method:"UsersManager.setUserAccess"},{userLogin:e.userLogin,access:e.allWebsitesAccssLevelSet,idSites:i})})).then((function(){return e.fetchAccess()})).finally((function(){e.isGivingAccessToAllSites=!1}))},showChangeAccessAllSitesModal:function(){De(this.$refs.confirmGiveAccessAllSitesModal).modal({dismissible:!1}).modal("open")},onChangeSiteFilter:function(e){var t=this;setTimeout((function(){var i=e.target.value;t.siteNameFilter!==i&&(t.siteNameFilter=i,t.offset=0,t.fetchAccess())}))},onRoleChange:function(e,t){this.previousRole=e.role,this.roleToChangeTo=t,this.siteAccessToChange=e,this.showChangeAccessConfirm()}},computed:{rolesHelpText:function(){return Object(c["translate"])("UsersManager_RolesHelp",'<a href="https://matomo.org/faq/general/faq_70/" target="_blank" rel="noreferrer noopener">',"</a>",'<a href="https://matomo.org/faq/general/faq_69/" target="_blank" rel="noreferrer noopener">',"</a>")},theDisplayedWebsitesAreSelectedText:function(){var e=Object(c["translate"])("UsersManager_TheDisplayedWebsitesAreSelected","<strong>".concat(this.siteAccess.length,"</strong>"));return"".concat(e," ")},clickToSelectAllText:function(){return Object(c["translate"])("UsersManager_ClickToSelectAll","<strong>".concat(this.totalEntries,"</strong>"))},allWebsitesAreSelectedText:function(){return Object(c["translate"])("UsersManager_AllWebsitesAreSelected","<strong>".concat(this.totalEntries,"</strong>"))},clickToSelectDisplayedWebsitesText:function(){return Object(c["translate"])("UsersManager_ClickToSelectDisplayedWebsites","<strong>".concat(this.siteAccess.length,"</strong>"))},deletePermConfirmSingleText:function(){return Object(c["translate"])("UsersManager_DeletePermConfirmSingle","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.siteAccessToChangeName,"</strong>"))},deletePermConfirmMultipleText:function(){return Object(c["translate"])("UsersManager_DeletePermConfirmMultiple","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.affectedSitesCount,"</strong>"))},changePermToSiteConfirmSingleText:function(){return Object(c["translate"])("UsersManager_ChangePermToSiteConfirmSingle","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.siteAccessToChangeName,"</strong>"),"<strong>".concat(this.getRoleDisplay(this.roleToChangeTo),"</strong>"))},changePermToSiteConfirmMultipleText:function(){return Object(c["translate"])("UsersManager_ChangePermToSiteConfirmMultiple","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.affectedSitesCount,"</strong>"),"<strong>".concat(this.getRoleDisplay(this.roleToChangeTo),"</strong>"))},changePermToAllSitesConfirmText:function(){return Object(c["translate"])("UsersManager_ChangePermToAllSitesConfirm","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.getRoleDisplay(this.allWebsitesAccssLevelSet),"</strong>"))},paginationLowerBound:function(){return this.offset+1},paginationUpperBound:function(){return this.totalEntries?Math.min(this.offset+this.limit,this.totalEntries):"?"},filteredAccessLevels:function(){return this.accessLevels.filter((function(e){return"superuser"!==e.key}))},filteredSelectAccessLevels:function(){return this.filterAccessLevels.filter((function(e){return"superuser"!==e.key}))},selectedRowsCount:function(){var e=0;return Object.values(this.selectedRows).forEach((function(t){t&&(e+=1)})),e},affectedSitesCount:function(){return this.areAllResultsSelected?this.totalEntries:this.selectedRowsCount},allPropsWatch:function(){return this.userLogin,this.limit,this.accessLevels,this.filterAccessLevels,Date.now()},siteAccessToChangeName:function(){return this.siteAccessToChange?c["Matomo"].helper.htmlEntities(this.siteAccessToChange.site_name):""},paginationText:function(){var e=Object(c["translate"])("General_Pagination","".concat(this.paginationLowerBound),"".concat(this.paginationUpperBound),"".concat(this.totalEntries));return" ".concat(e," ")}}});Ue.render=_e;var Pe=Ue; + */function xe(e,t,s,n,i,a){var o=Object(r["resolveComponent"])("Notification"),c=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("CapabilitiesEdit"),d=Object(r["resolveDirective"])("dropdown-menu"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["userPermissionsEdit",{loading:e.isLoadingAccess}])},[e.hasAccessToAtLeastOneSite?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",E,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{context:"warning",type:"transient",noclear:!0},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("General_Warning"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("UsersManager_NoAccessWarning")),1)]})),_:1})])])),Object(r["createElementVNode"])("div",k,[Object(r["createElementVNode"])("div",U,[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("span",w,Object(r["toDisplayString"])(e.translate("UsersManager_GiveAccessToAll"))+":",1),Object(r["createElementVNode"])("div",T,[Object(r["createVNode"])(c,{modelValue:e.allWebsitesAccssLevelSet,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.allWebsitesAccssLevelSet=t}),uicontrol:"select",options:e.filteredAccessLevels,"full-width":!0},null,8,["modelValue","options"])]),Object(r["createElementVNode"])("a",{href:"",class:Object(r["normalizeClass"])(["btn",{disabled:e.isGivingAccessToAllSites}]),onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.showChangeAccessAllSitesModal()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_Apply")),3)]),M,Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("UsersManager_OrManageIndividually"))+":",1)])]),Object(r["createElementVNode"])("div",B,[Object(r["createElementVNode"])("div",_,[Object(r["createElementVNode"])("div",L,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:Object(r["normalizeClass"])(["dropdown-trigger btn",{disabled:e.isBulkActionsDisabled}]),href:"","data-target":"user-permissions-edit-bulk-actions"},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("UsersManager_BulkActions")),1)],2),[[d,{activates:"#user-permissions-edit-bulk-actions"}]]),Object(r["createElementVNode"])("ul",x,[Object(r["createElementVNode"])("li",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",R,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("UsersManager_SetPermission")),1)],512),[[d,{activates:"#user-permissions-bulk-set-access"}]]),Object(r["createElementVNode"])("ul",D,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.filteredAccessLevels,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t.key},[Object(r["createElementVNode"])("a",{href:"",onClick:Object(r["withModifiers"])((function(s){e.siteAccessToChange=null,e.roleToChangeTo=t.key,e.showChangeAccessConfirm()}),["prevent"])},Object(r["toDisplayString"])(t.value),9,P)])})),128))])]),Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("a",{href:"",onClick:t[2]||(t[2]=Object(r["withModifiers"])((function(t){e.siteAccessToChange=null,e.roleToChangeTo="noaccess",e.showRemoveAccessConfirm()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("UsersManager_RemovePermissions")),1)])])]),Object(r["createElementVNode"])("div",H,[Object(r["createElementVNode"])("input",{type:"text",value:e.siteNameFilter,onKeydown:t[3]||(t[3]=function(t){e.onChangeSiteFilter(t)}),onChange:t[4]||(t[4]=function(t){e.onChangeSiteFilter(t)}),placeholder:e.translate("UsersManager_FilterByWebsite")},null,40,F)]),Object(r["createElementVNode"])("div",I,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{modelValue:e.accessLevelFilter,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.accessLevelFilter=t}),uicontrol:"select",options:e.filteredSelectAccessLevels,"full-width":!0,placeholder:e.translate("UsersManager_FilterByAccess")},null,8,["modelValue","options","placeholder"])])])]),e.totalEntries>e.limit?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",G,[Object(r["createElementVNode"])("div",$,[Object(r["createElementVNode"])("a",{class:Object(r["normalizeClass"])(["prev",{disabled:e.offset<=0}])},[Object(r["createElementVNode"])("span",{class:"pointer",onClick:t[6]||(t[6]=function(t){return e.gotoPreviousPage()})},"« "+Object(r["toDisplayString"])(e.translate("General_Previous")),1)],2),Object(r["createElementVNode"])("span",z,[Object(r["createElementVNode"])("span",{textContent:Object(r["toDisplayString"])(e.paginationText)},null,8,J)]),Object(r["createElementVNode"])("a",{class:Object(r["normalizeClass"])(["next",{disabled:e.offset+e.limit>=e.totalEntries}])},[Object(r["createElementVNode"])("span",{class:"pointer",onClick:t[7]||(t[7]=function(t){return e.gotoNextPage()})},Object(r["toDisplayString"])(e.translate("General_Next"))+" »",1)],2)])])):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",W,[e.isRoleHelpToggled?(Object(r["openBlock"])(),Object(r["createBlock"])(o,{key:0,context:"info",type:"persistent",noclear:!0},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.rolesHelpText)},null,8,q)]})),_:1})):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",Y,[e.isCapabilitiesHelpToggled?(Object(r["openBlock"])(),Object(r["createBlock"])(o,{key:0,context:"info",type:"persistent",noclear:!0},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(e.translate("UsersManager_CapabilitiesHelp")),1)]})),_:1})):Object(r["createCommentVNode"])("",!0)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",X,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",K,[Object(r["createElementVNode"])("span",Q,[Object(r["createElementVNode"])("label",null,[Object(r["createElementVNode"])("input",{type:"checkbox",id:"perm_edit_select_all",checked:e.isAllCheckboxSelected,onChange:t[8]||(t[8]=function(t){return e.onAllCheckboxChange(t)})},null,40,Z),ee])])]),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",te,[Object(r["createElementVNode"])("span",{innerHTML:"".concat(e.translate("UsersManager_Role")," ")},null,8,se),Object(r["createElementVNode"])("a",{href:"",class:Object(r["normalizeClass"])(["helpIcon",{sticky:e.isRoleHelpToggled}]),onClick:t[9]||(t[9]=Object(r["withModifiers"])((function(t){return e.isRoleHelpToggled=!e.isRoleHelpToggled}),["prevent"]))},ie,2)]),Object(r["createElementVNode"])("th",ae,[Object(r["createElementVNode"])("span",{innerHTML:"".concat(e.translate("UsersManager_Capabilities")," ")},null,8,re),Object(r["createElementVNode"])("a",{href:"",class:Object(r["normalizeClass"])(["helpIcon",{sticky:e.isCapabilitiesHelpToggled}]),onClick:t[10]||(t[10]=Object(r["withModifiers"])((function(t){return e.isCapabilitiesHelpToggled=!e.isCapabilitiesHelpToggled}),["prevent"]))},ce,2)])])]),Object(r["createElementVNode"])("tbody",null,[e.isAllCheckboxSelected&&e.siteAccess.length<e.totalEntries?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",le,[Object(r["createElementVNode"])("td",de,[e.areAllResultsSelected?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ue,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.theDisplayedWebsitesAreSelectedText),style:{"margin-right":"3.5px"}},null,8,me),Object(r["createElementVNode"])("a",{href:"#",onClick:t[11]||(t[11]=Object(r["withModifiers"])((function(t){return e.areAllResultsSelected=!e.areAllResultsSelected}),["prevent"])),innerHTML:e.$sanitize(e.clickToSelectAllText)},null,8,be)])),e.areAllResultsSelected?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",pe,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.allWebsitesAreSelectedText),style:{"margin-right":"3.5px"}},null,8,fe),Object(r["createElementVNode"])("a",{href:"#",onClick:t[12]||(t[12]=Object(r["withModifiers"])((function(t){return e.areAllResultsSelected=!e.areAllResultsSelected}),["prevent"])),innerHTML:e.$sanitize(e.clickToSelectDisplayedWebsitesText)},null,8,he)])):Object(r["createCommentVNode"])("",!0)])])):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.siteAccess,(function(s,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:s.idsite},[Object(r["createElementVNode"])("td",ge,[Object(r["createElementVNode"])("span",Oe,[Object(r["createElementVNode"])("label",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{type:"checkbox",id:"perm_edit_select_row".concat(n),"onUpdate:modelValue":function(t){return e.selectedRows[n]=t},onClick:t[13]||(t[13]=function(t){return e.onRowSelected()})},null,8,je),[[r["vModelCheckbox"],e.selectedRows[n]]]),ve])])]),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(s.site_name),1)]),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("div",Ce,[Object(r["createVNode"])(c,{"model-value":s.role,"onUpdate:modelValue":function(t){e.onRoleChange(s,t)},uicontrol:"select",options:e.filteredAccessLevels,"full-width":!0},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{idsite:s.idsite,"site-name":s.site_name,"user-login":e.userLogin,"user-role":s.role,capabilities:s.capabilities,onChange:t[14]||(t[14]=function(t){return e.fetchAccess()})},null,8,["idsite","site-name","user-login","user-role","capabilities"])])])])})),128))])],512),[[u]]),Object(r["createElementVNode"])("div",Ae,[Object(r["createElementVNode"])("div",ye,[e.siteAccessToChange?(Object(r["openBlock"])(),Object(r["createElementBlock"])("h3",{key:0,innerHTML:e.$sanitize(e.deletePermConfirmSingleText)},null,8,Se)):Object(r["createCommentVNode"])("",!0),e.siteAccessToChange?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:1,innerHTML:e.$sanitize(e.deletePermConfirmMultipleText)},null,8,Ne))]),Object(r["createElementVNode"])("div",Ve,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[15]||(t[15]=Object(r["withModifiers"])((function(t){return e.changeUserRole()}),["prevent"])),style:{"margin-right":"3.5px"}},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[16]||(t[16]=Object(r["withModifiers"])((function(t){e.siteAccessToChange=null,e.roleToChangeTo=null}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512),Object(r["createElementVNode"])("div",Ee,[Object(r["createElementVNode"])("div",ke,[e.siteAccessToChange?(Object(r["openBlock"])(),Object(r["createElementBlock"])("h3",{key:0,innerHTML:e.$sanitize(e.changePermToSiteConfirmSingleText)},null,8,Ue)):Object(r["createCommentVNode"])("",!0),e.siteAccessToChange?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:1,innerHTML:e.$sanitize(e.changePermToSiteConfirmMultipleText)},null,8,we))]),Object(r["createElementVNode"])("div",Te,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[17]||(t[17]=Object(r["withModifiers"])((function(t){return e.changeUserRole()}),["prevent"])),style:{"margin-right":"3.5px"}},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[18]||(t[18]=Object(r["withModifiers"])((function(t){e.siteAccessToChange.role=e.previousRole,e.siteAccessToChange=null,e.roleToChangeTo=null}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512),Object(r["createElementVNode"])("div",Me,[Object(r["createElementVNode"])("div",Be,[Object(r["createElementVNode"])("h3",{innerHTML:e.$sanitize(e.changePermToAllSitesConfirmText)},null,8,_e),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("UsersManager_ChangePermToAllSitesConfirm2")),1)]),Object(r["createElementVNode"])("div",Le,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[19]||(t[19]=Object(r["withModifiers"])((function(t){return e.giveAccessToAllSites()}),["prevent"])),style:{"margin-right":"3.5px"}},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[20]||(t[20]=function(e){return e.preventDefault()})},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512)],2)}var Re=window,De=Re.$,Pe=Object(r["defineComponent"])({props:{userLogin:{type:String,required:!0},limit:{type:Number,default:10},accessLevels:{type:Array,required:!0},filterAccessLevels:{type:Array,required:!0}},components:{Notification:a["Notification"],Field:h["Field"],CapabilitiesEdit:V},directives:{DropdownMenu:a["DropdownMenu"],ContentTable:a["ContentTable"]},data:function(){return{siteAccess:[],offset:0,totalEntries:null,accessLevelFilter:"",siteNameFilter:"",isLoadingAccess:!1,allWebsitesAccssLevelSet:"view",isAllCheckboxSelected:!1,selectedRows:{},isBulkActionsDisabled:!0,areAllResultsSelected:!1,previousRole:null,hasAccessToAtLeastOneSite:!0,isRoleHelpToggled:!1,isCapabilitiesHelpToggled:!1,isGivingAccessToAllSites:!1,roleToChangeTo:null,siteAccessToChange:null}},emits:["userHasAccessDetected","accessChanged"],created:function(){var e=this;this.onChangeSiteFilter=Object(a["debounce"])(this.onChangeSiteFilter,300),Object(r["watch"])((function(){return e.allPropsWatch}),(function(){e.limit&&e.fetchAccess()})),this.fetchAccess()},watch:{accessLevelFilter:function(){this.offset=0,this.fetchAccess()}},methods:{onAllCheckboxChange:function(e){var t=this;this.isAllCheckboxSelected=e.target.checked,this.isAllCheckboxSelected?(this.siteAccess.forEach((function(e,s){t.selectedRows[s]=!0})),this.isBulkActionsDisabled=!1):this.clearSelection()},clearSelection:function(){this.selectedRows={},this.areAllResultsSelected=!1,this.isBulkActionsDisabled=!0,this.isAllCheckboxSelected=!1,this.siteAccessToChange=null},onRowSelected:function(){var e=this;setTimeout((function(){var t=e.selectedRowsCount;e.isBulkActionsDisabled=0===t,e.isAllCheckboxSelected=t===e.siteAccess.length}))},fetchAccess:function(){var e=this;return this.isLoadingAccess=!0,a["AjaxHelper"].fetch({method:"UsersManager.getSitesAccessForUser",limit:this.limit,offset:this.offset,filter_search:this.siteNameFilter,filter_access:this.accessLevelFilter,userLogin:this.userLogin},{returnResponseObject:!0}).then((function(t){var s=t.getRequestHandle();e.isLoadingAccess=!1,e.siteAccess=s.responseJSON,e.totalEntries=parseInt(s.getResponseHeader("x-matomo-total-results"),10)||0,e.hasAccessToAtLeastOneSite=!!s.getResponseHeader("x-matomo-has-some"),e.$emit("userHasAccessDetected",{hasAccess:e.hasAccessToAtLeastOneSite}),e.clearSelection()})).catch((function(){e.isLoadingAccess=!1,e.clearSelection()}))},gotoPreviousPage:function(){this.offset=Math.max(0,this.offset-this.limit),this.fetchAccess()},gotoNextPage:function(){var e=this.offset+this.limit;e>=(this.totalEntries||0)||(this.offset=e,this.fetchAccess())},showRemoveAccessConfirm:function(){De(this.$refs.deleteAccessConfirmModal).modal({dismissible:!1}).modal("open")},changeUserRole:function(){var e=this,t=function(){var t=[];return Object.keys(e.selectedRows).forEach((function(s){e.selectedRows[s]&&e.siteAccess[s]&&t.push(e.siteAccess[s].idsite)})),t},s=function(){return a["AjaxHelper"].fetch({method:"UsersManager.getSitesAccessForUser",filter_search:e.siteNameFilter,filter_access:e.accessLevelFilter,userLogin:e.userLogin,filter_limit:"-1"}).then((function(e){return e.map((function(e){return e.idsite}))}))};return this.isLoadingAccess=!0,Promise.resolve().then((function(){return e.siteAccessToChange?[e.siteAccessToChange.idsite]:e.areAllResultsSelected?s():t()})).then((function(t){return a["AjaxHelper"].post({method:"UsersManager.setUserAccess"},{userLogin:e.userLogin,access:e.roleToChangeTo,idSites:t})})).catch((function(){})).then((function(){return e.$emit("accessChanged"),e.fetchAccess()}))},showChangeAccessConfirm:function(){De(this.$refs.changeAccessConfirmModal).modal({dismissible:!1}).modal("open")},getRoleDisplay:function(e){var t=null;return this.filteredAccessLevels.forEach((function(s){s.key===e&&(t=s.value)})),t},giveAccessToAllSites:function(){var e=this;this.isGivingAccessToAllSites=!0,a["AjaxHelper"].fetch({method:"SitesManager.getSitesWithAdminAccess"}).then((function(t){var s=t.map((function(e){return e.idsite}));return a["AjaxHelper"].post({method:"UsersManager.setUserAccess"},{userLogin:e.userLogin,access:e.allWebsitesAccssLevelSet,idSites:s})})).then((function(){return e.fetchAccess()})).finally((function(){e.isGivingAccessToAllSites=!1}))},showChangeAccessAllSitesModal:function(){De(this.$refs.confirmGiveAccessAllSitesModal).modal({dismissible:!1}).modal("open")},onChangeSiteFilter:function(e){var t=this;setTimeout((function(){var s=e.target.value;t.siteNameFilter!==s&&(t.siteNameFilter=s,t.offset=0,t.fetchAccess())}))},onRoleChange:function(e,t){this.previousRole=e.role,this.roleToChangeTo=t,this.siteAccessToChange=e,this.showChangeAccessConfirm()}},computed:{rolesHelpText:function(){return Object(a["translate"])("UsersManager_RolesHelp",'<a href="https://matomo.org/faq/general/faq_70/" target="_blank" rel="noreferrer noopener">',"</a>",'<a href="https://matomo.org/faq/general/faq_69/" target="_blank" rel="noreferrer noopener">',"</a>")},theDisplayedWebsitesAreSelectedText:function(){var e=Object(a["translate"])("UsersManager_TheDisplayedWebsitesAreSelected","<strong>".concat(this.siteAccess.length,"</strong>"));return"".concat(e," ")},clickToSelectAllText:function(){return Object(a["translate"])("UsersManager_ClickToSelectAll","<strong>".concat(this.totalEntries,"</strong>"))},allWebsitesAreSelectedText:function(){return Object(a["translate"])("UsersManager_AllWebsitesAreSelected","<strong>".concat(this.totalEntries,"</strong>"))},clickToSelectDisplayedWebsitesText:function(){return Object(a["translate"])("UsersManager_ClickToSelectDisplayedWebsites","<strong>".concat(this.siteAccess.length,"</strong>"))},deletePermConfirmSingleText:function(){return Object(a["translate"])("UsersManager_DeletePermConfirmSingle","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.siteAccessToChangeName,"</strong>"))},deletePermConfirmMultipleText:function(){return Object(a["translate"])("UsersManager_DeletePermConfirmMultiple","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.affectedSitesCount,"</strong>"))},changePermToSiteConfirmSingleText:function(){return Object(a["translate"])("UsersManager_ChangePermToSiteConfirmSingle","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.siteAccessToChangeName,"</strong>"),"<strong>".concat(this.getRoleDisplay(this.roleToChangeTo),"</strong>"))},changePermToSiteConfirmMultipleText:function(){return Object(a["translate"])("UsersManager_ChangePermToSiteConfirmMultiple","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.affectedSitesCount,"</strong>"),"<strong>".concat(this.getRoleDisplay(this.roleToChangeTo),"</strong>"))},changePermToAllSitesConfirmText:function(){return Object(a["translate"])("UsersManager_ChangePermToAllSitesConfirm","<strong>".concat(this.userLogin,"</strong>"),"<strong>".concat(this.getRoleDisplay(this.allWebsitesAccssLevelSet),"</strong>"))},paginationLowerBound:function(){return this.offset+1},paginationUpperBound:function(){return this.totalEntries?Math.min(this.offset+this.limit,this.totalEntries):"?"},filteredAccessLevels:function(){return this.accessLevels.filter((function(e){return"superuser"!==e.key}))},filteredSelectAccessLevels:function(){return this.filterAccessLevels.filter((function(e){return"superuser"!==e.key}))},selectedRowsCount:function(){var e=0;return Object.values(this.selectedRows).forEach((function(t){t&&(e+=1)})),e},affectedSitesCount:function(){return this.areAllResultsSelected?this.totalEntries:this.selectedRowsCount},allPropsWatch:function(){return this.userLogin,this.limit,this.accessLevels,this.filterAccessLevels,Date.now()},siteAccessToChangeName:function(){return this.siteAccessToChange?a["Matomo"].helper.htmlEntities(this.siteAccessToChange.site_name):""},paginationText:function(){var e=Object(a["translate"])("General_Pagination","".concat(this.paginationLowerBound),"".concat(this.paginationUpperBound),"".concat(this.totalEntries));return" ".concat(e," ")}}});Pe.render=xe;var He=Pe,Fe=(Object(a["createAngularJsAdapter"])({component:He,scope:{userLogin:{angularJsBind:"<"},limit:{angularJsBind:"<"},onUserHasAccessDetected:{angularJsBind:"&",vue:"userHasAccessDetected"},onAccessChange:{angularJsBind:"&",vue:"accessChanged"},accessLevels:{angularJsBind:"<"},filterAccessLevels:{angularJsBind:"<"}},directiveName:"piwikUserPermissionsEdit",restrict:"E"}),{class:"row"}),Ie={key:0,class:"col m2 entityList"},Ge={class:"listCircle"},$e={key:0,class:"icon-warning"},ze=Object(r["createElementVNode"])("div",{class:"save-button-spacer hide-on-small-only"},null,-1),Je={href:"",class:"entityCancelLink"},We={class:"visibleTab col m10"},qe={key:0,class:"basic-info-tab"},Ye={key:0,class:"entityCancel"},Xe={key:1,class:"user-permissions"},Ke={key:0},Qe={key:1,class:"alert alert-info"},Ze={key:2,class:"superuser-access"},et={class:"superuser-confirm-modal modal",ref:"superUserConfirmModal"},tt={class:"modal-content"},st={key:0},nt={key:1},it={class:"modal-footer"},at={key:3,class:"twofa-reset"},rt={class:"resetTwoFa"},ot={class:"twofa-confirm-modal modal",ref:"twofaConfirmModal"},ct={class:"modal-content"},lt={class:"modal-footer"},dt={class:"change-password-modal modal",ref:"changePasswordModal"},ut={class:"modal-content"},mt=["innerHTML"],bt={class:"modal-footer"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */Object(c["createAngularJsAdapter"])({component:Pe,scope:{userLogin:{angularJsBind:"<"},limit:{angularJsBind:"<"},onUserHasAccessDetected:{angularJsBind:"&",vue:"userHasAccessDetected"},onAccessChange:{angularJsBind:"&",vue:"accessChanged"},accessLevels:{angularJsBind:"<"},filterAccessLevels:{angularJsBind:"<"}},directiveName:"piwikUserPermissionsEdit",restrict:"E"})}})})); + */function pt(e,t,s,n,i,a){var o=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),l=Object(r["resolveComponent"])("UserPermissionsEdit"),d=Object(r["resolveComponent"])("ContentBlock"),u=Object(r["resolveDirective"])("form");return Object(r["openBlock"])(),Object(r["createBlock"])(d,{class:Object(r["normalizeClass"])(["userEditForm",{loading:e.isSavingUserInfo}]),"content-title":"".concat(e.formTitle," ").concat(e.isAdd?"":"'".concat(e.theUser.login,"'"))},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Fe,[e.isAdd?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ie,[Object(r["createElementVNode"])("ul",Ge,[Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])([{active:"basic"===e.activeTab},"menuBasicInfo"])},[Object(r["createElementVNode"])("a",{href:"",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(t){return e.activeTab="basic"}),["prevent"]))},Object(r["toDisplayString"])(e.translate("UsersManager_BasicInformation")),1)],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])([{active:"permissions"===e.activeTab},"menuPermissions"])},[Object(r["createElementVNode"])("a",{href:"",onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.activeTab="permissions"}),["prevent"])),style:{"margin-right":"3.5px"}},Object(r["toDisplayString"])(e.translate("UsersManager_Permissions")),1),e.userHasAccess||e.theUser.superuser_access?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",$e))],2),"superuser"===e.currentUserRole?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:0,class:Object(r["normalizeClass"])([{active:"superuser"===e.activeTab},"menuSuperuser"])},[Object(r["createElementVNode"])("a",{href:"",onClick:t[2]||(t[2]=Object(r["withModifiers"])((function(t){return e.activeTab="superuser"}),["prevent"]))},Object(r["toDisplayString"])(e.translate("UsersManager_SuperUserAccess")),1)],2)):Object(r["createCommentVNode"])("",!0),"superuser"===e.currentUserRole&&e.theUser.uses_2fa&&!e.isAdd?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:1,class:Object(r["normalizeClass"])([{active:"2fa"===e.activeTab},"menuUserTwoFa"])},[Object(r["createElementVNode"])("a",{href:"",onClick:t[3]||(t[3]=Object(r["withModifiers"])((function(t){return e.activeTab="2fa"}),["prevent"]))},Object(r["toDisplayString"])(e.translate("UsersManager_TwoFactorAuthentication")),1)],2)):Object(r["createCommentVNode"])("",!0)]),ze,Object(r["createElementVNode"])("div",{class:"entityCancel",onClick:t[4]||(t[4]=Object(r["withModifiers"])((function(t){return e.onDoneEditing()}),["prevent"]))},[Object(r["createElementVNode"])("a",Je,Object(r["toDisplayString"])(e.translate("Mobile_NavigationBack")),1)])])),Object(r["createElementVNode"])("div",We,["basic"===e.activeTab?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",qe,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{modelValue:e.theUser.login,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.theUser.login=t}),disabled:e.isSavingUserInfo||!e.isAdd||e.isShowingPasswordConfirm,uicontrol:"text",name:"user_login",maxlength:100,title:e.translate("General_Username")},null,8,["modelValue","disabled","title"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{"model-value":e.theUser.password,disabled:e.isSavingUserInfo||"superuser"!==e.currentUserRole&&!e.isAdd||e.isShowingPasswordConfirm,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.theUser.password=t,e.isPasswordModified=!0}),uicontrol:"password",name:"user_password",title:e.translate("General_Password")},null,8,["model-value","disabled","title"])]),Object(r["createElementVNode"])("div",null,["superuser"===e.currentUserRole||e.isAdd?(Object(r["openBlock"])(),Object(r["createBlock"])(o,{key:0,modelValue:e.theUser.email,"onUpdate:modelValue":t[7]||(t[7]=function(t){return e.theUser.email=t}),disabled:e.isSavingUserInfo||"superuser"!==e.currentUserRole&&!e.isAdd||e.isShowingPasswordConfirm,uicontrol:"text",name:"user_email",maxlength:100,title:e.translate("UsersManager_Email")},null,8,["modelValue","disabled","title"])):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",null,[e.isAdd?(Object(r["openBlock"])(),Object(r["createBlock"])(o,{key:0,modelValue:e.firstSiteAccess,"onUpdate:modelValue":t[8]||(t[8]=function(t){return e.firstSiteAccess=t}),disabled:e.isSavingUserInfo,uicontrol:"site",name:"user_site","ui-control-attributes":{onlySitesWithAdminAccess:!0},title:e.translate("UsersManager_FirstWebsitePermission"),"inline-help":e.translate("UsersManager_FirstSiteInlineHelp")},null,8,["modelValue","disabled","title","inline-help"])):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",null,["superuser"===e.currentUserRole||e.isAdd?(Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:0,value:e.saveButtonLabel,disabled:e.isAdd&&(!e.firstSiteAccess||!e.firstSiteAccess.id),saving:e.isSavingUserInfo,onConfirm:t[9]||(t[9]=function(t){return e.saveUserInfo()})},null,8,["value","disabled","saving"])):Object(r["createCommentVNode"])("",!0)]),e.isAdd?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ye,[Object(r["createElementVNode"])("a",{href:"",class:"entityCancelLink",onClick:t[10]||(t[10]=Object(r["withModifiers"])((function(t){return e.onDoneEditing()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])):Object(r["createCommentVNode"])("",!0)])):Object(r["createCommentVNode"])("",!0),e.isAdd?Object(r["createCommentVNode"])("",!0):Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Xe,[e.theUser.superuser_access?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ke,[Object(r["createVNode"])(l,{"user-login":e.theUser.login,onUserHasAccessDetected:t[11]||(t[11]=function(t){return e.userHasAccess=t.hasAccess}),onAccessChanged:t[12]||(t[12]=function(t){return e.isUserModified=!0}),"access-levels":e.accessLevels,"filter-access-levels":e.filterAccessLevels},null,8,["user-login","access-levels","filter-access-levels"])])),e.theUser.superuser_access?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Qe,Object(r["toDisplayString"])(e.translate("UsersManager_SuperUsersPermissionsNotice")),1)):Object(r["createCommentVNode"])("",!0)],512)),[[r["vShow"],"permissions"===e.activeTab]]),"superuser"!==e.activeTab||"superuser"!==e.currentUserRole||e.isAdd?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ze,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("UsersManager_SuperUserIntro1")),1),Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("UsersManager_SuperUserIntro2")),1)]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{modelValue:e.superUserAccessChecked,"onUpdate:modelValue":t[13]||(t[13]=function(t){return e.superUserAccessChecked=t}),onClick:t[14]||(t[14]=function(t){return e.confirmSuperUserChange()}),disabled:e.isSavingUserInfo,uicontrol:"checkbox",name:"superuser_access",title:e.translate("UsersManager_HasSuperUserAccess")},null,8,["modelValue","disabled","title"])]),Object(r["createElementVNode"])("div",et,[Object(r["createElementVNode"])("div",tt,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("UsersManager_AreYouSure")),1),e.theUser.superuser_access?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",st,Object(r["toDisplayString"])(e.translate("UsersManager_RemoveSuperuserAccessConfirm")),1)):Object(r["createCommentVNode"])("",!0),e.theUser.superuser_access?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",nt,Object(r["toDisplayString"])(e.translate("UsersManager_AddSuperuserAccessConfirm")),1)),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{modelValue:e.passwordConfirmationForSuperUser,"onUpdate:modelValue":t[15]||(t[15]=function(t){return e.passwordConfirmationForSuperUser=t}),uicontrol:"password",name:"currentUserPasswordForSuperUser",autocomplete:!1,"full-width":!0,title:e.translate("UsersManager_YourCurrentPassword")},null,8,["modelValue","title"])])]),Object(r["createElementVNode"])("div",it,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[16]||(t[16]=Object(r["withModifiers"])((function(t){return e.toggleSuperuserAccess()}),["prevent"])),style:{"margin-right":"3.5px"}},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[17]||(t[17]=Object(r["withModifiers"])((function(t){e.setSuperUserAccessChecked(),e.passwordConfirmationForSuperUser=""}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512)])),"superuser"!==e.currentUserRole||e.isAdd?Object(r["createCommentVNode"])("",!0):Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",at,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("UsersManager_ResetTwoFactorAuthenticationInfo")),1),Object(r["createElementVNode"])("div",rt,[Object(r["createVNode"])(c,{saving:e.isResetting2FA,onConfirm:t[18]||(t[18]=function(t){return e.confirmReset2FA()}),value:e.translate("UsersManager_ResetTwoFactorAuthentication")},null,8,["saving","value"])]),Object(r["createElementVNode"])("div",ot,[Object(r["createElementVNode"])("div",ct,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("UsersManager_AreYouSure")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("UsersManager_ConfirmWithPassword")),1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{modelValue:e.passwordConfirmation,"onUpdate:modelValue":t[19]||(t[19]=function(t){return e.passwordConfirmation=t}),uicontrol:"password",name:"currentUserPassword",autocomplete:!1,"full-width":!0,title:e.translate("UsersManager_YourCurrentPassword")},null,8,["modelValue","title"])])]),Object(r["createElementVNode"])("div",lt,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[20]||(t[20]=Object(r["withModifiers"])((function(t){return e.reset2FA()}),["prevent"])),style:{"margin-right":"3.5px"}},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[21]||(t[21]=function(t){t.preventDefault(),e.passwordConfirmation=""})},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512)],512)),[[r["vShow"],"2fa"===e.activeTab]])])],512),[[u]]),Object(r["createElementVNode"])("div",dt,[Object(r["createElementVNode"])("div",ut,[Object(r["createElementVNode"])("h2",{innerHTML:e.changePasswordTitle},null,8,mt),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("UsersManager_ConfirmWithPassword")),1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(o,{modelValue:e.passwordConfirmation,"onUpdate:modelValue":t[22]||(t[22]=function(t){return e.passwordConfirmation=t}),uicontrol:"password",name:"currentUserPassword",autocomplete:!1,"full-width":!0,title:e.translate("UsersManager_YourCurrentPassword")},null,8,["modelValue","title"])])]),Object(r["createElementVNode"])("div",bt,[Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close btn",onClick:t[23]||(t[23]=Object(r["withModifiers"])((function(t){return e.updateUser()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_Yes")),1),Object(r["createElementVNode"])("a",{href:"",class:"modal-action modal-close modal-no",onClick:t[24]||(t[24]=function(t){t.preventDefault(),e.passwordConfirmation=""})},Object(r["toDisplayString"])(e.translate("General_No")),1)])],512)]})),_:1},8,["class","content-title"])}var ft={login:"",superuser_access:!1,uses_2fa:!1,password:"",email:""},ht=window,gt=ht.$,Ot=Object(r["defineComponent"])({props:{user:Object,currentUserRole:{type:String,required:!0},accessLevels:{type:Array,required:!0},filterAccessLevels:{type:Array,required:!0},initialSiteId:{type:[String,Number],required:!0},initialSiteName:{type:String,required:!0}},components:{ContentBlock:a["ContentBlock"],Field:h["Field"],SaveButton:h["SaveButton"],UserPermissionsEdit:He},directives:{Form:h["Form"]},data:function(){return{theUser:this.user||Object.assign({},ft),activeTab:"basic",permissionsForIdSite:1,isSavingUserInfo:!1,userHasAccess:!0,firstSiteAccess:{id:this.initialSiteId,name:this.initialSiteName},isUserModified:!1,passwordConfirmation:"",isPasswordModified:!1,superUserAccessChecked:null,passwordConfirmationForSuperUser:"",isResetting2FA:!1,isShowingPasswordConfirm:!1}},emits:["done","updated"],watch:{user:function(e){this.theUser=e||Object.assign({},ft),this.theUser.password||this.resetPasswordVar(),this.setSuperUserAccessChecked()}},methods:{confirmSuperUserChange:function(){gt(this.$refs.superUserConfirmModal).modal({dismissible:!1}).modal("open")},confirmReset2FA:function(){gt(this.$refs.twofaConfirmModal).modal({dismissible:!1}).modal("open")},toggleSuperuserAccess:function(){var e=this;this.isSavingUserInfo=!0,a["AjaxHelper"].post({method:"UsersManager.setSuperUserAccess"},{userLogin:this.theUser.login,hasSuperUserAccess:this.theUser.superuser_access?"0":"1",passwordConfirmation:this.passwordConfirmationForSuperUser}).then((function(){e.theUser.superuser_access=!e.theUser.superuser_access})).catch((function(){})).then((function(){e.isSavingUserInfo=!1,e.isUserModified=!0,e.passwordConfirmationForSuperUser="",e.setSuperUserAccessChecked()}))},saveUserInfo:function(){var e=this;return Promise.resolve().then((function(){return e.isAdd?e.createUser():e.confirmUserChange()})).then((function(){e.$emit("updated",{user:Object(r["readonly"])(e.theUser)})}))},createUser:function(){var e=this;return this.isSavingUserInfo=!0,a["AjaxHelper"].post({method:"UsersManager.addUser"},{userLogin:this.theUser.login,password:this.theUser.password,email:this.theUser.email,initialIdSite:this.firstSiteAccess?this.firstSiteAccess.id:void 0}).catch((function(t){throw e.isSavingUserInfo=!1,t})).then((function(){e.firstSiteAccess=null,e.isSavingUserInfo=!1,e.isUserModified=!0,e.resetPasswordVar(),e.showUserSavedNotification()}))},resetPasswordVar:function(){this.isAdd||(this.theUser.password="XXXXXXXX")},confirmUserChange:function(){var e=this;this.passwordConfirmation="",this.isShowingPasswordConfirm=!0;var t=function(t){var s=t.keyCode?t.keyCode:t.which;13===s&&(gt(e.$refs.changePasswordModal).modal("close"),e.updateUser())};gt(this.$refs.changePasswordModal).modal({dismissible:!1,onOpenEnd:function(){e.isShowingPasswordConfirm=!1,gt(".modal.open #currentUserPassword").focus().off("keypress").keypress(t)}}).modal("open")},showUserSavedNotification:function(){a["NotificationsStore"].show({message:Object(a["translate"])("General_YourChangesHaveBeenSaved"),context:"success",type:"toast"})},reset2FA:function(){var e=this;return this.isResetting2FA=!0,a["AjaxHelper"].post({method:"TwoFactorAuth.resetTwoFactorAuth",userLogin:this.theUser.login,passwordConfirmation:this.passwordConfirmation}).catch((function(t){throw e.isResetting2FA=!1,t})).then((function(){e.isResetting2FA=!1,e.theUser.uses_2fa=!1,e.activeTab="basic",e.showUserSavedNotification()})).finally((function(){e.passwordConfirmation=""}))},updateUser:function(){var e=this;return this.isSavingUserInfo=!0,a["AjaxHelper"].post({method:"UsersManager.updateUser"},{userLogin:this.theUser.login,password:this.isPasswordModified&&this.theUser.password?this.theUser.password:void 0,passwordConfirmation:this.passwordConfirmation?this.passwordConfirmation:void 0,email:this.theUser.email}).catch((function(t){throw e.isSavingUserInfo=!1,e.passwordConfirmation="",t})).then((function(){e.isSavingUserInfo=!1,e.passwordConfirmation="",e.isUserModified=!0,e.isPasswordModified=!1,e.resetPasswordVar(),e.showUserSavedNotification()}))},setSuperUserAccessChecked:function(){this.superUserAccessChecked=!!this.theUser.superuser_access},onDoneEditing:function(){this.$emit("done",{isUserModified:this.isUserModified})}},computed:{formTitle:function(){return this.isAdd?Object(a["translate"])("UsersManager_AddNewUser"):Object(a["translate"])("UsersManager_EditUser")},saveButtonLabel:function(){return this.isAdd?Object(a["translate"])("UsersManager_CreateUser"):Object(a["translate"])("UsersManager_SaveBasicInfo")},isAdd:function(){return!this.user},changePasswordTitle:function(){return Object(a["translate"])("UsersManager_AreYouSureChangeDetails","<strong>".concat(this.theUser.login,"</strong>"))}}});Ot.render=pt;var jt=Ot; +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */Object(a["createAngularJsAdapter"])({component:jt,scope:{user:{angularJsBind:"<"},onDoneEditing:{angularJsBind:"&",vue:"done"},currentUserRole:{angularJsBind:"<"},accessLevels:{angularJsBind:"<"},filterAccessLevels:{angularJsBind:"<"},initialSiteId:{angularJsBind:"<"},initialSiteName:{angularJsBind:"<"},onUpdated:{angularJsBind:"&",vue:"updated"}},directiveName:"piwikUserEditForm",restrict:"E"})}})})); //# sourceMappingURL=UsersManager.umd.min.js.map
\ No newline at end of file diff --git a/plugins/UsersManager/vue/src/User.ts b/plugins/UsersManager/vue/src/User.ts new file mode 100644 index 0000000000..00520a3c4f --- /dev/null +++ b/plugins/UsersManager/vue/src/User.ts @@ -0,0 +1,16 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +interface User { + login: string; + superuser_access: boolean; + uses_2fa: boolean; + password?: string; + email: string; +} + +export default User; diff --git a/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.adapter.ts b/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.adapter.ts new file mode 100644 index 0000000000..558b879365 --- /dev/null +++ b/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.adapter.ts @@ -0,0 +1,43 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +import { createAngularJsAdapter } from 'CoreHome'; +import UserEditForm from './UserEditForm.vue'; + +export default createAngularJsAdapter({ + component: UserEditForm, + scope: { + user: { + angularJsBind: '<', + }, + onDoneEditing: { + angularJsBind: '&', + vue: 'done', + }, + currentUserRole: { + angularJsBind: '<', + }, + accessLevels: { + angularJsBind: '<', + }, + filterAccessLevels: { + angularJsBind: '<', + }, + initialSiteId: { + angularJsBind: '<', + }, + initialSiteName: { + angularJsBind: '<', + }, + onUpdated: { + angularJsBind: '&', + vue: 'updated', + }, + }, + directiveName: 'piwikUserEditForm', + restrict: 'E', +}); diff --git a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.less b/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.less index f08a3079c5..f08a3079c5 100644 --- a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.less +++ b/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.less diff --git a/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue b/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue new file mode 100644 index 0000000000..a818b6d768 --- /dev/null +++ b/plugins/UsersManager/vue/src/UserEditForm/UserEditForm.vue @@ -0,0 +1,580 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <ContentBlock + class="userEditForm" + :class="{ loading: isSavingUserInfo }" + :content-title="`${formTitle} ${!isAdd ? `'${theUser.login}'` : ''}`" + > + <div + class="row" + v-form="" + > + <div + class="col m2 entityList" + v-if="!isAdd" + > + <ul class="listCircle"> + <li + :class="{active: activeTab === 'basic'}" + class="menuBasicInfo" + > + <a + href="" + @click.prevent="activeTab = 'basic'" + >{{ translate('UsersManager_BasicInformation') }}</a> + </li> + <li + :class="{active: activeTab === 'permissions'}" + class="menuPermissions" + > + <a + href="" + @click.prevent="activeTab = 'permissions'" + style="margin-right:3.5px" + > + {{ translate('UsersManager_Permissions') }} + </a> + <span + class="icon-warning" + v-if="!userHasAccess && !theUser.superuser_access" + /> + </li> + <li + :class="{active: activeTab === 'superuser'}" + class="menuSuperuser" + v-if="currentUserRole === 'superuser'" + > + <a + href="" + @click.prevent="activeTab = 'superuser'" + >{{ translate('UsersManager_SuperUserAccess') }}</a> + </li> + <li + :class="{active: activeTab === '2fa'}" + class="menuUserTwoFa" + v-if="currentUserRole === 'superuser' && theUser.uses_2fa && !isAdd" + > + <a + href="" + @click.prevent="activeTab = '2fa'" + >{{ translate('UsersManager_TwoFactorAuthentication') }}</a> + </li> + </ul> + <div class="save-button-spacer hide-on-small-only"> + </div> + <div + class="entityCancel" + @click.prevent="onDoneEditing()" + > + <a + href="" + class="entityCancelLink" + >{{ translate('Mobile_NavigationBack') }}</a> + </div> + </div> + <div class="visibleTab col m10"> + <div + v-if="activeTab === 'basic'" + class="basic-info-tab" + > + <div> + <Field + v-model="theUser.login" + :disabled="isSavingUserInfo || !isAdd || isShowingPasswordConfirm" + uicontrol="text" + name="user_login" + :maxlength="100" + :title="translate('General_Username')" + /> + </div> + <div> + <Field + :model-value="theUser.password" + :disabled="isSavingUserInfo || (currentUserRole !== 'superuser' && !isAdd) + || isShowingPasswordConfirm" + @update:model-value="theUser.password = $event; isPasswordModified = true" + uicontrol="password" + name="user_password" + :title="translate('General_Password')" + /> + </div> + <div> + <Field + v-model="theUser.email" + :disabled="isSavingUserInfo || (currentUserRole !== 'superuser' && !isAdd) + || isShowingPasswordConfirm" + v-if="currentUserRole === 'superuser' || isAdd" + uicontrol="text" + name="user_email" + :maxlength="100" + :title="translate('UsersManager_Email')" + /> + </div> + <div> + <Field + v-model="firstSiteAccess" + :disabled="isSavingUserInfo" + v-if="isAdd" + uicontrol="site" + name="user_site" + :ui-control-attributes="{ onlySitesWithAdminAccess: true }" + :title="translate('UsersManager_FirstWebsitePermission')" + :inline-help="translate('UsersManager_FirstSiteInlineHelp')" + /> + </div> + <div> + <SaveButton + v-if="currentUserRole === 'superuser' || isAdd" + :value="saveButtonLabel" + :disabled="isAdd && (!firstSiteAccess || !firstSiteAccess.id)" + :saving="isSavingUserInfo" + @confirm="saveUserInfo()" + /> + </div> + <div + class="entityCancel" + v-if="isAdd" + > + <a + href="" + class="entityCancelLink" + @click.prevent="onDoneEditing()" + >{{ translate('General_Cancel') }}</a> + </div> + </div> + <div + v-if="!isAdd" + v-show="activeTab === 'permissions'" + class="user-permissions" + > + <div + v-if="!theUser.superuser_access" + > + <UserPermissionsEdit + :user-login="theUser.login" + @user-has-access-detected="userHasAccess = $event.hasAccess" + @access-changed="isUserModified = true" + :access-levels="accessLevels" + :filter-access-levels="filterAccessLevels" + /> + </div> + <div + v-if="theUser.superuser_access" + class="alert alert-info" + > + {{ translate('UsersManager_SuperUsersPermissionsNotice') }} + </div> + </div> + <div + v-if="activeTab === 'superuser' && currentUserRole === 'superuser' && !isAdd" + class="superuser-access" + > + <p>{{ translate('UsersManager_SuperUserIntro1') }}</p> + <p><strong>{{ translate('UsersManager_SuperUserIntro2') }}</strong></p> + <div> + <Field + v-model="superUserAccessChecked" + @click="confirmSuperUserChange()" + :disabled="isSavingUserInfo" + uicontrol="checkbox" + name="superuser_access" + :title="translate('UsersManager_HasSuperUserAccess')" + /> + </div> + <div class="superuser-confirm-modal modal" ref="superUserConfirmModal"> + <div class="modal-content"> + <h2>{{ translate('UsersManager_AreYouSure') }}</h2> + <p v-if="theUser.superuser_access"> + {{ translate('UsersManager_RemoveSuperuserAccessConfirm') }} + </p> + <p v-if="!theUser.superuser_access"> + {{ translate('UsersManager_AddSuperuserAccessConfirm') }} + </p> + <div> + <Field + v-model="passwordConfirmationForSuperUser" + uicontrol="password" + name="currentUserPasswordForSuperUser" + :autocomplete="false" + :full-width="true" + :title="translate('UsersManager_YourCurrentPassword')" + /> + </div> + </div> + <div class="modal-footer"> + <a + href="" + class="modal-action modal-close btn" + @click.prevent="toggleSuperuserAccess()" + style="margin-right:3.5px" + >{{ translate('General_Yes') }}</a> + <a + href="" + class="modal-action modal-close modal-no" + @click.prevent="setSuperUserAccessChecked(); passwordConfirmationForSuperUser = ''" + >{{ translate('General_No') }}</a> + </div> + </div> + </div> + <div + v-show="activeTab === '2fa'" + v-if="currentUserRole === 'superuser' && !isAdd" + class="twofa-reset" + > + <p>{{ translate('UsersManager_ResetTwoFactorAuthenticationInfo') }}</p> + <div + class="resetTwoFa" + > + <SaveButton + :saving="isResetting2FA" + @confirm="confirmReset2FA()" + :value="translate('UsersManager_ResetTwoFactorAuthentication')" + /> + </div> + <div class="twofa-confirm-modal modal" ref="twofaConfirmModal"> + <div class="modal-content"> + <h2>{{ translate('UsersManager_AreYouSure') }}</h2> + <p>{{ translate('UsersManager_ConfirmWithPassword') }}</p> + <div> + <Field + v-model="passwordConfirmation" + uicontrol="password" + name="currentUserPassword" + :autocomplete="false" + :full-width="true" + :title="translate('UsersManager_YourCurrentPassword')" + /> + </div> + </div> + <div class="modal-footer"> + <a + href="" + class="modal-action modal-close btn" + @click.prevent="reset2FA()" + style="margin-right:3.5px" + >{{ translate('General_Yes') }}</a> + <a + href="" + class="modal-action modal-close modal-no" + @click="$event.preventDefault(); passwordConfirmation = ''" + >{{ translate('General_No') }}</a> + </div> + </div> + </div> + </div> + </div> + <div class="change-password-modal modal" ref="changePasswordModal"> + <div class="modal-content"> + <h2 v-html="changePasswordTitle"></h2> + <p>{{ translate('UsersManager_ConfirmWithPassword') }}</p> + <div> + <Field + v-model="passwordConfirmation" + uicontrol="password" + name="currentUserPassword" + :autocomplete="false" + :full-width="true" + :title="translate('UsersManager_YourCurrentPassword')" + /> + </div> + </div> + <div class="modal-footer"> + <a + href="" + class="modal-action modal-close btn" + @click.prevent="updateUser()" + >{{ translate('General_Yes') }}</a> + <a + href="" + class="modal-action modal-close modal-no" + @click="$event.preventDefault(); passwordConfirmation = ''" + >{{ translate('General_No') }}</a> + </div> + </div> + </ContentBlock> +</template> + +<script lang="ts"> +import { defineComponent, readonly } from 'vue'; +import { + ContentBlock, + SiteRef, + translate, + AjaxHelper, + NotificationsStore, +} from 'CoreHome'; +import { Form, Field, SaveButton } from 'CorePluginsAdmin'; +import UserPermissionsEdit from '../UserPermissionsEdit/UserPermissionsEdit.vue'; +import User from '../User'; +import KeyPressEvent = JQuery.KeyPressEvent; + +const DEFAULT_USER: User = { + login: '', + superuser_access: false, + uses_2fa: false, + password: '', + email: '', +}; + +interface UserEditFormState { + theUser: User; + activeTab: string; + permissionsForIdSite: string|number; + isSavingUserInfo: boolean; + userHasAccess: boolean; + firstSiteAccess: SiteRef|null; + isUserModified: boolean; + passwordConfirmation: string; + isPasswordModified: boolean; + superUserAccessChecked: boolean|null; + passwordConfirmationForSuperUser: string; + isResetting2FA: boolean; + isShowingPasswordConfirm: boolean; +} + +const { $ } = window; + +export default defineComponent({ + props: { + user: Object, + currentUserRole: { + type: String, + required: true, + }, + accessLevels: { + type: Array, + required: true, + }, + filterAccessLevels: { + type: Array, + required: true, + }, + initialSiteId: { + type: [String, Number], + required: true, + }, + initialSiteName: { + type: String, + required: true, + }, + }, + components: { + ContentBlock, + Field, + SaveButton, + UserPermissionsEdit, + }, + directives: { + Form, + }, + data(): UserEditFormState { + return { + theUser: (this.user as User) || { ...DEFAULT_USER }, + activeTab: 'basic', + permissionsForIdSite: 1, + isSavingUserInfo: false, + userHasAccess: true, + firstSiteAccess: { + id: this.initialSiteId, + name: this.initialSiteName, + }, + isUserModified: false, + passwordConfirmation: '', + isPasswordModified: false, + superUserAccessChecked: null, + passwordConfirmationForSuperUser: '', + isResetting2FA: false, + isShowingPasswordConfirm: false, + }; + }, + emits: ['done', 'updated'], + watch: { + user(newVal) { + this.theUser = newVal || { ...DEFAULT_USER }; + + if (!this.theUser.password) { + this.resetPasswordVar(); + } + + this.setSuperUserAccessChecked(); + }, + }, + methods: { + confirmSuperUserChange() { + $(this.$refs.superUserConfirmModal as HTMLElement).modal({ + dismissible: false, + }).modal('open'); + }, + confirmReset2FA() { + $(this.$refs.twofaConfirmModal as HTMLElement).modal({ dismissible: false }).modal('open'); + }, + toggleSuperuserAccess() { + this.isSavingUserInfo = true; + AjaxHelper.post( + { + method: 'UsersManager.setSuperUserAccess', + }, + { + userLogin: this.theUser.login, + hasSuperUserAccess: this.theUser.superuser_access ? '0' : '1', + passwordConfirmation: this.passwordConfirmationForSuperUser!, + }, + ).then(() => { + this.theUser.superuser_access = !this.theUser.superuser_access; + }).catch(() => { + // ignore error (still displayed to user) + }).then(() => { // eslint-disable-line + this.isSavingUserInfo = false; + this.isUserModified = true; + this.passwordConfirmationForSuperUser = ''; + this.setSuperUserAccessChecked(); + }); + }, + saveUserInfo() { + return Promise.resolve().then(() => { + if (this.isAdd) { + return this.createUser(); + } + + return this.confirmUserChange(); + }).then(() => { + this.$emit('updated', { user: readonly(this.theUser) }); + }); + }, + createUser() { + this.isSavingUserInfo = true; + return AjaxHelper.post( + { + method: 'UsersManager.addUser', + }, + { + userLogin: this.theUser.login, + password: this.theUser.password, + email: this.theUser.email, + initialIdSite: this.firstSiteAccess ? this.firstSiteAccess.id : undefined, + }, + ).catch((e) => { + this.isSavingUserInfo = false; + throw e; + }).then(() => { + this.firstSiteAccess = null; + this.isSavingUserInfo = false; + this.isUserModified = true; + + this.resetPasswordVar(); + this.showUserSavedNotification(); + }); + }, + resetPasswordVar() { + if (!this.isAdd) { + // make sure password is not stored in the client after update/save + this.theUser.password = 'XXXXXXXX'; + } + }, + confirmUserChange() { + this.passwordConfirmation = ''; + this.isShowingPasswordConfirm = true; + + const onEnter = (event: KeyPressEvent) => { + const keycode = event.keyCode ? event.keyCode : event.which; + if (keycode === 13) { + $(this.$refs.changePasswordModal as HTMLElement).modal('close'); + this.updateUser(); + } + }; + + $(this.$refs.changePasswordModal as HTMLElement).modal({ + dismissible: false, + onOpenEnd: () => { + this.isShowingPasswordConfirm = false; + $('.modal.open #currentUserPassword').focus().off('keypress').keypress(onEnter); + }, + }).modal('open'); + }, + showUserSavedNotification() { + NotificationsStore.show({ + message: translate('General_YourChangesHaveBeenSaved'), + context: 'success', + type: 'toast', + }); + }, + reset2FA() { + this.isResetting2FA = true; + return AjaxHelper.post({ + method: 'TwoFactorAuth.resetTwoFactorAuth', + userLogin: this.theUser.login, + passwordConfirmation: this.passwordConfirmation, + }).catch((e) => { + this.isResetting2FA = false; + throw e; + }).then(() => { + this.isResetting2FA = false; + this.theUser.uses_2fa = false; + this.activeTab = 'basic'; + + this.showUserSavedNotification(); + }).finally(() => { + this.passwordConfirmation = ''; + }); + }, + updateUser() { + this.isSavingUserInfo = true; + return AjaxHelper.post( + { + method: 'UsersManager.updateUser', + }, + { + userLogin: this.theUser.login, + password: (this.isPasswordModified && this.theUser.password) + ? this.theUser.password + : undefined, + passwordConfirmation: this.passwordConfirmation ? this.passwordConfirmation : undefined, + email: this.theUser.email, + }, + ).catch((e) => { + this.isSavingUserInfo = false; + this.passwordConfirmation = ''; + throw e; + }).then(() => { + this.isSavingUserInfo = false; + this.passwordConfirmation = ''; + this.isUserModified = true; + this.isPasswordModified = false; + + this.resetPasswordVar(); + this.showUserSavedNotification(); + }); + }, + setSuperUserAccessChecked() { + this.superUserAccessChecked = !!this.theUser.superuser_access; + }, + onDoneEditing() { + this.$emit('done', { isUserModified: this.isUserModified }); + }, + }, + computed: { + formTitle() { + return this.isAdd ? translate('UsersManager_AddNewUser') : translate('UsersManager_EditUser'); + }, + saveButtonLabel() { + return this.isAdd + ? translate('UsersManager_CreateUser') + : translate('UsersManager_SaveBasicInfo'); + }, + isAdd() { + return !this.user; // purposefully checking input property not theUser state + }, + changePasswordTitle() { + return translate( + 'UsersManager_AreYouSureChangeDetails', + `<strong>${this.theUser.login}</strong>`, + ); + }, + }, +}); +</script> diff --git a/plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue b/plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue index 7dc293186d..de1fe56b57 100644 --- a/plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue +++ b/plugins/UsersManager/vue/src/UserPermissionsEdit/UserPermissionsEdit.vue @@ -312,6 +312,7 @@ href="" class="modal-action modal-close btn" @click.prevent="changeUserRole()" + style="margin-right:3.5px" >{{ translate('General_Yes') }}</a> <a href="" @@ -336,6 +337,7 @@ href="" class="modal-action modal-close btn" @click.prevent="changeUserRole()" + style="margin-right:3.5px" >{{ translate('General_Yes') }}</a> <a href="" @@ -357,6 +359,7 @@ href="" class="modal-action modal-close btn" @click.prevent="giveAccessToAllSites()" + style="margin-right:3.5px" >{{ translate('General_Yes') }}</a> <a href="" diff --git a/plugins/UsersManager/vue/src/index.ts b/plugins/UsersManager/vue/src/index.ts index bac1eaf08d..ebe55df225 100644 --- a/plugins/UsersManager/vue/src/index.ts +++ b/plugins/UsersManager/vue/src/index.ts @@ -6,7 +6,9 @@ */ import './CapabilitiesEdit/CapabilitiesEdit.adapter'; import './UserPermissionsEdit/UserPermissionsEdit.adapter'; +import './UserEditForm/UserEditForm.adapter'; export { default as CapabilitiesEdit } from './CapabilitiesEdit/CapabilitiesEdit.vue'; export { default as Capability } from './CapabilitiesStore/Capability'; export { default as UserPermissionsEdit } from './UserPermissionsEdit/UserPermissionsEdit.vue'; +export { default as UserEditForm } from './UserEditForm/UserEditForm.vue'; |