Skip to content

Commit

Permalink
Merge pull request #286 from GluuFederation/admin-ui-issue-278
Browse files Browse the repository at this point in the history
fix(admin-ui): show roles on user form
  • Loading branch information
duttarnab authored Jul 7, 2022
2 parents 556b083 + e9917a2 commit 394d090
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions admin-ui/app/routes/Apps/Gluu/GluuRemovableTypeAhead.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function GluuRemovableTypeAhead({
doc_category,
options,
isDirect,
allowNew = true,
}) {
const { t } = useTranslation()
return (
Expand All @@ -30,11 +31,10 @@ function GluuRemovableTypeAhead({
<Col sm={rsize - 1}>
<InputGroup>
<Typeahead
allowNew
allowNew={allowNew}
emptyLabel=""
labelKey={name}
onChange={(selected) => {
console.log('SELECTED', selected)
if (formik) {
formik.setFieldValue(name, selected)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ function UserAddPage() {
let valE = []
if (values[key]) {
for (let i in values[key]) {
valE.push(values[key][i][key])
if (typeof values[key][i] == 'object') {
valE.push(values[key][i][key])
} else {
valE.push(values[key][i])
}
}
}
obj = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@ import GluuRemovableInputRow from '../../../../app/routes/Apps/Gluu/GluuRemovabl
import GluuRemovableSelectRow from '../../../../app/routes/Apps/Gluu/GluuRemovableSelectRow'
import GluuRemovableTypeAhead from '../../../../app/routes/Apps/Gluu/GluuRemovableTypeAhead'
import { countries } from '../../common/countries'
import { useSelector } from 'react-redux'

function UserClaimEntry({ data, type, entry, formik, handler }) {
const doHandle = () => {
handler(data.name)
}
const roles = useSelector((state) => state.apiRoleReducer.items)
const rolesToBeShown = roles.map((data) => data.role)

return (
<div key={entry}>
{data.oxMultiValuedAttribute && (
<GluuRemovableTypeAhead
label={data.displayName}
name={data.name}
allowNew={data.name != 'jansAdminUIRole'}
value={formik.values[data.name] || []}
formik={formik}
isDirect={true}
options={formik.values[data.name] || []}
options={
data.name == 'jansAdminUIRole'
? rolesToBeShown
: formik.values[data.name] || []
}
handler={doHandle}
doc_category={data.description}
lsize={3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ import {
ROLE_WRITE,
} from '../../../../app/utils/PermChecker'
import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'

import { getRoles } from '../../../admin/redux/actions/ApiRoleActions'
function UserList(props) {
const dispatch = useDispatch()
let opt = {}
useEffect(() => {
opt['limit'] = 0
dispatch(getUsers({}))
dispatch(getAttributes(opt))
dispatch(getRoles())
}, [])

const usersList = useSelector((state) => state.userReducer.items)
Expand Down

0 comments on commit 394d090

Please sign in to comment.