export const __webpack_esm_id__=50244;export const __webpack_esm_ids__=[1767,50244];export const __webpack_esm_modules__={50244(e,t,r){r(82146);var s=r(1767),n=r(82805),o=r(57154);function i(e,t,r,i,a,c,u,d,h,m,l,g){angular.extend(this,u("CommonUserCtrl",{$scope:e,passwordPlaceholder:"security.new.password"}));const p=(0,o.service)(o.SecurityService),S=(0,o.service)(o.AuthenticationService),w=(0,o.service)(o.SecurityContextService),v=(0,o.service)(o.LicenseService),y=(0,o.service)(o.ApplicationSettingsStorageService),_=(0,o.service)(o.NavigationContextService),k=(0,o.service)(o.ThemeService),C=(0,o.service)(o.RuntimeConfigurationContextService);let U;e.mode="settings",e.showWorkbenchSettings=!0,e.currentSystemTheme=k.getPreferredScheme(),e.themeModeOptions=[{mode:o.ThemeMode.system,labelKey:"security.workbench.settings.theme.mode.system"},{mode:o.ThemeMode.light,labelKey:"security.workbench.settings.theme.mode.light"},{mode:o.ThemeMode.dark,labelKey:"security.workbench.settings.theme.mode.dark"}],e.workbenchSettings=y.getApplicationSettings(),e.themeChanged=!1,e.saveButtonText=h.instant("common.save.btn"),e.pageTitle=h.instant("view.settings.title"),e.passwordPlaceholder=h.instant("security.new.password"),e.grantedAuthorities={[s.aj]:{},[s.DX]:{},[s.w0]:{}},e.loader=!1,e.noPassword=!1,e.showCookiePolicyLink=!1,e.showCookieConsentModal=!1,e.hasEditRestrictions=function(){return!0},e.onThemeChange=function(){e.themeChanged=e.workbenchSettings.themeMode!==e.initialThemeMode},e.isUser=function(){return e.userType===n.ut.USER},e.goBack=function(){const e=_.getPreviousRoute();(0,o.navigate)(e??"./")},e.updateCurrentUserData=function(){S.getCurrentUser().then(e=>w.updateAuthenticatedUser(e))},e.redirectAdmin=function(){e.currentUserData||c.redirectToLogin()},e.submit=function(){e.noPassword&&e.userType===n.ut.ADMIN?d.openSimpleModal({title:h.instant("security.save.admin.settings"),message:h.instant("security.admin.pass.unset"),warning:!0}).result.then(function(){e.updateUser()}):e.updateUser()},e.updateUserHttp=function(){e.loader=!0;const r=new o.User({username:e.user.username,password:e.noPassword?"":e.user.password||void 0,appSettings:e.user.appSettings});p.updateAuthenticatedUser(r).then(()=>{t.success(h.instant("security.user.updated",{name:e.user.username})),e.updateCurrentUserData(),y.setApplicationSettings(e.workbenchSettings),e.initialThemeMode=e.workbenchSettings.themeMode,e.themeChanged=!1,e.workbenchSettings.isSystemMode()?k.applyColorScheme():k.setThemeMode(e.workbenchSettings.themeMode),T()}).catch(e=>{const r=getError(e);t.error(r,h.instant("common.error"))}).finally(()=>{e.loader=!1})},e.updateUser=function(){if(!e.validateForm())return!1;e.updateUserHttp()},e.validateForm=function(){return e.validatePassword()},e.onDialogClose=()=>{e.showCookieConsentModal=!1},e.showCookiePolicy=t=>{t.preventDefault(),e.showCookieConsentModal=!0};const T=()=>{U=i(function(){e.loader=!1;const t=_.getPreviousRoute();(0,o.navigate)(t??"./")},2e3)},M=[C.onSystemThemeChanged(t=>{t&&(e.currentSystemTheme=t)})];e.$on("$destroy",function(){i.cancel(U),M.forEach(e=>e())}),(()=>{const t=w.getAuthenticatedUser();e.currentUserData=t.toUser(),e.redirectAdmin(),e.user={username:e.currentUserData.username},e.user.password="",e.user.confirmpassword="",e.user.external=e.currentUserData.external,e.user.appSettings=e.currentUserData.appSettings,void 0===e.user.appSettings.DEFAULT_VIS_GRAPH_SCHEMA&&(e.user.appSettings.DEFAULT_VIS_GRAPH_SCHEMA=!0),e.userType=e.currentUserData.getUserType(),e.grantedAuthorities=e.currentUserData.authorities.toUIModel(),e.customRoles=e.currentUserData.authorities.getCustomRoles()})(),e.workbenchSettings.themeMode=k.getThemeModeOrSystem(),e.initialThemeMode=e.workbenchSettings.themeMode,v.updateLicenseStatus().then(()=>{e.showCookiePolicyLink=g.isTrackingAllowed()})}angular.module("graphdb.framework.security.controllers.user-settings",["graphdb.framework.core.services.security-service"]).controller("UserSettingsController",i),i.$inject=["$scope","toastr","$window","$timeout","$jwtAuth","$rootScope","$controller","ModalService","$translate","$q","$uibModal","TrackingService"]},1767(e,t,r){r.d(t,{B1:()=>u,DX:()=>i,_5:()=>c,aj:()=>n,n5:()=>s,w0:()=>a,xF:()=>o});const s="SYSTEM",n="READ_REPO",o="READ_REPO_",i="WRITE_REPO",a="GRAPHQL",c="WRITE_REPO_",u="GRAPHQL_"}};
//# sourceMappingURL=50244.69475a004173b61902a8.bundle.js.map