@@ -100,7 +100,11 @@ class DbManager extends BaseManager
100
100
* @var array auth item parent-child relationships (childName => list of parents)
101
101
*/
102
102
protected $ parents ;
103
-
103
+ /**
104
+ * @var array user assignments (user id => Assignment[])
105
+ * @since `protected` since 2.0.38
106
+ */
107
+ protected $ checkAccessAssignments = [];
104
108
105
109
/**
106
110
* Initializes the application component.
@@ -115,18 +119,16 @@ public function init()
115
119
}
116
120
}
117
121
118
- private $ _checkAccessAssignments = [];
119
-
120
122
/**
121
123
* {@inheritdoc}
122
124
*/
123
125
public function checkAccess ($ userId , $ permissionName , $ params = [])
124
126
{
125
- if (isset ($ this ->_checkAccessAssignments [(string ) $ userId ])) {
126
- $ assignments = $ this ->_checkAccessAssignments [(string ) $ userId ];
127
+ if (isset ($ this ->checkAccessAssignments [(string ) $ userId ])) {
128
+ $ assignments = $ this ->checkAccessAssignments [(string ) $ userId ];
127
129
} else {
128
130
$ assignments = $ this ->getAssignments ($ userId );
129
- $ this ->_checkAccessAssignments [(string ) $ userId ] = $ assignments ;
131
+ $ this ->checkAccessAssignments [(string ) $ userId ] = $ assignments ;
130
132
}
131
133
132
134
if ($ this ->hasNoAssignments ($ assignments )) {
@@ -857,7 +859,7 @@ public function assign($role, $userId)
857
859
'created_at ' => $ assignment ->createdAt ,
858
860
])->execute ();
859
861
860
- unset($ this ->_checkAccessAssignments [(string ) $ userId ]);
862
+ unset($ this ->checkAccessAssignments [(string ) $ userId ]);
861
863
return $ assignment ;
862
864
}
863
865
@@ -870,7 +872,7 @@ public function revoke($role, $userId)
870
872
return false ;
871
873
}
872
874
873
- unset($ this ->_checkAccessAssignments [(string ) $ userId ]);
875
+ unset($ this ->checkAccessAssignments [(string ) $ userId ]);
874
876
return $ this ->db ->createCommand ()
875
877
->delete ($ this ->assignmentTable , ['user_id ' => (string ) $ userId , 'item_name ' => $ role ->name ])
876
878
->execute () > 0 ;
@@ -885,7 +887,7 @@ public function revokeAll($userId)
885
887
return false ;
886
888
}
887
889
888
- unset($ this ->_checkAccessAssignments [(string ) $ userId ]);
890
+ unset($ this ->checkAccessAssignments [(string ) $ userId ]);
889
891
return $ this ->db ->createCommand ()
890
892
->delete ($ this ->assignmentTable , ['user_id ' => (string ) $ userId ])
891
893
->execute () > 0 ;
@@ -970,7 +972,7 @@ public function removeAllRules()
970
972
*/
971
973
public function removeAllAssignments ()
972
974
{
973
- $ this ->_checkAccessAssignments = [];
975
+ $ this ->checkAccessAssignments = [];
974
976
$ this ->db ->createCommand ()->delete ($ this ->assignmentTable )->execute ();
975
977
}
976
978
@@ -982,7 +984,7 @@ public function invalidateCache()
982
984
$ this ->rules = null ;
983
985
$ this ->parents = null ;
984
986
}
985
- $ this ->_checkAccessAssignments = [];
987
+ $ this ->checkAccessAssignments = [];
986
988
}
987
989
988
990
public function loadFromCache ()
0 commit comments