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GAAgGhD,GAAU,CACzJ,MAAMsC,KAAS,aAAU,EAEzB,OAAO,gBAACU,EAAA,CAAW,GAAGhD,EAAgB,OAAAsC,CAAA,CAAgB,CACxD,C","sources":["webpack://graylog-web-interface/./src/components/common/PageNavigation.tsx","webpack://graylog-web-interface/./src/components/users/navigation/UserActionLinks.tsx","webpack://graylog-web-interface/./src/components/users/navigation/UsersPageNavigation.tsx","webpack://graylog-web-interface/./src/components/users/CreateTokenForm.tsx","webpack://graylog-web-interface/./src/components/users/TokenList.tsx","webpack://graylog-web-interface/./src/pages/UserTokensEditPage.tsx","webpack://graylog-web-interface/./src/routing/withParams.tsx"],"sourcesContent":["/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Button, ButtonToolbar } from 'components/bootstrap';\nimport { LinkContainer } from 'components/common/router';\nimport { IfPermitted } from 'components/common';\nimport NavItemStateIndicator, {\n hoverIndicatorStyles,\n activeIndicatorStyles,\n} from 'components/common/NavItemStateIndicator';\n\nconst Container = styled(ButtonToolbar)`\n margin-bottom: 10px;\n`;\n\nconst StyledButton = styled(Button)(({ theme }) => css`\n font-family: ${theme.fonts.family.navigation};\n font-size: ${theme.fonts.size.navigation};\n color: ${theme.colors.variant.darker.default};\n \n &:hover,\n &:focus {\n background: inherit;\n text-decoration: none;\n }\n\n &:hover {\n color: inherit;\n ${hoverIndicatorStyles(theme)}\n }\n\n &.active {\n color: ${theme.colors.global.textDefault};\n\n ${activeIndicatorStyles(theme)}\n\n &:hover,\n &:focus {\n ${activeIndicatorStyles(theme)}\n }\n`);\n\nStyledButton.displayName = 'Button';\n\ntype Props = {\n /**\n * List of nav items. Define permissions, if the item should only be displayed for users with specific permissions.\n * By default, an item is active if the current URL starts with the item URL.\n * If you only want to display an item as active only when its path matches exactly, set `exactPathMatch` to true.\n */\n items: Array<{\n title: string,\n path: string,\n permissions?: string | Array\n exactPathMatch?: boolean,\n }>\n}\n\n/**\n * Simple tab navigation to allow navigating to subareas of a page.\n */\nconst PageNavigation = ({ items }: Props) => (\n \n {items.map(({ path, title, permissions, exactPathMatch }) => {\n if (!path) {\n return null;\n }\n\n return (\n \n \n \n \n {title}\n \n \n \n \n );\n })}\n \n);\n\nexport default PageNavigation;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport type { $PropertyType } from 'utility-types';\n\nimport { LinkContainer } from 'components/common/router';\nimport type User from 'logic/users/User';\nimport Routes from 'routing/Routes';\nimport { ButtonToolbar, Button } from 'components/bootstrap';\n\ntype Props = {\n userId: $PropertyType,\n userIsReadOnly: boolean,\n};\n\nconst UserActionLinks = ({ userId, userIsReadOnly }: Props) => (\n \n \n \n \n {!userIsReadOnly && (\n \n \n \n )}\n \n \n \n \n);\n\nexport default UserActionLinks;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\n\nimport Routes from 'routing/Routes';\nimport PageNavigation from 'components/common/PageNavigation';\nimport { Row } from 'components/bootstrap';\n\nconst UsersPageNavigation = () => {\n const NAV_ITEMS = [\n { title: 'Users Overview', path: Routes.SYSTEM.USERS.OVERVIEW, permissions: 'users:list' },\n { title: 'Teams Overview', path: Routes.getPluginRoute('SYSTEM_TEAMS'), permissions: 'teams:list' },\n ];\n\n return (\n \n \n
\n );\n};\n\nexport default UsersPageNavigation;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport { Button, ControlLabel, FormControl, FormGroup } from 'components/bootstrap';\nimport { Spinner } from 'components/common';\n\nconst StyledForm = styled.form`\n margin-top: 10px;\n\n &.form-inline > .form-group {\n margin-right: 10px;\n\n > input {\n width: 300px;\n }\n }\n`;\n\ntype Props = {\n creatingToken: boolean,\n disableForm: boolean,\n onCreate: (tokenName: string) => void,\n};\n\nconst CreateTokenForm = ({ creatingToken, disableForm, onCreate }: Props) => {\n const [tokenName, setTokenName] = useState('');\n\n const createToken = (event: React.SyntheticEvent) => {\n event.preventDefault();\n onCreate(tokenName);\n setTokenName('');\n };\n\n return (\n \n \n Token Name \n setTokenName((event.target as HTMLInputElement).value)} />\n \n \n \n );\n};\n\nCreateTokenForm.propTypes = {\n creatingToken: PropTypes.bool,\n disableForm: PropTypes.bool,\n onCreate: PropTypes.func.isRequired,\n};\n\nCreateTokenForm.defaultProps = {\n creatingToken: false,\n disableForm: false,\n};\n\nexport default CreateTokenForm;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport PropTypes from 'prop-types';\nimport React, { useMemo, useState } from 'react';\nimport styled from 'styled-components';\n\nimport { ClipboardButton, ControlledTableList, Icon, RelativeTime, SearchForm, Spinner } from 'components/common';\nimport { Button, Col, Panel, Row } from 'components/bootstrap';\nimport type { Token, TokenSummary } from 'stores/users/UsersStore';\nimport { sortByDate } from 'util/SortUtils';\n\nimport CreateTokenForm from './CreateTokenForm';\n\nconst StyledTokenPanel = styled(Panel)`\n &.panel {\n margin: 10px 0;\n background-color: ${(props) => props.theme.colors.global.contentBackground};\n\n .panel-heading {\n color: ${(props) => props.theme.colors.gray[30]};\n }\n }\n`;\n\nconst StyledCopyTokenButton = styled(ClipboardButton)`\n vertical-align: baseline;\n margin-left: 1em;\n`;\n\nconst StyledSearchForm = styled(SearchForm)`\n margin-bottom: 10px;\n`;\n\nconst StyledLastAccess = styled.div`\n color: ${(props) => props.theme.colors.gray[60]};\n font-size: ${(props) => props.theme.fonts.size.small};\n margin-bottom: 5px;\n`;\n\ntype Props = {\n creatingToken: boolean,\n deletingToken?: string,\n onCreate: (tokenName: string) => Promise,\n onDelete: (tokenId: string, tokenName: string) => void,\n tokens: TokenSummary[],\n};\n\nconst TokenList = ({ creatingToken, deletingToken, onCreate, onDelete, tokens }: Props) => {\n const [createdToken, setCreatedToken] = useState();\n const [query, setQuery] = useState('');\n\n const effectiveTokens = useMemo(() => {\n const queryRegex = new RegExp(query, 'i');\n\n return tokens\n .filter(({ name }) => queryRegex.test(name))\n .sort((token1, token2) => sortByDate(token1.last_access, token2.last_access, 'desc'));\n }, [query, tokens]);\n\n const handleTokenCreation = (tokenName) => {\n const promise = onCreate(tokenName);\n\n promise.then((token) => {\n setCreatedToken(token);\n\n return token;\n });\n };\n\n const deleteToken = (token) => () => {\n onDelete(token.id, token.name);\n };\n\n const updateQuery = (nextQuery?: string) => setQuery(nextQuery || '');\n\n return (\n \n \n {createdToken && (\n \n \n Token {createdToken.name} created! \n \n \n This is your new token. Make sure to copy it now, you will not be able to see it again.
\n \n {createdToken.token}\n } text={createdToken.token} bsSize=\"xsmall\" />\n
\n \n \n \n )}\n
\n \n\n \n \n {effectiveTokens.length === 0 && (\n \n {query === '' ? 'No tokens to display.' : 'No tokens match the filter.'}
\n \n )}\n {effectiveTokens.map((token) => {\n const tokenNeverUsed = Date.parse(token.last_access) === 0;\n\n return (\n \n \n \n {token.name}\n \n {tokenNeverUsed ? 'Never used' : <>Last used >}\n \n \n \n \n \n
\n \n );\n })}\n \n \n );\n};\n\nTokenList.propTypes = {\n tokens: PropTypes.arrayOf(PropTypes.object),\n onDelete: PropTypes.func,\n onCreate: PropTypes.func,\n creatingToken: PropTypes.bool,\n deletingToken: PropTypes.string,\n};\n\nTokenList.defaultProps = {\n tokens: [],\n onDelete: () => {},\n onCreate: () => {},\n creatingToken: false,\n deletingToken: undefined,\n};\n\nexport default TokenList;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport { useEffect, useState, useCallback } from 'react';\n\nimport type User from 'logic/users/User';\nimport withParams from 'routing/withParams';\nimport { Row, Col } from 'components/bootstrap';\nimport { isPermitted } from 'util/PermissionsMixin';\nimport DocsHelper from 'util/DocsHelper';\nimport UsersDomain from 'domainActions/users/UsersDomain';\nimport { PageHeader, DocumentTitle, Spinner } from 'components/common';\nimport { Headline } from 'components/common/Section/SectionComponent';\nimport TokenList from 'components/users/TokenList';\nimport UsersPageNavigation from 'components/users/navigation/UsersPageNavigation';\nimport UserActionLinks from 'components/users/navigation/UserActionLinks';\nimport useCurrentUser from 'hooks/useCurrentUser';\n\ntype Props = {\n params: {\n userId: string,\n },\n};\n\nconst PageTitle = ({ fullName }: { fullName: string | null | undefined }) => (\n <>\n Edit Tokens Of User {fullName && (\n <>\n - {fullName}\n >\n )}\n >\n);\n\nconst _loadTokens = (loadedUser, currentUser, setTokens) => {\n if (loadedUser) {\n if (isPermitted(currentUser?.permissions, [`users:tokenlist:${loadedUser.username}`])) {\n UsersDomain.loadTokens(loadedUser.id).then(setTokens);\n } else {\n setTokens([]);\n }\n }\n};\n\nconst _deleteToken = (tokenId, tokenName, userId, loadTokens, setDeletingTokenId) => {\n const promise = UsersDomain.deleteToken(userId, tokenId, tokenName);\n\n setDeletingTokenId(tokenId);\n\n promise.then(() => {\n loadTokens();\n setDeletingTokenId(undefined);\n });\n};\n\nconst _createToken = (tokenName, userId, loadTokens, setCreatingToken) => {\n const promise = UsersDomain.createToken(userId, tokenName);\n\n setCreatingToken(true);\n\n return promise.then((token) => {\n loadTokens();\n setCreatingToken(false);\n\n return token;\n });\n};\n\nconst UserEditPage = ({ params }: Props) => {\n const currentUser = useCurrentUser();\n const [loadedUser, setLoadedUser] = useState();\n const [tokens, setTokens] = useState([]);\n const [deletingTokenId, setDeletingTokenId] = useState();\n const [creatingToken, setCreatingToken] = useState(false);\n\n const userId = params?.userId;\n\n const loadTokens = useCallback(() => _loadTokens(loadedUser, currentUser, setTokens), [currentUser, loadedUser]);\n const _handleTokenDelete = (tokenId, tokenName) => _deleteToken(tokenId, tokenName, userId, loadTokens, setDeletingTokenId);\n const _handleTokenCreate = (tokenName) => _createToken(tokenName, userId, loadTokens, setCreatingToken);\n\n useEffect(() => { loadTokens(); }, [loadTokens, loadedUser]);\n useEffect(() => { UsersDomain.load(userId).then(setLoadedUser); }, [userId]);\n\n return (\n \n \n }\n actions={(\n \n )}\n documentationLink={{\n title: 'Permissions documentation',\n path: DocsHelper.PAGES.USERS_ROLES,\n }}>\n \n You can create new tokens or delete old ones.\n \n \n\n \n \n Create And Edit Tokens \n {loadedUser ? (\n \n ) : (\n \n \n \n \n
\n )}\n \n
\n \n );\n};\n\nexport default withParams(UserEditPage);\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport { useParams } from 'react-router-dom';\nimport type { Subtract } from 'utility-types';\n\ntype ParamsContext = {\n params: {\n [key: string]: string | null | undefined;\n };\n};\n\nconst withParams = (Component: React.ComponentType): React.ComponentType> => (props) => {\n const params = useParams();\n\n return ;\n};\n\nexport default withParams;\n"],"names":["Container","StyledButton","theme","items","path","title","permissions","exactPathMatch","userId","userIsReadOnly","NAV_ITEMS","StyledForm","CreateTokenForm","creatingToken","disableForm","onCreate","tokenName","setTokenName","createToken","event","StyledTokenPanel","props","StyledCopyTokenButton","StyledSearchForm","StyledLastAccess","TokenList","deletingToken","onDelete","tokens","createdToken","setCreatedToken","query","setQuery","effectiveTokens","queryRegex","name","token1","token2","handleTokenCreation","token","deleteToken","updateQuery","nextQuery","tokenNeverUsed","PageTitle","fullName","_loadTokens","loadedUser","currentUser","setTokens","UsersDomain","_deleteToken","tokenId","loadTokens","setDeletingTokenId","promise","_createToken","setCreatingToken","UserEditPage","params","useCurrentUser","setLoadedUser","deletingTokenId","_handleTokenDelete","_handleTokenCreate","UsersPageNavigation","UserActionLinks","DocsHelper","withParams","Component"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy