web-interface.assets.07ba022f-6087.29d38a600b9f5c9ae8ae.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["07ba022f-6087"],{RLbSMTbK:(F,c,t)=>{t.d(c,{Z:()=>E});var e=t("Z7aTuO5B"),l=t("VPaD/Np4"),a=t.n(l),n=t("X8pjX0rJ"),o=t.n(n),u=t("ii0bleBb"),R=t.n(u),r=t("J6y4/h8P"),m=t("Lu0NTOJv"),C=t("uZqmR+ju"),d=t("/GOzvPf6");const I=(0,r.default)(C.Button)`
margin-left: 15px;
`,Z=r.default.div`
display: flex;
`,x=r.default.div`
display: flex;
align-items: center;
`,D=(0,r.default)(d.Ph)`
flex: 1;
`,z=({label:s})=>e.createElement(x,null,s),W=(s,f,T)=>s.filter(p=>!f.includes(T(p))).toArray().map(p=>({label:p.name,value:p.name,role:p})),X=(s,f,T,p,O,y)=>{if(!s)return;const M=s.split(","),b=l.Set(o()(M.map(_=>f.find(G=>G.name===_))));if(b.size<=0){y(`Role assignment failed, because the roles ${s!=null?s:"(undefined)"} does not exist`);return}y(),O(!0),T(b).then(()=>{p(),O(!1)})},J=s=>{const f={page:1,perPage:0,query:""};m.Z.loadRolesPaginated(f).then(s)},K=({assignedRolesIds:s,onSubmit:f,identifier:T,submitOnSelect:p})=>{const[O,y]=(0,e.useState)(),[M,b]=(0,e.useState)(),[_,G]=(0,e.useState)(!1),[h,w]=(0,e.useState)();(0,e.useEffect)(()=>J(y),[]);const Y=V=>{p&&X(V,O.list,f,b,G,w),b(V)};if(!O)return e.createElement(d.$j,null);const L=()=>X(M,O.list,f,b,G,w),g=W(O.list,s,T);return e.createElement("div",null,e.createElement(Z,null,e.createElement(D,{inputProps:{"aria-label":"Search for roles"},onChange:Y,optionRenderer:z,options:g,placeholder:"Search for roles",multi:!0,value:M}),!p&&e.createElement(I,{bsStyle:"success",onClick:L,disabled:_||!M,title:"Assign Role",type:"button"},"Assign Role")),e.createElement(d.hW,{runtimeError:!0,onClose:w},h))};K.defaultProps={identifier:s=>s.id,submitOnSelect:!1},K.propTypes={identifier:R().func,onSubmit:R().func.isRequired,submitOnSelect:R().bool};const E=K},fdUTUHoJ:(F,c,t)=>{t.d(c,{Z:()=>n});var e=t("Z7aTuO5B"),l=t("/GOzvPf6");const n=()=>e.createElement(l.Fe,{label:"E-Mail Address",name:"email",maxLength:254,type:"email",required:!0,help:"The user's email address."})},ob0PYlhL:(F,c,t)=>{t.d(c,{Z:()=>n});var e=t("Z7aTuO5B"),l=t("/GOzvPf6");const n=()=>e.createElement(l.Fe,{label:"First Name",name:"first_name",maxLength:200,required:!0,help:"The user's first name."})},D4RgEuos:(F,c,t)=>{t.d(c,{Z:()=>n});var e=t("Z7aTuO5B"),l=t("/GOzvPf6");const n=()=>e.createElement(l.Fe,{label:"Last Name",name:"last_name",maxLength:200,required:!0,help:"The user's last name."})},PQfI17l6:(F,c,t)=>{t.d(c,{ZP:()=>R,jy:()=>o});var e=t("Z7aTuO5B"),l=t("/GOzvPf6"),a=t("uZqmR+ju");const n=6,o=(r,m,C)=>{const d={...r};return m&&m.lengthe.createElement(a.Input,{id:"password-field",label:"Password",help:`Passwords must be at least ${n} characters long. We recommend using a strong password.`,labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(a.Row,{className:"no-bm"},e.createElement(a.Col,{sm:6},e.createElement(l.jc,{name:"password",id:"password",maxLength:100,type:"password",placeholder:"Password",required:!0,formGroupClassName:"form-group no-bm",wrapperClassName:"col-xs-12",minLength:n})),e.createElement(a.Col,{sm:6},e.createElement(l.jc,{name:"password_repeat",id:"password_repeat",maxLength:100,type:"password",placeholder:"Repeat password",formGroupClassName:"form-group no-bm",required:!0,wrapperClassName:"col-xs-12",minLength:n}))));u.defaultProps={passwordRef:void 0,passwordRepeatRef:void 0};const R=u},"6cfBHc3J":(F,c,t)=>{t.d(c,{Z:()=>u});var e=t("Z7aTuO5B"),l=t("UiXZqrDE"),a=t("uZqmR+ju"),n=t("S6FuRS7B");const u=()=>{const[R,r]=(0,e.useState)(!1);return e.createElement(l.Field,{name:"service_account"},({field:{name:m,value:C,onChange:d}})=>{const I=D=>{(0,n.n6)(D.target)?r(!0):d(D)},Z=()=>{d({target:{name:m,value:!0}}),r(!1)},x=()=>{d({target:{name:m,value:!1}}),r(!1)};return e.createElement(e.Fragment,null,e.createElement(a.Input,{id:"service-account-controls",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9",label:"Service Account"},e.createElement(a.Input,{label:"User is a Service Account",id:"service_account",type:"checkbox",wrapperClassName:"col-sm-9",name:"service_account",checked:C!=null?C:!1,help:"When checked, the user becomes a Service Account and will be unable to log into the web interface and edit their settings. (e.g., API tokens)",onChange:D=>I(D)})),e.createElement(a.BootstrapModalConfirm,{showModal:R,title:"Are you sure?",onConfirm:Z,onCancel:x},"Changing this user to a Service Account prevents the user from logging into the web interface and editing their settings. (e.g., API tokens) Do you wish to proceed?"))})}},tgKevaL8:(F,c,t)=>{t.d(c,{Z:()=>K});var e=t("Z7aTuO5B"),l=t("UiXZqrDE"),a=t("ii0bleBb"),n=t.n(a),o=t("uZqmR+ju"),u=t("J6y4/h8P"),R=t("/GOzvPf6");const r=24*60*60*1e3,m=60*60*1e3,C=60*1e3,d=1e3,I=(0,u.default)(R.Ph)`
width: 150px;
`,Z=[{value:`${d}`,label:"Seconds"},{value:`${C}`,label:"Minutes"},{value:`${m}`,label:"Hours"},{value:`${r}`,label:"Days"}],D=E=>e.createElement(I,{...E,inputProps:{"aria-label":"Timeout unit"},options:Z}),z=E=>E===0?d:E%r===0?r:E%m===0?m:E%C===0?C:d,W=({value:E,onChange:s})=>{const[f,T]=(0,e.useState)(E===-1),[p,O]=(0,e.useState)(z(E)),[y,M]=(0,e.useState)(E?Math.floor(E/Number(p)):0),b=h=>{T(h.target.checked),s&&h.target.checked&&s(-1)},_=h=>{M(Number(h.target.value)),s&&s(Number(h.target.value)*Number(p))},G=h=>{O(h),s&&s(y*Number(h))};return e.createElement(o.Input,{id:"timeout-controls",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9",label:"Sessions Timeout"},e.createElement(o.Row,{className:"no-bm"},e.createElement(o.Col,{xs:12},e.createElement(o.Alert,{bsStyle:"info",title:"Changing the session timeout"},"Changing the timeout setting for sessions will log the user out of Graylog and will invalidate all their current sessions. If you are changing the setting for your own user, you will be logged out at the moment of saving the setting. In that case, make sure to save any pending changes before changing the timeout."))),e.createElement(e.Fragment,null,e.createElement(o.Input,{type:"checkbox",id:"session-timeout-never",name:"session_timeout_never",label:"Sessions do not time out",help:"When checked, sessions never time out due to inactivity.",formGroupClassName:"no-bm",onChange:b,checked:f}),e.createElement("div",{className:"clearfix"},e.createElement(o.Col,{xs:2},e.createElement(o.Input,{type:"number",id:"timeout",placeholder:"Timeout amount",name:"timeout",min:1,formGroupClassName:"form-group no-bm",disabled:f,value:y,onChange:_})),e.createElement(o.Col,{xs:4},e.createElement(D,{disabled:f,value:String(p),onChange:G})),e.createElement(o.Row,{className:"no-bm"},e.createElement(o.Col,{xs:12},e.createElement(o.HelpBlock,null,"Session automatically end after this amount of time, unless they are actively used."))))))};W.propTypes={value:n().number,onChange:n().func},W.defaultProps={value:m,onChange:()=>{}};const X=W,K=()=>e.createElement(l.Field,{name:"session_timeout_ms"},({field:{name:E,value:s,onChange:f}})=>e.createElement(X,{value:s,onChange:T=>f({target:{name:E,value:T}})}))},"rLQ+VmDx":(F,c,t)=>{t.d(c,{Z:()=>u});var e=t("Z7aTuO5B"),l=t("UiXZqrDE"),a=t("uZqmR+ju"),n=t("/GOzvPf6");const u=()=>e.createElement(l.FastField,{name:"timezone"},({field:{name:R,value:r,onChange:m}})=>e.createElement(a.Input,{id:"timezone-select",label:"Time Zone",help:"Choose your local time zone or leave it as it is to use the system's default.",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9"},e.createElement(n.Cc,{className:"timezone-select",value:r,name:"timezone",onChange:C=>m({target:{name:R,value:C}})})))},"Yul/IdmX":(F,c,t)=>{t.r(c),t.d(c,{default:()=>me});var e=t("Z7aTuO5B"),l=t("ty2gyrHp"),a=t("d4kzUuQm"),n=t("E+CaPsQD"),o=t("uZqmR+ju"),u=t("/GOzvPf6"),R=t("J6y4/h8P"),r=t("VPaD/Np4"),m=t("UiXZqrDE"),C=t("QL8i6bcz"),d=t("RCNj0OY4"),I=t("vMorKP/N"),Z=t("92lPlKXC"),x=t("a/tXGb/M"),D=t("RLbSMTbK"),z=t("cSDA0Pof"),W=t("eZ5nxjAy"),X=t("/7OuCFNo"),J=t("MdYBRjRJ"),K=t("8OvTct/Z"),E=t("0t7Ye+61"),s=t("v4GbOr/o"),f=t("rLQ+VmDx"),T=t("tgKevaL8"),p=t("ob0PYlhL"),O=t("D4RgEuos"),y=t("fdUTUHoJ"),M=t("PQfI17l6");const _=()=>e.createElement(u.Fe,{label:"Username",name:"username",required:!0,help:"Select a unique user name used to log in with."});var G=t("6cfBHc3J"),h=t("QBkUz07U"),w=t("MLDs3jaY");const Y=(0,R.default)(u.mv)`
margin-bottom: 20px;
.read-only-value-col {
padding-top: 0;
}
`,L=d.Z.isCloud(),g=L?C.G.exports("cloud")[0].oktaUserForm:null,V=(P,i,A,N)=>{let S={...i,roles:A.toJS(),permissions:[]};if(delete S.password_repeat,L&&g){const{onCreate:U}=g;S=U(S)}else S.username=S.username.trim();return N(null),Z.Z.create(S).then(()=>{P.push(a.ZP.SYSTEM.USERS.OVERVIEW)},U=>N(U))},$=async(P,i)=>{const A={...P};try{await z.X.loadByUsername(i),A.username="Username is already taken"}catch{}return A},ee=600,te=(0,W.Z)($,ee),oe=async P=>{let i={};const{password:A,password_repeat:N,username:S}=P;if(S&&(i=await te(i,S)),L&&g){const{validations:{password:U}}=g;i=U(i,A,N)}else i=(0,M.jy)(i,A,N);return i},se=()=>{if(L&&g){const{fields:{password:P}}=g;return e.createElement(P,null)}return e.createElement(M.ZP,null)},ne=()=>{if(L&&g){const{fields:{username:P}}=g;return P&&e.createElement(P,null)}return e.createElement(_,null)},ae=()=>{if(L&&g){const{fields:{email:P}}=g;return P&&e.createElement(P,null)}return e.createElement(y.Z,null)},le=()=>{const P={name:"Reader",description:"Grants basic permissions for every Graylog user (built-in)",id:""},[i,A]=(0,e.useState)(I.Z.empty().toBuilder().roles(r.Set([P.name])).build()),[N,S]=(0,e.useState)(),[U,Q]=(0,e.useState)(r.Set([P])),k=(0,X.Z)(),{pathname:ce}=(0,E.Z)(),ue=(0,K.Z)(),ie=(0,w.Z)(),de=v=>{Q(U.union(v));const j=v.map(B=>B.name);return Promise.resolve(A(i.toBuilder().roles(i.roles.union(j)).build()))},Ee=v=>{Q(U.remove(v)),A(i.toBuilder().roles(i.roles.remove(v==null?void 0:v.name)).build())},ve=()=>k.push(a.ZP.SYSTEM.USERS.OVERVIEW),q=U.size>0&&U.filter(v=>v.name==="Reader"||v.name==="Admin"),fe=v=>{var j,B;if(L&&g){const{extractSubmitError:H}=g;return H(v)}return(B=(j=v==null?void 0:v.additional)==null?void 0:j.res)==null?void 0:B.text},pe=v=>{V(k,v,i.roles,S),ue(s.A.USERS.USER_CREATED,{app_pathname:(0,J.av)(ce),app_action_value:"user-create-form"})};return e.createElement(o.Row,{className:"content"},e.createElement(o.Col,{lg:8},e.createElement(m.Formik,{onSubmit:pe,validate:oe,initialValues:{}},({isSubmitting:v,isValid:j})=>e.createElement(m.Form,{className:"form form-horizontal"},e.createElement("div",null,e.createElement(h.s,null,"Profile"),e.createElement(p.Z,null),e.createElement(O.Z,null),e.createElement(ne,null),e.createElement(ae,null)),e.createElement("div",null,e.createElement(h.s,null,"Settings"),ie?e.createElement(Y,{label:"Sessions Timeout",value:e.createElement(u.pJ,null,"User session timeout is not editable because the",e.createElement(u.AE,{permissions:["clusterconfigentry:read"]},e.createElement(l.r,{to:a.ZP.SYSTEM.CONFIGURATIONS},"global session timeout"))," is enabled.")}):e.createElement(T.Z,null),e.createElement(f.Z,null),e.createElement(G.Z,null)),e.createElement("div",null,e.createElement(h.s,null,"Roles"),e.createElement(o.Input,{id:"roles-selector-input",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9",label:"Assign Roles"},e.createElement(D.Z,{onSubmit:de,assignedRolesIds:i.roles,identifier:B=>B.name,submitOnSelect:!0})),e.createElement(o.Input,{id:"selected-roles-overview",labelClassName:"col-sm-3",wrapperClassName:"col-sm-9",label:"Selected Roles"},e.createElement(e.Fragment,null,U.map(B=>e.createElement(x.Z,{item:B,onDeleteItem:H=>Ee(H),key:B.id})),!q&&e.createElement(o.Alert,{bsStyle:"danger"},"You need to select at least one of the ",e.createElement("em",null,"Reader")," or ",e.createElement("em",null,"Admin")," roles.")))),e.createElement("div",null,e.createElement(h.s,null,"Password"),e.createElement(se,null)),N&&e.createElement(o.Row,null,e.createElement(o.Col,{xs:9,xsOffset:3},e.createElement(o.Alert,{bsStyle:"danger",title:"Failed to create user"},fe(N)))),e.createElement(o.Row,null,e.createElement(o.Col,{md:9,mdOffset:3},e.createElement(u.Ow,{disabledSubmit:!j||!q,submitButtonText:"Create user",submitLoadingText:"Creating user...",isSubmitting:v,isAsyncSubmit:!0,onCancel:ve})))))))};var re=t("WqhT36Vr");const me=()=>e.createElement(u.$4,{title:"Create New User"},e.createElement(re.Z,null),e.createElement(u.mr,{title:"Create New User",actions:e.createElement(l.J,{to:a.ZP.SYSTEM.USERS.CREATE},e.createElement(o.Button,{bsStyle:"success"},"Create user")),documentationLink:{title:"Permissions documentation",path:n.Z.PAGES.USERS_ROLES}},e.createElement("span",null,"Use this page to create new Graylog users. The users and their permissions created here are not limited to the web interface but valid and required for the REST APIs of your Graylog server nodes, too.")),e.createElement(le,null))}}]);})();
//# sourceMappingURL=07ba022f-6087.29d38a600b9f5c9ae8ae.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy