src/helpers/RBACHelper.php
public static function getRoutesByUser($userId)
    {
        if (!isset(self::$_userRoutes[$userId])) {
            $manager = self::getAuthManager();
            if ($manager->cache && ($routes = $manager->cache->get([__METHOD__, $userId])) !== false) {
                self::$_userRoutes[$userId] = $routes;
            } else {
                $routes = static::getDefaultRoutes();
                foreach ($manager->getPermissionsByUser($userId) as $item) {
                    if ($item->name[0] === '/') {
                        $routes[$item->name] = true;
                    }
                }
                self::$_userRoutes[$userId] = $routes;
                if ($manager->cache) {
                    $manager->cache->set([__METHOD__, $userId], $routes, $manager->cacheDuration, new TagDependency([
                        'tags' => $manager->cacheTag
                    ]));
                }
            }
        }
        return self::$_userRoutes[$userId];
    }
public static function getRoutesByUser($userId)
    {
        if (!isset(self::$_userRoutes[$userId])) {
            $manager = self::getAuthManager();
            if ($manager->cache && ($routes = $manager->cache->get([__METHOD__, $userId])) !== false) {
                self::$_userRoutes[$userId] = $routes;
            } else {
                $routes = static::getDefaultRoutes();
                foreach ($manager->getPermissionsByUser($userId) as $item) {
                    if ($item->name[0] === '/') {
                        $routes[$item->name] = true;
                    }
                }
                self::$_userRoutes[$userId] = $routes;
                if ($manager->cache) {
                    $manager->cache->set([__METHOD__, $userId], $routes, $manager->cacheDuration, new TagDependency([
                        'tags' => $manager->cacheTag
                    ]));
                }
            }
        }
        return self::$_userRoutes[$userId];
    }
public static function getRoutesByUser ( $ userId ) { if ( ! isset ( self :: $ _userRoutes [ $ userId ] ) ) { $ manager = self :: getAuthManager ( ) ; if ( $ manager -> cache && ( $ routes = $ manager -> cache -> get ( [ __METHOD__ , $ userId ] ) ) !== false ) { self :: $ _userRoutes [ $ userId ] = $ routes ; } else { $ routes = static :: getDefaultRoutes ( ) ; foreach ( $ manager -> getPermissionsByUser ( $ userId ) as $ item ) { if ( $ item -> name [ 0 ] === '/' ) { $ routes [ $ item -> name ] = true ; } } self :: $ _userRoutes [ $ userId ] = $ routes ; if ( $ manager -> cache ) { $ manager -> cache -> set ( [ __METHOD__ , $ userId ] , $ routes , $ manager -> cacheDuration , new TagDependency ( [ 'tags' => $ manager -> cacheTag ] ) ) ; } } } return self :: $ _userRoutes [ $ userId ] ; }
Get assigned routes of user.
@param integer $userId
@return array
Get assigned routes of user .