@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
2 lines (1 loc) • 4.27 kB
JavaScript
import{e as oe}from"./chunk-L6MU6S2V.js";import{f as se}from"./chunk-JF7S3UYQ.js";import{d as re,e as I}from"./chunk-VPJ2V27B.js";import{B as z,L as R,N as A,O as W,Qa as ee,Qb as d,Wa as te,ea as E,fa as u,ga as J,ha as f,ia as K,ib as ie,ja as p,ka as Q,la as X,ma as Y,na as Z,sa as v}from"./chunk-4U5A2DEP.js";import{d as F}from"./chunk-BIUNUYZ5.js";import{Cb as y,Eb as U,Ed as V,Fd as q,G as M,Ma as S,Oc as j,Pb as $,Rb as k,Xa as T,bb as O,ca as w,dc as g,ec as L,fc as B,ha as c,lb as C,ma as P,na as x,nb as N,ob as b,pb as D,qb as _,rb as l,v as o,yd as H,zb as G}from"./chunk-HW2H3ISM.js";var m=class{constructor(i){this.isAdmin=!1,this.newly=0,this.applications=[],this.currentAccessHover=!1,this.setGroups(i),this.setManagers(i),Object.assign(this,i),this.isAdmin=i.role===R.ADMINISTRATOR,this.userRoleText=te(R[i.role]),this.avatarUrl=ie(i.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=(0,z.default)(this.currentAccess).fromNow(!0),this.newly=ee(this.currentAccess),this.permissions&&(this.applications=this.permissions.split(A))}setGroups(i){i?.groups&&(i.groups=i.groups.map(n=>new d(n)))}setManagers(i){i?.managers&&(i.managers=i.managers.map(n=>new d(n)))}};var h=class{constructor(i){Object.assign(this,i),this.permissions&&(this.applications=this.permissions.split(A))}};var xe=(()=>{let i=class i{constructor(){this.http=c(j),this.router=c(F),this.authService=c(se)}listUsers(e=!1){return this.http.get(e?K:J).pipe(o(t=>t.map(r=>new m(r))))}getUser(e,t=!1){return this.http.get(`${t?f:u}/${e}`).pipe(o(r=>t?new I(r):new m(r)))}createUser(e,t=!1){return this.http.post(t?f:u,e).pipe(o(r=>t?new I(r):new m(r)))}updateUser(e,t,r=!1){return this.http.put(`${r?f:u}/${e}`,t).pipe(o(a=>r?new I(a):new m(a)))}deleteUser(e,t,r=!1){return r?this.http.delete(`${f}/${e}`):this.http.request("delete",`${u}/${e}`,{body:t})}browseGroup(e,t=!1){return this.http.get(`${t?X:Q}${e?`/${e}`:""}`).pipe(o(r=>new re(r)))}getGroup(e){return this.http.get(`${p}/${e}`).pipe(o(t=>new h(t)))}createGroup(e){return this.http.post(p,e).pipe(o(t=>new h(t)))}updateGroup(e,t){return this.http.put(`${p}/${e}`,t).pipe(o(r=>new h(r)))}deleteGroup(e){return this.http.delete(`${p}/${e}`)}addUsersToGroup(e,t){return this.http.patch(`${p}/${e}/${E.USERS}`,t)}updateUserFromGroup(e,t,r){return this.http.patch(`${p}/${e}/${E.USERS}/${t}`,r)}removeUserFromGroup(e,t){return this.http.delete(`${p}/${e}/${E.USERS}/${t}`)}searchMembers(e,t=!1){return this.http.request("search",Y,{body:e}).pipe(o(r=>r.map(a=>(t&&delete a.description,new d(a)))),M(()=>[]))}impersonateUser(e,t){return this.http.post(`${Z}/${e}`,t)}initImpersonateUser(e){this.authService.initUserFromResponse(e,!0),this.router.navigate([v.BASE,v.ACCOUNT]).catch(console.error)}};i.\u0275fac=function(t){return new(t||i)},i.\u0275prov=w({token:i,factory:i.\u0275fac,providedIn:"root"});let s=i;return s})();function pe(s,i){if(s&1){let n=G();_(0,"div",3)(1,"label",4)(2,"input",5),y("change",function(t){let r=P(n).$implicit,a=U();return x(a.updatePermissions(r,t))}),l(),$(3),g(4,"translate"),g(5,"capitalize"),l()()}if(s&2){let n=i.$implicit,e=U();S(2),D("checked",e.permissions.indexOf(n)>-1)("value",n),S(),k(" ",L(5,6,B(4,3,n,e.locale.language))," ")}}var ke=(()=>{let i=class i{constructor(){this.permissions=[],this.permissionsChange=new O,this.locale=c(H),this.allApplications=Object.values(W)}updatePermissions(e,t){t.target.checked?this.permissions.push(e):this.permissions.splice(this.permissions.indexOf(e),1),this.permissionsChange.emit(this.permissions)}};i.\u0275fac=function(t){return new(t||i)},i.\u0275cmp=T({type:i,selectors:[["app-admin-permissions"]],inputs:{permissions:"permissions"},outputs:{permissionsChange:"permissionsChange"},decls:6,vars:0,consts:[[1,"d-flex","flex-column","col-12","pb-3"],["for","permissions","l10nTranslate",""],["id","permissions",1,"form-check","form-switch","form-check-inline"],[1,"d-flex"],[1,"form-check-label"],["type","checkbox",1,"form-check-input",3,"change","checked","value"]],template:function(t,r){t&1&&(_(0,"div",0)(1,"label",1),$(2,"Permissions"),l(),_(3,"div",2),N(4,pe,6,8,"div",3,C),l()()),t&2&&(S(4),b(r.allApplications))},dependencies:[q,oe,V],encapsulation:2});let s=i;return s})();export{m as a,xe as b,ke as c};