@@ -66,7 +66,7 @@ pub trait RbacApi: MgmtApi {
66
66
}
67
67
68
68
fn get_roles_for_user (
69
- & mut self ,
69
+ & self ,
70
70
name : & str ,
71
71
domain : Option < & str > ,
72
72
) -> Vec < String > ;
@@ -76,7 +76,7 @@ pub trait RbacApi: MgmtApi {
76
76
domain : Option < & str > ,
77
77
) -> Vec < String > ;
78
78
fn has_role_for_user (
79
- & mut self ,
79
+ & self ,
80
80
name : & str ,
81
81
role : & str ,
82
82
domain : Option < & str > ,
@@ -92,12 +92,12 @@ pub trait RbacApi: MgmtApi {
92
92
permission : Vec < String > ,
93
93
) -> bool ;
94
94
fn get_implicit_roles_for_user (
95
- & mut self ,
95
+ & self ,
96
96
name : & str ,
97
97
domain : Option < & str > ,
98
98
) -> Vec < String > ;
99
99
fn get_implicit_permissions_for_user (
100
- & mut self ,
100
+ & self ,
101
101
name : & str ,
102
102
domain : Option < & str > ,
103
103
) -> Vec < Vec < String > > ;
@@ -212,14 +212,14 @@ where
212
212
}
213
213
214
214
fn get_roles_for_user (
215
- & mut self ,
215
+ & self ,
216
216
name : & str ,
217
217
domain : Option < & str > ,
218
218
) -> Vec < String > {
219
219
let mut roles = vec ! [ ] ;
220
- if let Some ( t1) = self . get_mut_model ( ) . get_mut_model ( ) . get_mut ( "g" ) {
221
- if let Some ( t2) = t1. get_mut ( "g" ) {
222
- roles = t2. rm . write ( ) . get_roles ( name, domain) ;
220
+ if let Some ( t1) = self . get_model ( ) . get_model ( ) . get ( "g" ) {
221
+ if let Some ( t2) = t1. get ( "g" ) {
222
+ roles = t2. rm . read ( ) . get_roles ( name, domain) ;
223
223
}
224
224
}
225
225
@@ -240,7 +240,7 @@ where
240
240
}
241
241
242
242
fn has_role_for_user (
243
- & mut self ,
243
+ & self ,
244
244
name : & str ,
245
245
role : & str ,
246
246
domain : Option < & str > ,
@@ -311,16 +311,15 @@ where
311
311
}
312
312
313
313
fn get_implicit_roles_for_user (
314
- & mut self ,
314
+ & self ,
315
315
name : & str ,
316
316
domain : Option < & str > ,
317
317
) -> Vec < String > {
318
318
let mut res: HashSet < String > = HashSet :: new ( ) ;
319
319
let mut q: Vec < String > = vec ! [ name. to_owned( ) ] ;
320
320
while !q. is_empty ( ) {
321
321
let name = q. swap_remove ( 0 ) ;
322
- let roles =
323
- self . get_role_manager ( ) . write ( ) . get_roles ( & name, domain) ;
322
+ let roles = self . get_role_manager ( ) . read ( ) . get_roles ( & name, domain) ;
324
323
for r in roles. into_iter ( ) {
325
324
if res. insert ( r. to_owned ( ) ) {
326
325
q. push ( r) ;
@@ -331,7 +330,7 @@ where
331
330
}
332
331
333
332
fn get_implicit_permissions_for_user (
334
- & mut self ,
333
+ & self ,
335
334
user : & str ,
336
335
domain : Option < & str > ,
337
336
) -> Vec < Vec < String > > {
0 commit comments