{"action":"created","issue":{"url":"https://api.github.com/repos/vova07/yii2-start/issues/146","labels_url":"https://api.github.com/repos/vova07/yii2-start/issues/146/labels{/name}","comments_url":"https://api.github.com/repos/vova07/yii2-start/issues/146/comments","events_url":"https://api.github.com/repos/vova07/yii2-start/issues/146/events","html_url":"https://github.com/vova07/yii2-start/issues/146","id":97618427,"number":146,"title":"url to backend","user":{"login":"des1roer","id":10970793,"avatar_url":"https://avatars.githubusercontent.com/u/10970793?v=3","gravatar_id":"","url":"https://api.github.com/users/des1roer","html_url":"https://github.com/des1roer","followers_url":"https://api.github.com/users/des1roer/followers","following_url":"https://api.github.com/users/des1roer/following{/other_user}","gists_url":"https://api.github.com/users/des1roer/gists{/gist_id}","starred_url":"https://api.github.com/users/des1roer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/des1roer/subscriptions","organizations_url":"https://api.github.com/users/des1roer/orgs","repos_url":"https://api.github.com/users/des1roer/repos","events_url":"https://api.github.com/users/des1roer/events{/privacy}","received_events_url":"https://api.github.com/users/des1roer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-28T05:20:12Z","updated_at":"2015-07-28T06:26:37Z","closed_at":null,"body":"думаю можно же по умолчанию сделать на главной ссылку на бэк\r\n\r\n\\yii2-start\\vendor\\vova07\\yii2-start-themes\\site\\views\\layouts\\top-menu.php\r\n\r\n            [\r\n                'label' => Yii::t('vova07/themes/site', 'admin' ),\r\n                'url' => ['/backend'],\r\n                'visible' =>  (Yii::$app->user->identity->username == 'admin')\r\n            ],\r\n\r\nи на фронт\r\n\r\n\r\n\\yii2-start\\vendor\\vova07\\yii2-start-themes\\admin\\views\\layouts\\main.php\r\n\r\n            <!-- Header Navbar: style can be found in header.less -->\r\n            <nav class=\"navbar navbar-static-top\" role=\"navigation\">\r\n                <a class=\"navbar-btn sidebar-toggle\"  href=\"/\" title=\"app\"><i class=\"fa fa-reply\"></i> </a>\r\n                <!-- Sidebar toggle button-->\r\n                <a href=\"#\" class=\"navbar-btn sidebar-toggle\" data-toggle=\"offcanvas\" role=\"button\">\r\n                    <span class=\"sr-only\"><?= Yii::t('vova07/themes/admin', 'Toggle navigation') ?></span>\r\n                    <span class=\"icon-bar\"></span>\r\n                    <span class=\"icon-bar\"></span>\r\n                    <span class=\"icon-bar\"></span>\r\n                </a>\r\n\r\nтолько вот не могу понять как checkacces как в первом сделать. ну isAdmin желательно тож прикрутить. а еще вопрос по русификации - могу ли я в зависимости от языка в конфиге писать admin или админка?"},"comment":{"url":"https://api.github.com/repos/vova07/yii2-start/issues/comments/125466061","html_url":"https://github.com/vova07/yii2-start/issues/146#issuecomment-125466061","issue_url":"https://api.github.com/repos/vova07/yii2-start/issues/146","id":125466061,"user":{"login":"vova07","id":2714082,"avatar_url":"https://avatars.githubusercontent.com/u/2714082?v=3","gravatar_id":"","url":"https://api.github.com/users/vova07","html_url":"https://github.com/vova07","followers_url":"https://api.github.com/users/vova07/followers","following_url":"https://api.github.com/users/vova07/following{/other_user}","gists_url":"https://api.github.com/users/vova07/gists{/gist_id}","starred_url":"https://api.github.com/users/vova07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vova07/subscriptions","organizations_url":"https://api.github.com/users/vova07/orgs","repos_url":"https://api.github.com/users/vova07/repos","events_url":"https://api.github.com/users/vova07/events{/privacy}","received_events_url":"https://api.github.com/users/vova07/received_events","type":"User","site_admin":false},"created_at":"2015-07-28T06:26:37Z","updated_at":"2015-07-28T06:26:37Z","body":"В `Yii` есть возможность сразу проверять права пользователя, по этому лучше ваш код переделать в что-то похожее на это:\r\n```php\r\n$user = \\Yii::$app->user;\r\n$isAdmin = $user->can('superadmin') || $user->can('admin'); // true если юзер является админом\r\n// если роль \"superadmin\" наследуется от \"admin\" то для проверки будет достаточно только одно условия\r\n// $isAdmin = $user->can('admin'); # true если пользователь имеет права админа\r\n\r\n// Дальше просто используйте $isAdmin\r\nif (true === $isAdmin) {\r\n    // я админ, покажите мне что-то особенное\r\n} else {\r\n    // я обычный пользователь, и мне все равно какая у вас админка\r\n}\r\n```"}}