web-interface.assets.bb8c8232-8997.326a79cbe1e9cb0e6697.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-8997"],{"dan3/ZI+":($,h,t)=>{t.d(h,{A:()=>m,n:()=>e.n});var e=t("xfUIbHjs");const m=e.A},"tJ+zurXu":($,h,t)=>{t.d(h,{A:()=>c});var e=t("Z7aTuO5B"),m=t("QBkUz07U"),g=t("IOI9nV80");const c=({role:{name:E,description:U}})=>e.createElement(m.A,{title:"Profile"},e.createElement(g.WY,{label:"Name",value:E}),e.createElement(g.WY,{label:"Description",value:U}))},QFEPqbjA:($,h,t)=>{t.d(h,{A:()=>E});var e=t("Z7aTuO5B"),m=t("ty2gyrHp"),g=t("d4kzUuQm"),l=t("rIl5IEuP");const E=({roleId:U})=>e.createElement(l.ButtonToolbar,null,e.createElement(m.m,{to:g.Ay.SYSTEM.AUTHZROLES.show(U)},e.createElement(l.Button,{bsStyle:"success"},"View Details")),e.createElement(m.m,{to:g.Ay.SYSTEM.AUTHZROLES.edit(U)},e.createElement(l.Button,{bsStyle:"success"},"Edit Role")))},Lu0NTOJv:($,h,t)=>{t.d(h,{A:()=>f});var e=t("KOKBnITH"),m=t("lDGobrly");const g=(0,m.A)({action:e.v.load,error:(v,a)=>({message:`Loading role with id "${a}" failed with status: ${v}`}),notFoundRedirect:!0}),l=(0,m.A)({action:e.v.delete,success:(v,a)=>({message:`Role "${a}" was deleted successfully`}),error:(v,a,p)=>({message:`Deleting role "${p}" failed with status: ${v}`})}),c=(0,m.A)({action:e.v.addMembers,success:(v,a)=>({message:`Users:"${a.join(", ")}" were assigned successfully`}),error:(v,a,p)=>({message:`Assigning users "${p.join(", ")}" failed with status: ${v}`})}),E=(0,m.A)({action:e.v.removeMember,success:(v,a)=>({message:`User "${a}" was unassigned successfully`}),error:(v,a,p)=>({message:`Unassign user "${p}" failed with status: ${v}`})}),U=(0,m.A)({action:e.v.loadUsersForRole,error:(v,a,p)=>({message:`Loading users for role "${p}" failed with status: ${v}`})}),C=(0,m.A)({action:e.v.loadRolesForUser,error:(v,a)=>({message:`Loading roles for user "${a}" failed with status: ${v}`})}),M=(0,m.A)({action:e.v.loadRolesPaginated,error:v=>({message:`Loading roles failed with status: ${v}`})}),f={load:g,delete:l,addMembers:c,removeMember:E,loadUsersForRole:U,loadRolesForUser:C,loadRolesPaginated:M}},tGaNIta6:($,h,t)=>{t.r(h),t.d(h,{default:()=>oe});var e=t("Z7aTuO5B"),m=t("c9JM82dZ"),g=t("ty2gyrHp"),l=t("IOI9nV80"),c=t("J6y4/h8P"),E=t("Lu0NTOJv"),U=t("dan3/ZI+"),C=t("QBkUz07U"),M=t("MdYBRjRJ"),f=t("8OvTct/Z"),v=t("0t7Ye+61"),a=t("v4GbOr/o"),p=t("UiXZqrDE"),N=t("X8pjX0rJ"),Z=t.n(N),L=t("VPaD/Np4"),H=t("KOKBnITH"),u=t("92lPlKXC"),s=t("rIl5IEuP");const n=(0,c.default)(s.Button)`
margin-left: 15px;
`,o=c.default.div`
display: flex;
`,d=c.default.div(({theme:r})=>(0,c.css)`
width: 100%;
margin-top: 3px;
color: ${r.colors.variant.danger};
> * {
margin-right: 5px;
&:last-child {
margin-right: 0;
}
}
`),i=c.default.div`
display: flex;
align-items: center;
`,O=(0,c.default)(l.l6)`
flex: 1;
`,z=({label:r})=>e.createElement(i,null,r),X=r=>T=>T?void 0:`The ${r} is required`,G=({role:r,onSubmit:T})=>{const[A,B]=(0,e.useState)(L.List.of()),[I,j]=(0,e.useState)([]),[W,b]=(0,e.useState)(),F=(0,e.useCallback)(()=>{const y={page:1,perPage:0,query:""};u.A.loadUsersPaginated(y).then(P=>{const K=P.list.filter(S=>!S.roles.includes(r.name)).map(S=>({label:S.name,value:S.name})).toArray();j(K),B(P.list)})},[r]),J=({user:y},{resetForm:P})=>{if(!y)return;const K=y.split(","),S=L.Set(Z()(K.map(R=>A.find(D=>D.username===R))));if(!S){b(`This is an exceptional error! Unable to find user with name ${y} in ${A.map(R=>R.username).join(", ")}`);return}b(void 0),T(S).then(()=>{P()})};return(0,e.useEffect)(()=>{F();const y=H.v.addMembers.completed.listen(F),P=H.v.removeMember.completed.listen(F);return()=>{P(),y()}},[r,F]),e.createElement("div",null,e.createElement(l.$p,{onClose:b,runtimeError:!0},W),e.createElement(p.Formik,{onSubmit:J,initialValues:{user:void 0}},({isSubmitting:y,isValid:P,errors:K})=>e.createElement(p.Form,null,e.createElement(o,null,e.createElement(p.Field,{name:"user",validate:X("user")},({field:{name:S,value:R,onChange:D}})=>e.createElement(O,{inputProps:{"aria-label":"Search for users"},onChange:re=>{D({target:{value:re,name:S}})},optionRenderer:z,multi:!0,options:I,placeholder:"Search for users",value:R})),e.createElement(n,{bsStyle:"success",disabled:y||!P,title:"Assign User",type:"submit"},"Assign User")),K&&e.createElement(d,null,Object.entries(K).map(([S,R])=>e.createElement("span",{key:S},String(R),"."))))))},x=c.default.div`
margin-top: 15px;
margin-bottom: 15px;
`,Q=({role:{id:r,name:T},role:A})=>{const[B,I]=(0,e.useState)(!1),[j,W]=(0,e.useState)(),[b,F]=(0,e.useState)(),{pathname:J}=(0,v.A)(),y=(0,f.A)(),P=(0,e.useCallback)(R=>(I(!0),E.A.loadUsersForRole(r,T,R).then(D=>(I(!1),D))),[r,T]),K=R=>(y(a.g.ROLES.USER_ASSIGNED,{app_pathname:(0,M.i)(J),app_section:"role-edit",app_action_value:"assign-user"}),E.A.addMembers(r,R.map(D=>D.username).toSet()).then(()=>P(U.n).then(D=>(W(D),D)))),S=R=>{if(y(a.g.ROLES.USER_UNASSIGNED,{app_pathname:(0,M.i)(J),app_section:"role-edit",app_action_value:"unassign-user"}),(A.name==="Reader"||A.name==="Admin")&&(!R.roles.includes("Reader")||!R.roles.includes("Admin"))){F(`User '${R.name}' needs at least a Reader or Admin role.`),P(U.n).then(W);return}F(void 0),E.A.removeMember(r,R.name).then(()=>{P(U.n).then(W)})};return e.createElement(C.A,{title:"Users",showLoading:B},e.createElement("h3",null,"Assign Users"),e.createElement(x,null,e.createElement(G,{onSubmit:K,role:A})),e.createElement(l.$p,{onClose:F},b),e.createElement("h3",null,"Selected Users"),e.createElement(x,null,e.createElement(l.Md,{noDataText:"No selected users have been found.",onLoad:P,overrideList:j,onDeleteItem:S})))};var Y=t("QL8i6bcz");const V=({role:r})=>{var T;const A=Y.d.exports("teams"),B=(T=A==null?void 0:A[0])==null?void 0:T.RoleTeamsAssignment;return e.createElement(C.A,{title:"Teams"},B?e.createElement(B,{role:r}):e.createElement(l.Uk,{featureName:"teams"}))};var w=t("tJ+zurXu"),_=t("3yfJIRSb");const k=({role:r})=>r?e.createElement(_.A,null,e.createElement("div",null,e.createElement(w.A,{role:r})),e.createElement("div",null,e.createElement(Q,{role:r}),e.createElement(l.Wj,{permissions:"teams:edit"},e.createElement(V,{role:r})))):e.createElement(l.y$,null);var q=t("d4kzUuQm"),ee=t("QFEPqbjA"),te=t("E+CaPsQD");const se=({name:r})=>e.createElement(e.Fragment,null,"Edit Role ",r&&e.createElement(e.Fragment,null,"- ",e.createElement("i",null,r))),ne=({params:r})=>{var T;const[A,B]=(0,e.useState)(),I=r==null?void 0:r.roleId;return(0,e.useEffect)(()=>{H.v.load(I).then(B)},[I]),e.createElement(l.Qc,{title:`Edit Role ${(T=A==null?void 0:A.name)!=null?T:""}`},e.createElement(l.zY,{title:e.createElement(se,{name:A==null?void 0:A.name}),actions:e.createElement(ee.A,{roleId:I}),topActions:e.createElement(g.m,{to:q.Ay.SYSTEM.AUTHZROLES.OVERVIEW},e.createElement(s.Button,{bsStyle:"info"},"Roles Overview")),documentationLink:{title:"Permissions documentation",path:te.A.PAGES.USERS_ROLES}},e.createElement("span",null,"You can assign the role to users.")),e.createElement(k,{role:I===(A==null?void 0:A.id)?A:void 0}))},oe=(0,m.A)(ne)},c9JM82dZ:($,h,t)=>{t.d(h,{A:()=>l});var e=t("Z7aTuO5B"),m=t("yAXMqwrl");const l=c=>E=>{const U=(0,m.useParams)();return e.createElement(c,{...E,params:U})}},KOKBnITH:($,h,t)=>{t.d(h,{v:()=>a});var e=t("JnTtTRmZ"),m=t.n(e),g=t("VPaD/Np4"),l=t("eFxcQyPT"),c=t("U1Iufsob"),E=t("MdYBRjRJ"),U=t("IA3Ku5lS"),C=t("gyRmhZSW");class M{constructor(s,n,o,d,i){this._value={id:s,name:n,description:o,permissions:d,readOnly:i}}get id(){return this._value.id}get name(){return this._value.name}get description(){return this._value.description}get permissions(){return this._value.permissions}get readOnly(){return this._value.readOnly}toBuilder(){const{id:s,name:n,description:o,permissions:d,readOnly:i}=this._value;return new f(g.Map({id:s,name:n,description:o,permissions:d,readOnly:i}))}static create(s,n,o,d,i){return new M(s,n,o,d,i)}toJSON(){const{id:s,name:n,description:o,permissions:d,readOnly:i}=this._value;return{id:s,name:n,description:o,permissions:d,read_only:i}}static fromJSON(s){const{id:n,name:o,description:d,permissions:i,read_only:O}=s;return M.create(n,o,d,i,O)}static builder(){return new f}}class f{constructor(s=g.Map()){this.value=s}id(s){return new f(this.value.set("id",s))}name(s){return new f(this.value.set("name",s))}description(s){return new f(this.value.set("description",s))}permissions(s){return new f(this.value.set("permissions",s))}readOnly(s){return new f(this.value.set("readOnly",s))}build(){const{id:s,name:n,description:o,permissions:d,readOnly:i}=this.value.toObject();return new M(s,n,o,d,i)}}const a=(0,U.rN)("AuthzRoles",()=>m().createActions({load:{asyncResult:!0},delete:{asyncResult:!0},addMembers:{asyncResult:!0},removeMember:{asyncResult:!0},loadUsersForRole:{asyncResult:!0},loadRolesForUser:{asyncResult:!0},loadRolesPaginated:{asyncResult:!0}}));var p=t("nmSm+aR9");const N=({count:u,total:s,page:n,per_page:o,query:d,roles:i=[],context:O={users:void 0}})=>({list:g.List(i.map(z=>M.fromJSON(z))),pagination:{query:d,page:n,perPage:o,count:u,total:s},context:O}),Z=({count:u,total:s,page:n,per_page:o,query:d,users:i})=>({list:g.List(i.map(O=>p.A.fromJSON(O))),pagination:{page:n,perPage:o,query:d,count:u,total:s}}),L=(u,s=[])=>{const n=s.map(o=>encodeURIComponent(o));return u(...n).url},H=(0,U.Bv)("AuthzRoles",()=>m().createStore({listenables:[a],load(u){const s=(0,E.H3)(L(c.A.AuthzRolesController.load,[u])),n=(0,l.Ay)("GET",s).then(M.fromJSON);return a.load.promise(n),n},delete(u){const s=(0,E.H3)(L(c.A.AuthzRolesController.delete,[u])),n=(0,l.Ay)("DELETE",s);return a.delete.promise(n),n},addMembers(u,s){const n=L(c.A.AuthzRolesController.addMembers,[u]),o=(0,l.Ay)("PUT",(0,E.H3)(n),s.toArray());return a.addMembers.promise(o),o},removeMember(u,s){const n=L(c.A.AuthzRolesController.removeMember,[u,s]),o=(0,l.Ay)("DELETE",(0,E.H3)(n));return a.removeMember.promise(o),o},loadUsersForRole(u,s,{page:n,perPage:o,query:d}){const i=L(c.A.AuthzRolesController.loadUsersForRole,[u]),O=(0,C.A)(i,n,o,d),z=(0,l.Ay)("GET",(0,E.H3)(O)).then(Z);return a.loadUsersForRole.promise(z),z},loadRolesForUser(u,{page:s,perPage:n,query:o}){const d=L(c.A.AuthzRolesController.loadRolesForUser,[u]),i=(0,C.A)(d,s,n,o),O=(0,l.Ay)("GET",(0,E.H3)(i)).then(N);return a.loadRolesForUser.promise(O),O},loadRolesPaginated({page:u,perPage:s,query:n}){const o=L(c.A.AuthzRolesController.list),d=(0,C.A)(o,u,s,n),i=(0,l.Ay)("GET",(0,E.H3)(d)).then(N);return a.loadRolesPaginated.promise(i),i}}))}}]);})();
//# sourceMappingURL=bb8c8232-8997.326a79cbe1e9cb0e6697.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy