@@ -18,14 +18,13 @@ import GluuSelectRow from 'Routes/Apps/Gluu/GluuSelectRow'
18
18
import GluuToogleRow from 'Routes/Apps/Gluu/GluuToogleRow'
19
19
import GluuInputRow from 'Routes/Apps/Gluu/GluuInputRow'
20
20
import GluuTypeAheadWithAdd from 'Routes/Apps/Gluu/GluuTypeAheadWithAdd'
21
- import { getScope } from 'Plugins/auth-server/redux/actions/ScopeActions'
22
21
import { FormControlLabel , Radio , RadioGroup } from '@material-ui/core'
23
22
import GluuTypeAheadForDn from 'Routes/Apps/Gluu/GluuTypeAheadForDn'
24
23
import { ThemeContext } from 'Context/theme/themeContext'
25
24
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
26
25
const DOC_CATEGORY = 'openid_client'
27
26
28
- function ClientCibaParUmaPanel ( { client, scope , umaResources, scripts, formik } ) {
27
+ function ClientCibaParUmaPanel ( { client, umaResources, scripts, formik } ) {
29
28
const { t } = useTranslation ( )
30
29
const theme = useContext ( ThemeContext )
31
30
const selectedTheme = theme . state . theme
@@ -44,6 +43,7 @@ function ClientCibaParUmaPanel({ client, scope, umaResources, scripts, formik })
44
43
const [ open , setOpen ] = useState ( false )
45
44
const [ selectedUMA , setSelectedUMA ] = useState ( )
46
45
const [ scopeExpression , setScopeExpression ] = useState ( )
46
+ const [ showScopeSection , setShowScopeSection ] = useState ( 'scope' )
47
47
48
48
const rptScripts = scripts
49
49
. filter ( ( item ) => item . scriptType == 'UMA_RPT_CLAIMS' )
@@ -59,8 +59,6 @@ function ClientCibaParUmaPanel({ client, scope, umaResources, scripts, formik })
59
59
setOpen ( true )
60
60
}
61
61
62
- console . log ( 'scope' , scope )
63
-
64
62
return (
65
63
< Container >
66
64
< h2 > { t ( `titles.CIBA` ) } </ h2 >
@@ -195,11 +193,9 @@ function ClientCibaParUmaPanel({ client, scope, umaResources, scripts, formik })
195
193
< FormGroup row >
196
194
< GluuLabel label = { t ( 'fields.iconUrl' ) } size = { 3 } />
197
195
< Col sm = { 9 } className = "top-5" >
198
- { ! isEmpty ( scope ) && (
199
- < a href = { scope ?. iconUrl } target = "_blank" alt = "iconUrl" className = "common-link" rel = "noreferrer" >
200
- { scope ?. iconUrl }
201
- </ a >
202
- ) }
196
+ < a href = { selectedUMA ?. iconUri } target = "_blank" alt = "iconUrl" className = "common-link" rel = "noreferrer" >
197
+ { selectedUMA ?. iconUri || '-' }
198
+ </ a >
203
199
</ Col >
204
200
</ FormGroup >
205
201
< FormGroup row >
@@ -208,45 +204,70 @@ function ClientCibaParUmaPanel({ client, scope, umaResources, scripts, formik })
208
204
< RadioGroup
209
205
row
210
206
name = "scopeSelection"
211
- value = { true }
207
+ value = { showScopeSection }
208
+ onChange = { ( e ) => setShowScopeSection ( e . target . value ) }
212
209
>
213
210
< FormControlLabel
214
- value = { true }
211
+ value = { 'scope' }
215
212
control = { < Radio color = "primary" /> }
216
213
label = { t ( 'fields.scope' ) }
217
- checked = { true }
214
+ checked = { showScopeSection === 'scope' }
218
215
/>
219
216
< FormControlLabel
220
- value = { false }
217
+ value = { 'expression' }
221
218
control = { < Radio color = "primary" /> }
222
219
label = { t ( 'fields.scopeExpression' ) }
223
- checked = { false }
220
+ checked = { showScopeSection === 'expression' }
224
221
/>
225
222
</ RadioGroup >
226
223
</ Col >
227
224
</ FormGroup >
228
225
< FormGroup row >
229
- < GluuLabel label = { t ( 'fields.scopeSelection ' ) } size = { 3 } />
226
+ < GluuLabel label = { t ( 'fields.scopeOrExpression ' ) } size = { 3 } />
230
227
< Col sm = { 9 } className = "top-5" >
231
- { ! isEmpty ( scopeExpression ) && scopeExpression . map ( ( expression , key ) => (
232
- < Box key = { key } >
233
- < Box display = "flex" >
234
- < a href = { expression } target = "_blank" alt = "scope expression" className = "common-link" rel = "noreferrer" >
235
- { expression }
236
- </ a >
237
- </ Box >
238
- </ Box >
239
- ) ) }
228
+ { showScopeSection === 'scope' ? (
229
+ < React . Fragment >
230
+ { ! isEmpty ( selectedUMA ) && selectedUMA ?. scopes ?. map ( ( scope , key ) => {
231
+ const getInum = scope . split ( ',' ) [ 0 ]
232
+ const inum = getInum . length > 0 ? getInum . split ( '=' ) [ 1 ] : null
233
+
234
+ if ( inum ) {
235
+ return (
236
+ < Box key = { key } >
237
+ < Box display = "flex" >
238
+ < Link to = { `/auth-server/scope/edit:${ inum } ` } className = "common-link" >
239
+ { scope }
240
+ </ Link >
241
+ </ Box >
242
+ </ Box >
243
+ )
244
+ }
245
+ return '-'
246
+ } ) }
247
+ </ React . Fragment >
248
+ ) : (
249
+ < React . Fragment >
250
+ { ! isEmpty ( scopeExpression ) && scopeExpression . map ( ( expression , key ) => (
251
+ < Box key = { key } >
252
+ < Box display = "flex" >
253
+ < a href = { expression } target = "_blank" alt = "scope expression" className = "common-link" rel = "noreferrer" >
254
+ { expression }
255
+ </ a >
256
+ </ Box >
257
+ </ Box >
258
+ ) ) }
259
+ </ React . Fragment >
260
+ ) }
240
261
</ Col >
241
262
</ FormGroup >
242
263
< FormGroup row >
243
264
< GluuLabel label = { t ( 'fields.associatedClient' ) } size = { 3 } />
244
265
< Col sm = { 9 } className = "top-5" >
245
- { ! isEmpty ( scope ) && scope . clients ?. map ( ( client , key ) => (
266
+ { ! isEmpty ( selectedUMA ) && selectedUMA . clients ?. map ( ( client , key ) => (
246
267
< Box key = { key } >
247
268
< Box display = "flex" >
248
- < Link to = { `/auth-server/client/edit:${ client . inum . substring ( 0 , 4 ) } ` } className = "common-link" >
249
- { client . inum }
269
+ < Link to = { `/auth-server/client/edit:${ client . substring ( 0 , 4 ) } ` } className = "common-link" >
270
+ { client }
250
271
</ Link >
251
272
</ Box >
252
273
</ Box >
@@ -279,6 +300,7 @@ const mapStateToProps = (state) => {
279
300
return {
280
301
clientData : state . oidcReducer . item ,
281
302
loading : state . oidcReducer . loading ,
303
+ scope : state . scopeReducer . item ,
282
304
}
283
305
}
284
306
export default connect ( mapStateToProps ) ( ClientCibaParUmaPanel )
0 commit comments