-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): design the layout for role-permission mapping #336
- Loading branch information
Showing
10 changed files
with
255 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React, { useEffect } from 'react' | ||
import { connect } from 'react-redux' | ||
import { useTranslation } from 'react-i18next' | ||
import { | ||
Card, | ||
CardBody, | ||
FormGroup, | ||
Row, | ||
Badge, | ||
Col, | ||
Accordion, | ||
} from '../../../../app/components' | ||
import GluuViewWrapper from '../../../../app/routes/Apps/Gluu/GluuViewWrapper' | ||
import GluuRibbon from '../../../../app/routes/Apps/Gluu/GluuRibbon' | ||
import applicationStyle from '../../../../app/routes/Apps/Gluu/styles/applicationstyle' | ||
import { getMapping } from '../../redux/actions/MappingActions' | ||
import { | ||
hasPermission, | ||
buildPayload, | ||
ROLE_READ, | ||
} from '../../../../app/utils/PermChecker' | ||
|
||
function MappingPage({ mapping, permissions, loading, dispatch }) { | ||
console.log('=============' + loading) | ||
const { t } = useTranslation() | ||
const options = [] | ||
const userAction = {} | ||
useEffect(() => { | ||
buildPayload(userAction, 'ROLES_MAPPING', options) | ||
dispatch(getMapping(userAction)) | ||
}, []) | ||
return ( | ||
<Card> | ||
<GluuRibbon title={t('titles.mapping')} fromLeft /> | ||
<CardBody> | ||
<FormGroup row /> | ||
<FormGroup row /> | ||
<FormGroup row /> | ||
<GluuViewWrapper canShow={hasPermission(permissions, ROLE_READ)}> | ||
{mapping.map((candidate, key) => ( | ||
<Row key={key}> | ||
<Col sm={12}> | ||
<Accordion className="mb-12"> | ||
<Accordion.Header className="text-info"> | ||
<Accordion.Indicator className="mr-2" /> | ||
{candidate.role} | ||
<Badge | ||
color="info" | ||
style={{ | ||
float: 'right', | ||
background: applicationStyle.buttonStyle, | ||
}} | ||
> | ||
{candidate.permissions.length} | ||
</Badge> | ||
</Accordion.Header> | ||
|
||
<Accordion.Body> | ||
{candidate.permissions.map((perm, id) => ( | ||
<div key={id}>{perm}</div> | ||
))} | ||
</Accordion.Body> | ||
</Accordion> | ||
</Col> | ||
</Row> | ||
))} | ||
</GluuViewWrapper> | ||
</CardBody> | ||
</Card> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state) => { | ||
return { | ||
mapping: state.mappingReducer.items, | ||
loading: state.mappingReducer.loading, | ||
permissions: state.authReducer.permissions, | ||
} | ||
} | ||
|
||
export default connect(mapStateToProps)(MappingPage) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
export default mapping = [ | ||
{ | ||
role: 'api-viewer', | ||
permissions: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
'https://jans.io/oauth/config/scopes.readonly', | ||
'https://jans.io/oauth/config/scripts.readonly', | ||
'https://jans.io/oauth/config/openid/clients.readonly', | ||
'https://jans.io/oauth/config/smtp.readonly', | ||
'https://jans.io/oauth/config/logging.readonly', | ||
'https://jans.io/oauth/config/uma/resources.readonly', | ||
'https://jans.io/oauth/config/database/ldap.readonly', | ||
'https://jans.io/oauth/config/jwks.readonly', | ||
'https://jans.io/oauth/config/fido2.readonly', | ||
'https://jans.io/oauth/config/cache.readonly', | ||
'https://jans.io/oauth/jans-auth-server/config/properties.readonly', | ||
'https://jans.io/oauth/config/database/couchbase.readonly', | ||
'https://jans.io/oauth/config/database/sql.readonly', | ||
'https://jans.io/oauth/config/stats.readonly', | ||
], | ||
}, | ||
{ | ||
role: 'api-editor', | ||
permissions: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/attributes.write', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
'https://jans.io/oauth/config/acrs.write', | ||
'https://jans.io/oauth/config/scopes.readonly', | ||
'https://jans.io/oauth/config/scopes.write', | ||
'https://jans.io/oauth/config/scripts.readonly', | ||
'https://jans.io/oauth/config/scripts.write', | ||
'https://jans.io/oauth/config/openid/clients.readonly', | ||
'https://jans.io/oauth/config/openid/clients.write', | ||
'https://jans.io/oauth/config/smtp.readonly', | ||
'https://jans.io/oauth/config/smtp.write', | ||
'https://jans.io/oauth/config/logging.readonly', | ||
'https://jans.io/oauth/config/logging.write', | ||
'https://jans.io/oauth/config/uma/resources.readonly', | ||
'https://jans.io/oauth/config/uma/resources.write', | ||
'https://jans.io/oauth/config/database/ldap.readonly', | ||
'https://jans.io/oauth/config/database/ldap.write', | ||
'https://jans.io/oauth/config/jwks.readonly', | ||
'https://jans.io/oauth/config/jwks.write', | ||
'https://jans.io/oauth/config/fido2.readonly', | ||
'https://jans.io/oauth/config/fido2.write', | ||
'https://jans.io/oauth/config/cache.readonly', | ||
'https://jans.io/oauth/config/cache.write', | ||
'https://jans.io/oauth/config/database/couchbase.readonly', | ||
'https://jans.io/oauth/config/database/couchbase.write', | ||
'https://jans.io/oauth/config/database/sql.readonly', | ||
'https://jans.io/oauth/config/database/sql.write', | ||
'https://jans.io/oauth/jans-auth-server/config/properties.readonly', | ||
'https://jans.io/oauth/config/stats.readonly', | ||
'jans_stat', | ||
], | ||
}, | ||
{ | ||
role: 'api-manager', | ||
permissions: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/attributes.write', | ||
'https://jans.io/oauth/config/attributes.delete', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
'https://jans.io/oauth/config/acrs.write', | ||
'https://jans.io/oauth/config/acrs.delete', | ||
'https://jans.io/oauth/config/scopes.readonly', | ||
'https://jans.io/oauth/config/scopes.write', | ||
'https://jans.io/oauth/config/scopes.delete', | ||
'https://jans.io/oauth/config/scripts.readonly', | ||
'https://jans.io/oauth/config/scripts.write', | ||
'https://jans.io/oauth/config/scripts.delete', | ||
'https://jans.io/oauth/config/openid/clients.readonly', | ||
'https://jans.io/oauth/config/openid/clients.write', | ||
'https://jans.io/oauth/config/openid/clients.delete', | ||
'https://jans.io/oauth/config/smtp.readonly', | ||
'https://jans.io/oauth/config/smtp.write', | ||
'https://jans.io/oauth/config/smtp.delete', | ||
'https://jans.io/oauth/config/logging.readonly', | ||
'https://jans.io/oauth/config/logging.write', | ||
'https://jans.io/oauth/config/uma/resources.readonly', | ||
'https://jans.io/oauth/config/uma/resources.write', | ||
'https://jans.io/oauth/config/uma/resources.delete', | ||
'https://jans.io/oauth/config/database/ldap.readonly', | ||
'https://jans.io/oauth/config/database/ldap.write', | ||
'https://jans.io/oauth/config/database/ldap.delete', | ||
'https://jans.io/oauth/config/jwks.readonly', | ||
'https://jans.io/oauth/config/jwks.write', | ||
'https://jans.io/oauth/config/fido2.readonly', | ||
'https://jans.io/oauth/config/fido2.write', | ||
'https://jans.io/oauth/config/cache.readonly', | ||
'https://jans.io/oauth/config/cache.write', | ||
'https://jans.io/oauth/config/database/couchbase.readonly', | ||
'https://jans.io/oauth/config/database/couchbase.write', | ||
'https://jans.io/oauth/config/database/sql.readonly', | ||
'https://jans.io/oauth/config/database/sql.write', | ||
'https://jans.io/oauth/jans-auth-server/config/properties.readonly', | ||
'https://jans.io/oauth/config/stats.readonly', | ||
'jans_stat', | ||
], | ||
}, | ||
{ | ||
role: 'api-admin', | ||
permissions: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/attributes.write', | ||
'https://jans.io/oauth/config/attributes.delete', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
'https://jans.io/oauth/config/acrs.write', | ||
'https://jans.io/oauth/config/acrs.delete', | ||
'https://jans.io/oauth/config/scopes.readonly', | ||
'https://jans.io/oauth/config/scopes.write', | ||
'https://jans.io/oauth/config/scopes.delete', | ||
'https://jans.io/oauth/config/scripts.readonly', | ||
'https://jans.io/oauth/config/scripts.write', | ||
'https://jans.io/oauth/config/scripts.delete', | ||
'https://jans.io/oauth/config/openid/clients.readonly', | ||
'https://jans.io/oauth/config/openid/clients.write', | ||
'https://jans.io/oauth/config/openid/clients.delete', | ||
'https://jans.io/oauth/config/smtp.readonly', | ||
'https://jans.io/oauth/config/smtp.write', | ||
'https://jans.io/oauth/config/smtp.delete', | ||
'https://jans.io/oauth/config/logging.readonly', | ||
'https://jans.io/oauth/config/logging.write', | ||
'https://jans.io/oauth/config/uma/resources.readonly', | ||
'https://jans.io/oauth/config/uma/resources.write', | ||
'https://jans.io/oauth/config/uma/resources.delete', | ||
'https://jans.io/oauth/config/database/ldap.readonly', | ||
'https://jans.io/oauth/config/database/ldap.write', | ||
'https://jans.io/oauth/config/database/ldap.delete', | ||
'https://jans.io/oauth/config/jwks.readonly', | ||
'https://jans.io/oauth/config/jwks.write', | ||
'https://jans.io/oauth/config/fido2.readonly', | ||
'https://jans.io/oauth/config/fido2.write', | ||
'https://jans.io/oauth/config/cache.readonly', | ||
'https://jans.io/oauth/config/cache.write', | ||
'https://jans.io/oauth/config/database/couchbase.readonly', | ||
'https://jans.io/oauth/config/database/couchbase.write', | ||
'https://jans.io/oauth/config/database/sql.readonly', | ||
'https://jans.io/oauth/config/database/sql.write', | ||
'https://jans.io/oauth/jans-auth-server/config/properties.readonly', | ||
'https://jans.io/oauth/config/stats.readonly', | ||
'jans_stat', | ||
'https://jans.io/adminui/user/role.read', | ||
'https://jans.io/adminui/user/role.write', | ||
'https://jans.io/adminui/user/permission.read', | ||
'https://jans.io/adminui/user/permission.write', | ||
'https://jans.io/adminui/user/rolePermissionMapping.read', | ||
'https://jans.io/adminui/user/rolePermissionMapping.write', | ||
], | ||
}, | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
plugins/admin/redux/api/RoleMappingApi.js → plugins/admin/redux/api/MappingApi.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export default class RoleMappingApi { | ||
export default class MappingApi { | ||
constructor(api) { | ||
this.api = api | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.