Beispiel #1
0
 /**
  * Check if current route allowed for everyone (in commonPermission routes)
  *
  * @param string $currentFullRoute
  *
  * @return bool
  */
 protected static function isInCommonPermission($currentFullRoute)
 {
     $commonRoutes = Yii::$app->cache->get('__commonRoutes');
     if ($commonRoutes === false) {
         $commonRoutesDB = (new Query())->select('child')->from(Yii::$app->getModule('user')->auth_item_child_table)->where(['parent' => Yii::$app->getModule('user')->commonPermissionName])->column();
         $commonRoutes = Route::withSubRoutes($commonRoutesDB, ArrayHelper::map(Route::find()->asArray()->all(), 'name', 'name'));
         Yii::$app->cache->set('__commonRoutes', $commonRoutes, 3600);
     }
     return in_array($currentFullRoute, $commonRoutes);
 }