@@ -1072,31 +1072,31 @@ return _.some(a.resources, function(b) {
1072
1072
return l ( b ) && ! _ . isEmpty ( _ . intersection ( a . verbs , [ "*" , "create" , "update" ] ) ) ;
1073
1073
} ) ;
1074
1074
} ) ;
1075
- } , n = function ( b ) {
1076
- var d = a . defer ( ) ;
1075
+ } , n = function ( b , d ) {
1076
+ var j = a . defer ( ) ;
1077
1077
g = b ;
1078
- var j = h . get ( b ) , l = "selfsubjectrulesreviews" ;
1079
- if ( ! j || j . forceRefresh ) if ( e . apiInfo ( l ) ) {
1078
+ var l = h . get ( b ) , n = "selfsubjectrulesreviews" ;
1079
+ if ( ! l || l . forceRefresh || d ) if ( e . apiInfo ( n ) ) {
1080
1080
c . log ( "AuthorizationService, loading user rules for " + b + " project" ) ;
1081
- var n = {
1081
+ var o = {
1082
1082
kind :"SelfSubjectRulesReview" ,
1083
1083
apiVersion :"v1"
1084
1084
} ;
1085
- f . create ( l , null , n , {
1085
+ f . create ( n , null , o , {
1086
1086
namespace :b
1087
1087
} ) . then ( function ( a ) {
1088
- var c = k ( a . status . rules ) , e = m ( a . status . rules ) ;
1088
+ var c = k ( a . status . rules ) , d = m ( a . status . rules ) ;
1089
1089
h . put ( b , {
1090
1090
rules :c ,
1091
- canAddToProject :e ,
1091
+ canAddToProject :d ,
1092
1092
forceRefresh :! 1 ,
1093
1093
cacheTimestamp :_ . now ( )
1094
- } ) , d . resolve ( ) ;
1094
+ } ) , j . resolve ( ) ;
1095
1095
} , function ( ) {
1096
- i = ! 0 , d . resolve ( ) ;
1096
+ i = ! 0 , j . resolve ( ) ;
1097
1097
} ) ;
1098
- } else c . log ( "AuthorizationService, resource 'selfsubjectrulesreviews' is not part of APIserver. Switching into permissive mode." ) , i = ! 0 , d . resolve ( ) ; else c . log ( "AuthorizationService, using cached rules for " + b + " project" ) , _ . now ( ) - j . cacheTimestamp >= 6e5 && ( j . forceRefresh = ! 0 ) , d . resolve ( ) ;
1099
- return d . promise ;
1098
+ } else c . log ( "AuthorizationService, resource 'selfsubjectrulesreviews' is not part of APIserver. Switching into permissive mode." ) , i = ! 0 , j . resolve ( ) ; else c . log ( "AuthorizationService, using cached rules for " + b + " project" ) , _ . now ( ) - l . cacheTimestamp >= 6e5 && ( l . forceRefresh = ! 0 ) , j . resolve ( ) ;
1099
+ return j . promise ;
1100
1100
} , o = function ( a ) {
1101
1101
return _ . get ( h . get ( a || g ) , [ "rules" ] ) ;
1102
1102
} , p = function ( a , b , c , d ) {
@@ -2892,7 +2892,9 @@ return a.all(_.map(i, function(a) {
2892
2892
var d = e ( ) ;
2893
2893
return a = _ . extend ( d , a ) , g ( a ) , a . subjects = _ . reject ( a . subjects , {
2894
2894
name :c
2895
- } ) , a . subjects . length ? b . update ( "rolebindings" , a . metadata . name , a , h ) :b [ "delete" ] ( "rolebindings" , a . metadata . name , h ) ;
2895
+ } ) , a . subjects . length ? b . update ( "rolebindings" , a . metadata . name , a , h ) :b [ "delete" ] ( "rolebindings" , a . metadata . name , h ) . then ( function ( ) {
2896
+ return a ;
2897
+ } ) ;
2896
2898
} ) ) ;
2897
2899
} , k = function ( a , d , e ) {
2898
2900
return b . list ( "rolebindings" , a , function ( a ) {
@@ -5178,7 +5180,7 @@ a !== b && (localStorage.setItem("monitoring.eventsidebar.collapsed", c.renderOp
5178
5180
} ) ;
5179
5181
} ) ) ;
5180
5182
} ] ) , angular . module ( "openshiftConsole" ) . controller ( "MembershipController" , [ "$filter" , "$location" , "$routeParams" , "$scope" , "$timeout" , "$uibModal" , "AuthService" , "AuthorizationService" , "DataService" , "ProjectsService" , "MembershipService" , "RoleBindingsService" , "RolesService" , function ( a , b , c , d , e , f , g , h , i , j , k , l , m ) {
5181
- var n , o = c . project , p = a ( "humanizeKind" ) , q = a ( "annotation" ) , r = [ ] , s = {
5183
+ var n , o = c . project , p = a ( "humanizeKind" ) , q = a ( "annotation" ) , r = a ( "canI" ) , s = [ ] , t = {
5182
5184
notice :{
5183
5185
yourLastRole :_ . template ( 'Removing the role "<%= roleName %>" may completely remove your ability to see this project.' )
5184
5186
} ,
@@ -5203,69 +5205,71 @@ exists:_.template('The role "<%= roleName %>" has already been granted to "<%= s
5203
5205
}
5204
5206
} ,
5205
5207
errorReason :_ . template ( 'Reason: "<%= httpErr %>"' )
5206
- } , t = function ( a , b , c , e , f ) {
5208
+ } , u = function ( a , b , c , e , f ) {
5207
5209
f = f || d , f . alerts [ a ] = {
5208
5210
type :b ,
5209
5211
message :c ,
5210
5212
details :e
5211
5213
} ;
5212
- } , u = function ( ) {
5213
- d . disableAddForm = ! 1 , d . newBinding . name = "" , d . newBinding . namespace = o , d . newBinding . newRole = null ;
5214
5214
} , v = function ( ) {
5215
+ d . disableAddForm = ! 1 , d . newBinding . name = "" , d . newBinding . namespace = o , d . newBinding . newRole = null ;
5216
+ } , w = function ( a ) {
5215
5217
i . list ( "rolebindings" , n , null , {
5216
5218
errorNotification :! 1
5217
5219
} ) . then ( function ( a ) {
5218
5220
angular . extend ( d , {
5219
5221
canShowRoles :! 0 ,
5220
5222
roleBindings :a . by ( "metadata.name" ) ,
5221
- subjectKindsForUI :k . mapRolebindingsForUI ( a . by ( "metadata.name" ) , r )
5222
- } ) , u ( ) ;
5223
+ subjectKindsForUI :k . mapRolebindingsForUI ( a . by ( "metadata.name" ) , s )
5224
+ } ) , v ( ) ;
5225
+ } , function ( ) {
5226
+ a && ( d . roleBindings [ a . metadata . name ] = a , d . subjectKindsForUI = k . mapRolebindingsForUI ( d . roleBindings , s ) ) , v ( ) ;
5223
5227
} ) ;
5224
- } , w = function ( b , c ) {
5228
+ } , x = function ( b , c ) {
5225
5229
d . disableAddForm = ! 0 , l . create ( b , c , o , n ) . then ( function ( ) {
5226
- v ( ) , t ( "rolebindingCreate" , "success" , s . update . subject . success ( {
5230
+ w ( ) , u ( "rolebindingCreate" , "success" , t . update . subject . success ( {
5227
5231
roleName :b . metadata . name ,
5228
5232
subjectName :c . name
5229
5233
} ) ) ;
5230
5234
} , function ( d ) {
5231
- u ( ) , t ( "rolebindingCreateFail" , "error" , s . update . subject . error ( {
5235
+ v ( ) , u ( "rolebindingCreateFail" , "error" , t . update . subject . error ( {
5232
5236
roleName :b . metadata . name ,
5233
5237
subjectName :c . name
5234
- } ) , s . errorReason ( {
5238
+ } ) , t . errorReason ( {
5235
5239
httpErr :a ( "getErrorDetails" ) ( d )
5236
5240
} ) ) ;
5237
5241
} ) ;
5238
- } , x = function ( b , c , e ) {
5242
+ } , y = function ( b , c , e ) {
5239
5243
d . disableAddForm = ! 0 , l . addSubject ( b , c , e , n ) . then ( function ( ) {
5240
- v ( ) , t ( "rolebindingUpdate" , "success" , s . update . subject . success ( {
5244
+ w ( ) , u ( "rolebindingUpdate" , "success" , t . update . subject . success ( {
5241
5245
roleName :b . roleRef . name ,
5242
5246
subjectName :c . name
5243
5247
} ) ) ;
5244
5248
} , function ( d ) {
5245
- u ( ) , t ( "rolebindingUpdateFail" , "error" , s . update . subject . error ( {
5249
+ v ( ) , u ( "rolebindingUpdateFail" , "error" , t . update . subject . error ( {
5246
5250
roleName :b . roleRef . name ,
5247
5251
subjectName :c . name
5248
- } ) , s . errorReason ( {
5252
+ } ) , t . errorReason ( {
5249
5253
httpErr :a ( "getErrorDetails" ) ( d )
5250
5254
} ) ) ;
5251
5255
} ) ;
5252
- } , y = { } ;
5253
- c . tab && ( y [ c . tab ] = ! 0 ) ;
5254
- var z = k . getSubjectKinds ( ) ;
5256
+ } , z = { } ;
5257
+ c . tab && ( z [ c . tab ] = ! 0 ) ;
5258
+ var A = k . getSubjectKinds ( ) ;
5255
5259
angular . extend ( d , {
5256
- selectedTab :y ,
5260
+ selectedTab :z ,
5257
5261
projectName :o ,
5258
5262
alerts :{ } ,
5259
5263
forms :{ } ,
5260
5264
emptyMessage :"Loading..." ,
5261
- subjectKinds :z ,
5265
+ subjectKinds :A ,
5262
5266
newBinding :{
5263
5267
role :"" ,
5264
5268
kind :c . tab || "User" ,
5265
5269
name :""
5266
5270
} ,
5267
5271
toggleEditMode :function ( ) {
5268
- u ( ) , d . mode . edit = ! d . mode . edit ;
5272
+ v ( ) , d . mode . edit = ! d . mode . edit ;
5269
5273
} ,
5270
5274
mode :{
5271
5275
edit :! 1
@@ -5291,10 +5295,10 @@ return a ? e + (q(a, "description") || b) :b;
5291
5295
}
5292
5296
}
5293
5297
} ) ;
5294
- var A = function ( a , b , c , e ) {
5298
+ var B = function ( a , b , c , e ) {
5295
5299
var f = {
5296
5300
alerts :{ } ,
5297
- detailsMarkup :s . remove . areYouSure . html . subject ( {
5301
+ detailsMarkup :t . remove . areYouSure . html . subject ( {
5298
5302
roleName :c ,
5299
5303
kindName :p ( b ) ,
5300
5304
subjectName :a
@@ -5303,12 +5307,12 @@ okButtonText:"Remove",
5303
5307
okButtonClass :"btn-danger" ,
5304
5308
cancelButtonText :"Cancel"
5305
5309
} ;
5306
- return _ . isEqual ( a , e ) && ( f . detailsMarkup = s . remove . areYouSure . html . self ( {
5310
+ return _ . isEqual ( a , e ) && ( f . detailsMarkup = t . remove . areYouSure . html . self ( {
5307
5311
roleName :c ,
5308
5312
subjectName :a
5309
- } ) , k . isLastRole ( d . user . metadata . name , d . roleBindings ) && t ( "currentUserLastRole" , "error" , s . notice . yourLastRole ( {
5313
+ } ) , k . isLastRole ( d . user . metadata . name , d . roleBindings ) && u ( "currentUserLastRole" , "error" , t . notice . yourLastRole ( {
5310
5314
roleName :c
5311
- } ) , null , f ) ) , _ . isEqual ( b , "ServiceAccount" ) && _ . startsWith ( c , "system:" ) && t ( "editingServiceAccountRole" , "error" , s . warning . serviceAccount ( ) , null , f ) , f ;
5315
+ } ) , null , f ) ) , _ . isEqual ( b , "ServiceAccount" ) && _ . startsWith ( c , "system:" ) && u ( "editingServiceAccountRole" , "error" , t . warning . serviceAccount ( ) , null , f ) , f ;
5312
5316
} ;
5313
5317
g . withUser ( ) . then ( function ( a ) {
5314
5318
d . user = a ;
@@ -5323,31 +5327,41 @@ a && !_.includes(d.projects, a) ? d.projects = [ a ].concat(b) :d.projects = b;
5323
5327
}
5324
5328
} ) ;
5325
5329
} ) , j . get ( c . project ) . then ( _ . spread ( function ( c , e ) {
5326
- n = e , v ( ) , angular . extend ( d , {
5330
+ n = e , w ( ) , angular . extend ( d , {
5327
5331
project :c ,
5328
- subjectKinds :z ,
5332
+ subjectKinds :A ,
5333
+ canUpdateRolebindings :r ( "rolebindings" , "update" , o ) ,
5329
5334
confirmRemove :function ( c , e , g ) {
5330
- var h = null , i = A ( c , e , g , d . user . metadata . name ) ;
5331
- _ . isEqual ( c , d . user . metadata . name ) && k . isLastRole ( d . user . metadata . name , d . roleBindings ) && ( h = ! 0 ) , f . open ( {
5335
+ var i = null , j = B ( c , e , g , d . user . metadata . name ) ;
5336
+ _ . isEqual ( c , d . user . metadata . name ) && k . isLastRole ( d . user . metadata . name , d . roleBindings ) && ( i = ! 0 ) , f . open ( {
5332
5337
animation :! 0 ,
5333
5338
templateUrl :"views/modals/confirm.html" ,
5334
5339
controller :"ConfirmModalController" ,
5335
5340
resolve :{
5336
5341
modalConfig :function ( ) {
5337
- return i ;
5342
+ return j ;
5338
5343
}
5339
5344
}
5340
5345
} ) . result . then ( function ( ) {
5341
- l . removeSubject ( c , g , d . roleBindings , n ) . then ( function ( ) {
5342
- h ? b . url ( "./" ) :( v ( ) , t ( "rolebindingUpdate" , "success" , s . remove . success ( {
5346
+ l . removeSubject ( c , g , d . roleBindings , n ) . then ( function ( a ) {
5347
+ i ? b . url ( "./" ) :( h . getProjectRules ( o , ! 0 ) . then ( function ( ) {
5348
+ w ( a [ 0 ] ) ;
5349
+ var b = r ( "rolebindings" , "update" , o ) ;
5350
+ angular . extend ( d , {
5351
+ canUpdateRolebindings :b ,
5352
+ mode :{
5353
+ edit :! ! d . mode . edit && b
5354
+ }
5355
+ } ) ;
5356
+ } ) , u ( "rolebindingUpdate" , "success" , t . remove . success ( {
5343
5357
roleName :g ,
5344
5358
subjectName :c
5345
5359
} ) ) ) ;
5346
5360
} , function ( b ) {
5347
- t ( "rolebindingUpdateFail" , "error" , s . remove . error ( {
5361
+ u ( "rolebindingUpdateFail" , "error" , t . remove . error ( {
5348
5362
roleName :g ,
5349
5363
subjectName :c
5350
- } ) , s . errorReason ( {
5364
+ } ) , t . errorReason ( {
5351
5365
httpErr :a ( "getErrorDetails" ) ( b )
5352
5366
} ) ) ;
5353
5367
} ) ;
@@ -5365,23 +5379,23 @@ name:c.metadata.name
5365
5379
} ) ;
5366
5380
g && _ . some ( g . subjects , {
5367
5381
name :a
5368
- } ) ? t ( "rolebindingUpdate" , "info" , s . update . subject . exists ( {
5382
+ } ) ? u ( "rolebindingUpdate" , "info" , t . update . subject . exists ( {
5369
5383
roleName :c . metadata . name ,
5370
5384
subjectName :a
5371
- } ) ) :g ? x ( g , f , e ) :w ( c , f , e ) ;
5385
+ } ) ) :g ? y ( g , f , e ) :x ( c , f , e ) ;
5372
5386
}
5373
5387
} ) , m . listAllRoles ( n , {
5374
5388
errorNotification :! 1
5375
5389
} ) . then ( function ( a ) {
5376
- r = k . mapRolesForUI ( _ . first ( a ) . by ( "metadata.name" ) , _ . last ( a ) . by ( "metadata.name" ) ) ;
5377
- var b = k . sortRoles ( r ) , c = k . filterRoles ( r ) , e = function ( a , b ) {
5390
+ s = k . mapRolesForUI ( _ . first ( a ) . by ( "metadata.name" ) , _ . last ( a ) . by ( "metadata.name" ) ) ;
5391
+ var b = k . sortRoles ( s ) , c = k . filterRoles ( s ) , e = function ( a , b ) {
5378
5392
return _ . some ( b , {
5379
5393
metadata :{
5380
5394
name :a
5381
5395
}
5382
5396
} ) ;
5383
5397
} ;
5384
- v ( ) , angular . extend ( d , {
5398
+ w ( ) , angular . extend ( d , {
5385
5399
toggle :{
5386
5400
roles :! 1
5387
5401
} ,
0 commit comments