File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -156,8 +156,8 @@ public static function accessColumnAttributes()
156156public static function accessColumnAttributes()
157157{
158158 return [
159- 'owner' => 'user_id', // the column name with owner permissions
160- 'read' => 'read_permission', // the column name with read permissions
159+ 'owner' => 'user_id', // the column name with owner permissions
160+ 'read' => 'read_permission', // the column name with read permissions
161161 'update' => false, // will do no access checks for update
162162 'delete' => false, // will do no access checks for delete
163163 'domain' => 'language', // the column name with the access domain permission
Original file line number Diff line number Diff line change @@ -72,14 +72,14 @@ public static function find()
7272
7373 // access read check
7474 if ($ accessRead ) {
75- foreach ( array_keys ( self :: getUsersAuthItems ()) as $ authItem ) {
76- $ query -> orWhere ( ' FIND_IN_SET(" ' . $ authItem . ' ", ' . $ accessRead . ' ) ' );
77- }
75+ $ queryType = ( $ accessOwner ) ? ' orWhere ' : ' where ' ;
76+ $ authItems = implode ( ' , ' , array_keys ( self :: getUsersAuthItems ()) );
77+ $ query -> $ queryType ( ' FIND_IN_SET( ' . $ accessRead . ' , " ' . $ authItems . ' ") > 0 ' );
7878 }
7979
8080 // access domain check
8181 if ($ accessDomain ) {
82- $ query ->andWhere ([$ accessDomain => \Yii::$ app ->language ]);
82+ $ query ->andWhere ([$ accessDomain => [ \Yii::$ app ->language , self :: $ _public ] ]);
8383 }
8484 }
8585
You can’t perform that action at this time.
0 commit comments