1
- import React , { useState } from 'react'
1
+ import React , { useState , useEffect } from 'react'
2
2
import Box from '@material-ui/core/Box'
3
3
import { Link } from 'react-router-dom'
4
4
import {
@@ -22,11 +22,11 @@ import { FormControlLabel, Radio, RadioGroup } from '@material-ui/core'
22
22
import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn'
23
23
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
24
24
import { deleteUMAResource } from 'Plugins/auth-server/redux/actions/UMAResourceActions'
25
+ import { getScope } from 'Plugins/auth-server/redux/actions/ScopeActions'
25
26
import GluuDialog from 'Routes/Apps/Gluu/GluuDialog'
26
- import { buildPayload } from 'Utils/PermChecker'
27
27
const DOC_CATEGORY = 'openid_client'
28
28
29
- function ClientCibaParUmaPanel ( { client, dispatch, umaResources, scripts, formik } ) {
29
+ function ClientCibaParUmaPanel ( { client, dispatch, umaResources, scope , scripts, formik } ) {
30
30
const { t } = useTranslation ( )
31
31
const claim_uri_id = 'claim_uri_id'
32
32
const cibaDeliveryModes = [ 'poll' , 'push' , 'ping' ]
@@ -68,11 +68,26 @@ function ClientCibaParUmaPanel({ client, dispatch, umaResources, scripts, formik
68
68
}
69
69
70
70
const onDeletionConfirmed = ( message ) => {
71
- buildPayload ( { } , message , selectedUMA . id )
72
- dispatch ( deleteUMAResource ( selectedUMA . id ) )
71
+ const params = {
72
+ id : selectedUMA . id ,
73
+ message
74
+ }
75
+ dispatch ( deleteUMAResource ( params ) )
73
76
setConfirmModal ( false )
74
77
}
75
78
79
+ useEffect ( ( ) => {
80
+ if ( ! isEmpty ( selectedUMA ) && ! isEmpty ( selectedUMA . scopes ) && selectedUMA . scopes ?. length > 0 ) {
81
+ selectedUMA . scopes . map ( scope => {
82
+ // scope data example [string] inum=9bc94613-f678-4bb9-a19d-ed026b492247,ou=scopes,o=jans
83
+ const getInum = scope . split ( ',' ) [ 0 ]
84
+ const inum = getInum . split ( '=' ) [ 1 ]
85
+
86
+ dispatch ( getScope ( inum ) )
87
+ } )
88
+ }
89
+ } , [ selectedUMA ] )
90
+
76
91
return (
77
92
< Container >
78
93
< h2 > { t ( `titles.CIBA` ) } </ h2 >
@@ -255,16 +270,16 @@ function ClientCibaParUmaPanel({ client, dispatch, umaResources, scripts, formik
255
270
< Col sm = { 9 } className = "top-5" >
256
271
{ showScopeSection === 'scope' ? (
257
272
< React . Fragment >
258
- { ! isEmpty ( selectedUMA ) && selectedUMA ?. scopes ?. map ( ( scope , key ) => {
259
- const getInum = scope . split ( ',' ) [ 0 ]
273
+ { ! isEmpty ( selectedUMA ) && selectedUMA ?. scopes ?. map ( ( scopeString , key ) => {
274
+ const getInum = scopeString . split ( ',' ) [ 0 ]
260
275
const inum = getInum . length > 0 ? getInum . split ( '=' ) [ 1 ] : null
261
276
262
- if ( inum ) {
277
+ if ( ! isEmpty ( scope [ inum ] ) ) {
263
278
return (
264
279
< Box key = { key } >
265
280
< Box display = "flex" >
266
- < Link to = { `/auth-server/scope/edit:${ inum } ` } className = "common-link" >
267
- { scope }
281
+ < Link to = { `/auth-server/scope/edit:${ scope [ inum ] ?. inum } ` } className = "common-link" >
282
+ { scope [ inum ] ?. displayName }
268
283
</ Link >
269
284
</ Box >
270
285
</ Box >
0 commit comments