web-interface.assets.1255d548-6217.581e5afb0549c8466e52.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-6217"],{SfPIQIJE:(M,C,t)=>{t.d(C,{Z:()=>_});var e=t("Z7aTuO5B"),E=t("J6y4/h8P"),c=t("uZqmR+ju"),d=t("ty2gyrHp"),A=t("/GOzvPf6"),s=t("NV1/EHMi");const l=(0,E.default)(c.ButtonToolbar)`
margin-bottom: 10px;
`,i=(0,E.default)(c.Button)(({theme:u})=>(0,E.css)`
font-family: ${u.fonts.family.navigation};
font-size: ${u.fonts.size.navigation};
&&&& {
color: ${u.colors.variant.darker.default};
&:hover,
&:focus {
text-decoration: none;
}
> div {
&:hover,
&:focus {
color: ${u.colors.variant.darker.default};
}
}
&:hover {
${(0,s.RF)(u)}
}
&.active {
color: ${u.colors.global.textDefault};
${(0,s.A7)(u)}
&:hover,
&:focus {
${(0,s.A7)(u)}
}
}
}
`);i.displayName="Button";const _=({items:u})=>e.createElement(l,null,u.map(({path:h,title:U,permissions:T,exactPathMatch:P})=>h?e.createElement(A.AE,{permissions:T!=null?T:[],key:h},e.createElement(d.J,{to:h,relativeActive:!P},e.createElement(i,{bsStyle:"link"},e.createElement(s.ZP,null,U)))):null))},ynz3ptM5:(M,C,t)=>{t.d(C,{Z:()=>s});var e=t("Z7aTuO5B"),E=t("ty2gyrHp"),c=t("d4kzUuQm"),d=t("uZqmR+ju");const s=({userId:l,userIsReadOnly:i})=>e.createElement(d.ButtonToolbar,null,e.createElement(E.J,{to:c.ZP.SYSTEM.USERS.show(l)},e.createElement(d.Button,{bsStyle:"success"},"View Details")),!i&&e.createElement(E.J,{to:c.ZP.SYSTEM.USERS.edit(l)},e.createElement(d.Button,{bsStyle:"success"},"Edit User")),e.createElement(E.J,{to:c.ZP.SYSTEM.USERS.TOKENS.edit(l)},e.createElement(d.Button,{bsStyle:"success"},"Edit Tokens")))},WqhT36Vr:(M,C,t)=>{t.d(C,{Z:()=>s});var e=t("Z7aTuO5B"),E=t("d4kzUuQm"),c=t("SfPIQIJE"),d=t("uZqmR+ju");const s=()=>{const l=[{title:"Users Overview",path:E.ZP.SYSTEM.USERS.OVERVIEW,permissions:"users:list"},{title:"Teams Overview",path:E.ZP.getPluginRoute("SYSTEM_TEAMS"),permissions:"teams:list"}];return e.createElement(d.Row,null,e.createElement(c.Z,{items:l}))}},"92lPlKXC":(M,C,t)=>{t.d(C,{Z:()=>P});var e=t("cSDA0Pof"),E=t("lDGobrly");const c=(0,E.Z)({action:e.X.create,success:o=>({message:`User "${o==null?void 0:o.first_name} ${o==null?void 0:o.last_name}" was created successfully`}),error:(o,n)=>({message:`Creating user "${n==null?void 0:n.first_name} ${n==null?void 0:n.last_name}" failed with status: ${o}`})}),d=(0,E.Z)({action:e.X.load,error:(o,n)=>({message:`Loading user with id "${n}" failed with status: ${o}`}),notFoundRedirect:!0}),A=(0,E.Z)({action:e.X.loadByUsername,error:(o,n)=>({message:`Loading user with username "${n}" failed with status: ${o}`}),notFoundRedirect:!0}),s=(0,E.Z)({action:e.X.update,success:(o,n,a)=>({message:`User "${a}" was updated successfully`}),error:(o,n,a,r)=>({message:`Updating user "${r}" failed with status: ${o}`})}),l=(0,E.Z)({action:e.X.delete,success:(o,n)=>({message:`User "${n}" was deleted successfully`}),error:(o,n,a)=>({message:`Deleting user "${a}" failed with status: ${o}`})}),i=(0,E.Z)({action:e.X.changePassword,success:()=>({message:"Password was changed successfully "}),error:(o,n)=>({message:`Changing password for user with id "${n}" failed with status: ${o}`})}),v=(0,E.Z)({action:e.X.createToken,success:(o,n)=>({message:`Token "${n}" created successfully`}),error:(o,n,a)=>({message:`Creating token "${a}" for user with id "${n}" failed with status: ${o}`})}),_=(0,E.Z)({action:e.X.loadTokens,error:(o,n)=>({message:`Loading tokens for user with id "${n}" failed with status: ${o}`})}),u=(0,E.Z)({action:e.X.deleteToken,success:(o,n,a)=>({message:`Token "${a}" deleted successfully`}),error:(o,n,a,r)=>({message:`Deleting token "${r}" for user with id "${n}" failed with status: ${o}`})}),h=(0,E.Z)({action:e.X.loadUsers,error:o=>({message:`Loading users failed with status: ${o}`})}),U=(0,E.Z)({action:e.X.loadUsersPaginated,error:o=>({message:`Loading users failed with status: ${o}`})}),T=(0,E.Z)({action:e.X.setStatus,success:(o,n)=>({message:`User "${o}" was set to ${n}`}),error:(o,n,a)=>({message:`Updating user ("${n}") to ${a} failed with status: ${o}`})}),P={create:c,load:d,loadByUsername:A,update:s,delete:l,changePassword:i,createToken:v,loadTokens:_,deleteToken:u,loadUsers:h,loadUsersPaginated:U,setStatus:T}},"nmSm+aR9":(M,C,t)=>{t.d(C,{Z:()=>c});var e=t("VPaD/Np4"),E=t.n(e);class c{constructor(s,l,i,v,_,u,h,U,T,P,o,n,a,r,m){this._value={id:s,username:l,fullName:i,email:v,roles:_,readOnly:u,external:h,sessionActive:U,clientAddress:T,lastActivity:P,enabled:o,authServiceId:n,authServiceUid:a,authServiceEnabled:r,accountStatus:m}}get id(){return this._value.id}get username(){return this._value.username}get name(){return this._value.username}get fullName(){return this._value.fullName}get description(){return this._value.fullName}get email(){return this._value.email}get roles(){return this._value.roles}get readOnly(){return this._value.readOnly}get external(){return this._value.external}get sessionActive(){return this._value.sessionActive}get clientAddress(){return this._value.clientAddress}get lastActivity(){return this._value.lastActivity}get enabled(){return this._value.enabled}get authServiceId(){return this._value.authServiceId}get authServiceUid(){return this._value.authServiceUid}get authServiceEnabled(){return this._value.authServiceEnabled}get accountStatus(){return this._value.accountStatus}toBuilder(){const{id:s,username:l,fullName:i,email:v,roles:_,readOnly:u,external:h,sessionActive:U,clientAddress:T,lastActivity:P,enabled:o,authServiceId:n,authServiceUid:a,authServiceEnabled:r,accountStatus:m}=this._value;return new d(e.Map({id:s,username:l,fullName:i,email:v,roles:_,readOnly:u,external:h,sessionActive:U,clientAddress:T,lastActivity:P,enabled:o,authServiceId:n,authServiceUid:a,authServiceEnabled:r,accountStatus:m}))}static create(s,l,i,v,_,u,h,U,T,P,o,n,a,r,m){return new c(s,l,i,v,_,u,h,U,T,P,o,n,a,r,m)}toJSON(){const{id:s,username:l,fullName:i,email:v,roles:_,readOnly:u,external:h,sessionActive:U,clientAddress:T,lastActivity:P,enabled:o,authServiceId:n,authServiceUid:a,authServiceEnabled:r,accountStatus:m}=this._value;return{id:s,username:l,full_name:i,email:v,roles:_.toArray(),read_only:u,external_user:h,session_active:U,client_address:T,last_activity:P,enabled:o,auth_service_id:n,auth_service_uid:a,auth_service_enabled:r,account_status:m}}static fromJSON(s){const{id:l,username:i,full_name:v,email:_,roles:u,read_only:h,external_user:U,session_active:T,client_address:P,last_activity:o,enabled:n,auth_service_id:a,auth_service_uid:r,auth_service_enabled:m,account_status:I}=s;return c.create(l,i,v,_,e.Set(u),h!=null?h:!1,U!=null?U:!1,T!=null?T:!1,P,o,n,a,r,m,I)}static builder(){return new d}}class d{constructor(s=e.Map()){this.value=s}id(s){return new d(this.value.set("id",s))}username(s){return new d(this.value.set("username",s))}fullName(s){return new d(this.value.set("fullName",s))}email(s){return new d(this.value.set("email",s))}roles(s){return new d(this.value.set("roles",s))}readOnly(s){return new d(this.value.set("readOnly",s))}external(s){return new d(this.value.set("external",s))}sessionActive(s){return new d(this.value.set("sessionActive",s))}clientAddress(s){return new d(this.value.set("clientAddress",s))}lastActivity(s){return new d(this.value.set("lastActivity",s))}enabled(s){return new d(this.value.set("enabled",s))}authServiceId(s){return new d(this.value.set("authServiceId",s))}authServiceUid(s){return new d(this.value.set("authServiceUid",s))}authServiceEnabled(s){return new d(this.value.set("authServiceEnabled",s))}accountStatus(s){return new d(this.value.set("accountStatus",s))}build(){const{id:s,username:l,fullName:i,email:v,roles:_,readOnly:u,external:h,sessionActive:U,clientAddress:T,lastActivity:P,enabled:o,authServiceId:n,authServiceUid:a,authServiceEnabled:r,accountStatus:m}=this.value.toObject();return new c(s,l,i,v,_,u,h,U,T,P,o,n,a,r,m)}}},uzHJ6m8N:(M,C,t)=>{t.r(C),t.d(C,{default:()=>G});var e=t("Z7aTuO5B"),E=t("c9JM82dZ"),c=t("uZqmR+ju"),d=t("0TVxnHwi"),A=t("E+CaPsQD"),s=t("92lPlKXC"),l=t("/GOzvPf6"),i=t("QBkUz07U"),v=t("ii0bleBb"),_=t.n(v),u=t("J6y4/h8P"),h=t("1/PeS1Oa");const U=u.default.form`
margin-top: 10px;
&.form-inline > .form-group {
margin-right: 10px;
> input {
width: 300px;
}
}
`,T=({creatingToken:g,onCreate:D})=>{const[O,p]=(0,e.useState)(""),S=y=>{y.preventDefault(),D(O),p("")};return e.createElement(U,{className:"form-inline",onSubmit:S},e.createElement(c.FormGroup,{controlId:"create-token-input"},e.createElement(c.ControlLabel,null,"Token Name"),e.createElement(c.FormControl,{type:"text",placeholder:"What is this token for?",value:O,onChange:y=>p(y.target.value)})),e.createElement(c.Button,{id:"create-token",disabled:O===""||g,type:"submit",bsStyle:"primary"},g?e.createElement(l.$j,{text:"Creating..."}):"Create Token"))};T.propTypes={creatingToken:_().bool,onCreate:_().func.isRequired},T.defaultProps={creatingToken:!1};const P=T,o=(0,u.default)(c.Panel)`
&.panel {
margin: 10px 0;
background-color: ${g=>g.theme.colors.global.contentBackground};
.panel-heading {
color: ${g=>g.theme.colors.gray[30]};
}
}
`,n=(0,u.default)(l.mU)`
vertical-align: baseline;
margin-left: 1em;
`,a=(0,u.default)(l.UI)`
margin-bottom: 10px;
`,r=u.default.div`
color: ${g=>g.theme.colors.gray[60]};
font-size: ${g=>g.theme.fonts.size.small};
margin-bottom: 5px;
`,m=({creatingToken:g,deletingToken:D,onCreate:O,onDelete:p,tokens:S})=>{const[y,W]=(0,e.useState)(),[$,N]=(0,e.useState)(""),k=(0,e.useMemo)(()=>{const f=new RegExp($,"i");return S.filter(({name:L})=>f.test(L)).sort((L,B)=>(0,h.d)(L.last_access,B.last_access,"desc"))},[$,S]),w=f=>{O(f).then(B=>(W(B),B))},x=f=>()=>{p(f.id,f.name)},Z=f=>N(f||"");return e.createElement("span",null,e.createElement(P,{onCreate:w,creatingToken:g}),y&&e.createElement(o,{bsStyle:"success"},e.createElement(c.Panel.Heading,null,e.createElement(c.Panel.Title,null,"Token ",e.createElement("em",null,y.name)," created!")),e.createElement(c.Panel.Body,null,e.createElement("p",null,"This is your new token. Make sure to copy it now, you will not be able to see it again."),e.createElement("pre",null,y.token,e.createElement(n,{title:e.createElement(l.JO,{name:"clipboard",fixedWidth:!0}),text:y.token,bsSize:"xsmall"})),e.createElement(c.Button,{bsStyle:"primary",onClick:()=>W(void 0)},"Done"))),e.createElement("hr",null),e.createElement(a,{onSearch:Z,onReset:Z,label:"Filter",useLoadingState:!1}),e.createElement(l.dr,null,e.createElement(l.dr.Header,null),k.length===0&&e.createElement(l.dr.Item,null,e.createElement("p",null,$===""?"No tokens to display.":"No tokens match the filter.")),k.map(f=>{const L=Date.parse(f.last_access)===0;return e.createElement(l.dr.Item,{key:f.id},e.createElement(c.Row,{className:"row-sm"},e.createElement(c.Col,{md:9},f.name,e.createElement(r,null,L?"Never used":e.createElement(e.Fragment,null,"Last used ",e.createElement(l.ij,{dateTime:f.last_access})))),e.createElement(c.Col,{md:3,className:"text-right"},e.createElement(c.Button,{bsSize:"xsmall",disabled:D===f.id,bsStyle:"primary",onClick:x(f)},D===f.id?e.createElement(l.$j,{text:"Deleting..."}):"Delete"))))})))};m.propTypes={tokens:_().arrayOf(_().object),onDelete:_().func,onCreate:_().func,creatingToken:_().bool,deletingToken:_().string},m.defaultProps={tokens:[],onDelete:()=>{},onCreate:()=>{},creatingToken:!1,deletingToken:void 0};const I=m;var R=t("WqhT36Vr"),K=t("ynz3ptM5"),J=t("q2j1bVbz");const X=({fullName:g})=>e.createElement(e.Fragment,null,"Edit Tokens Of User ",g&&e.createElement(e.Fragment,null,"- ",e.createElement("i",null,g))),F=(g,D,O)=>{g&&((0,d.rq)(D==null?void 0:D.permissions,[`users:tokenlist:${g.username}`])?s.Z.loadTokens(g.id).then(O):O([]))},z=(g,D,O,p,S)=>{const y=s.Z.deleteToken(O,g,D);S(g),y.then(()=>{p(),S(void 0)})},j=(g,D,O,p)=>{const S=s.Z.createToken(D,g);return p(!0),S.then(y=>(O(),p(!1),y))},V=({params:g})=>{var D,O;const p=(0,J.Z)(),[S,y]=(0,e.useState)(),[W,$]=(0,e.useState)([]),[N,k]=(0,e.useState)(),[w,x]=(0,e.useState)(!1),Z=g==null?void 0:g.userId,f=(0,e.useCallback)(()=>F(S,p,$),[p,S]),L=(b,Q)=>z(b,Q,Z,f,k),B=b=>j(b,Z,f,x);return(0,e.useEffect)(()=>{f()},[f,S]),(0,e.useEffect)(()=>{s.Z.load(Z).then(y)},[Z]),e.createElement(l.$4,{title:`Edit Tokens Of User ${(D=S==null?void 0:S.fullName)!=null?D:""}`},e.createElement(R.Z,null),e.createElement(l.mr,{title:e.createElement(X,{fullName:S==null?void 0:S.fullName}),actions:e.createElement(K.Z,{userId:Z,userIsReadOnly:(O=S==null?void 0:S.readOnly)!=null?O:!1}),documentationLink:{title:"Permissions documentation",path:A.Z.PAGES.USERS_ROLES}},e.createElement("span",null,"You can create new tokens or delete old ones.")),e.createElement(c.Row,{className:"content"},e.createElement(c.Col,{lg:8},e.createElement(i.s,null,"Create And Edit Tokens"),S?e.createElement(I,{tokens:W,onDelete:L,onCreate:B,creatingToken:w,deletingToken:N}):e.createElement(c.Row,null,e.createElement(c.Col,{xs:12},e.createElement(l.$j,null))))))},G=(0,E.Z)(V)},c9JM82dZ:(M,C,t)=>{t.d(C,{Z:()=>d});var e=t("Z7aTuO5B"),E=t("yAXMqwrl");const d=A=>s=>{const l=(0,E.useParams)();return e.createElement(A,{...s,params:l})}},cSDA0Pof:(M,C,t)=>{t.d(C,{X:()=>P});var e=t("JnTtTRmZ"),E=t.n(e),c=t("VPaD/Np4"),d=t.n(c),A=t("oCSEoDew"),s=t.n(A),l=t("nmSm+aR9"),i=t("eFxcQyPT"),v=t("U1Iufsob"),_=t("IA3Ku5lS"),u=t("MdYBRjRJ"),h=t("gyRmhZSW"),U=t("vMorKP/N");const T=({url:n="",query:a={}})=>{const r=new(s())(n);return r.query(a),(0,u.DC)(r.resource())},P=(0,_.ei)("core.Users",()=>E().createActions({create:{asyncResult:!0},load:{asyncResult:!0},loadByUsername:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},changePassword:{asyncResult:!0},createToken:{asyncResult:!0},loadTokens:{asyncResult:!0},deleteToken:{asyncResult:!0},loadUsersPaginated:{asyncResult:!0},loadUsers:{asyncResult:!0},setStatus:{asyncResult:!0}})),o=(0,_.dS)("core.Users",()=>E().createStore({listenables:[P],create(n){const a=(0,u.DC)(v.Z.UsersApiController.create().url),r=(0,i.ZP)("POST",a,n);return P.create.promise(r),r},load(n){const a=(0,u.DC)(v.Z.UsersApiController.load(encodeURIComponent(n)).url),r=(0,i.ZP)("GET",a).then(U.Z.fromJSON);return P.load.promise(r),r},loadByUsername(n){const a=(0,u.DC)(v.Z.UsersApiController.loadByUsername(encodeURIComponent(n)).url),r=(0,i.ZP)("GET",a).then(U.Z.fromJSON);return P.loadByUsername.promise(r),r},update(n,a){const r=(0,u.DC)(v.Z.UsersApiController.update(encodeURIComponent(n)).url),m=(0,i.ZP)("PUT",r,a);return P.update.promise(m),m},delete(n){const a=(0,u.DC)(v.Z.UsersApiController.delete(encodeURIComponent(n)).url),r=(0,i.ZP)("DELETE",a);return P.delete.promise(r),r},changePassword(n,a){const r=(0,u.DC)(v.Z.UsersApiController.changePassword(encodeURIComponent(n)).url),m=(0,i.ZP)("PUT",r,a);return P.changePassword.promise(m),m},createToken(n,a){const r=(0,u.DC)(v.Z.UsersApiController.create_token(encodeURIComponent(n),encodeURIComponent(a)).url),m=(0,i.ZP)("POST",r);return P.createToken.promise(m),m},loadTokens(n){const a=(0,u.DC)(v.Z.UsersApiController.list_tokens(encodeURIComponent(n)).url),r=(0,i.ZP)("GET",a).then(m=>m.tokens);return P.loadTokens.promise(r),r},deleteToken(n,a){const r=(0,u.DC)(v.Z.UsersApiController.delete_token(encodeURIComponent(n),encodeURIComponent(a)).url),m=(0,i.ZP)("DELETE",r);return P.deleteToken.promise(m),m},loadUsers(n={}){const a=T({url:v.Z.UsersApiController.list().url,query:n}),r=(0,i.ZP)("GET",a).then(({users:m})=>c.List(m.map(I=>l.Z.fromJSON(I))));return P.loadUsers.promise(r),r},loadUsersPaginated({page:n,perPage:a,query:r}){const m=(0,h.Z)(v.Z.UsersApiController.paginated().url,n,a,r),I=(0,i.ZP)("GET",(0,u.DC)(m)).then(R=>({adminUser:R.context.admin_user?l.Z.fromJSON(R.context.admin_user):void 0,list:c.List(R.users.map(K=>l.Z.fromJSON(K))),pagination:{page:R.page,perPage:R.per_page,query:R.query,count:R.count,total:R.total}}));return P.loadUsersPaginated.promise(I),I},setStatus(n,a){const r=(0,u.DC)(v.Z.UsersApiController.setStatus(n,a).url),m=(0,i.ZP)("PUT",r);return P.setStatus.promise(m),m}}))},"1/PeS1Oa":(M,C,t)=>{t.d(C,{Q:()=>A,d:()=>d});var e=t("9oVghaOd"),E=t.n(e),c=t("4E3oowBb");function d(s,l,i="asc"){const v=E()(s),_=E()(l);return i==="asc"?v.isBefore(_)?-1:_.isBefore(v)?1:0:_.isBefore(v)?-1:v.isBefore(_)?1:0}function A(s,l,i="asc"){return i==="asc"?(0,c.S)(s.toLowerCase(),l.toLowerCase()):(0,c.S)(l.toLowerCase(),s.toLowerCase())}}}]);})();
//# sourceMappingURL=1255d548-6217.581e5afb0549c8466e52.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy