{"id":296482,"date":"2019-12-27T09:00:22","date_gmt":"2019-12-27T09:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=296482"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=296482","title":{"rendered":"\u041a\u0430\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0440\u043e\u043b\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 Laravel: \u043e\u0431\u0437\u043e\u0440\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 RBAC \u043f\u0430\u043a\u0435\u0442\u043e\u0432"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/481796\/\">\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043a \u0442\u0435\u043c \u0438\u043b\u0438 \u0438\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u043c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nu\/g1\/_a\/nug1_ao419t1xnbdst80hw0c6re.png\"><br \/>  <a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 5.1 Laravel \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b Auth Gates \u2014 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u044b\u0431\u043e\u0440: \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043b\u0438 \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u0430\u0432 \u0438 \u0440\u043e\u043b\u0435\u0439. \u0412\u0442\u043e\u0440\u043e\u0439 \u0436\u0435 (\u043f\u0440\u0438 \u0432\u0435\u0440\u043d\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u0435 \u043f\u0430\u043a\u0435\u0442\u0430) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<p>  \u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043e\u0431\u0437\u043e\u0440 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 RBAC (Role Based Access Control) \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u043e\u043b\u0435\u0439. \u0421\u0440\u0430\u0437\u0443 \u0443\u0442\u043e\u0447\u043d\u0438\u043c, \u0447\u0442\u043e \u043d\u0430 \u0438\u0441\u0442\u0438\u043d\u0443 \u0432\u044b\u0441\u0448\u0435\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u0435\u0442: \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u0430\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 \u0435\u043c\u0443 \u043d\u0443\u0436\u0435\u043d (\u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u0435\u043d). \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e RBAC, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043e\u0431\u0437\u043e\u0440\u0435 Sentinel \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h2>\n<p>  <\/p>\n<h3>Laravel-permission by Spatie<\/h3>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0430:<\/b> <a href=\"https:\/\/github.com\/spatie\/laravel-permission\">https:\/\/github.com\/spatie\/laravel-permission<\/a><br \/>  <b>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/b> <a href=\"https:\/\/docs.spatie.be\/laravel-permission\/v3\">https:\/\/docs.spatie.be\/laravel-permission\/v3<\/a><br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/b> 3.6\u041c<br \/>  <b>\u0412\u0435\u0440\u0441\u0438\u044f Laravel:<\/b> \u043e\u0442 5.8 \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 3<br \/>  <b>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/b> \u043d\u0435\u0442 (\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/LaravelDaily\/laravel-roles-permissions-manager\">\u043f\u0430\u043a\u0435\u0442<\/a>)<br \/>  <b>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 Laravel Auth:<\/b> \u0434\u0430<\/p>\n<p>  <b>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b>  <\/p>\n<ol>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 artisan \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e\/\u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u044e \u043f\u0440\u0430\u0432.<\/li>\n<li>\u0413\u043e\u0442\u043e\u0432\u044b\u0435 scope \u043f\u043e \u0440\u043e\u043b\u044f\u043c \u0438 \u043f\u0440\u0430\u0432\u0430\u043c.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0430\u043a\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Laravel Auth Gates.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c blade directives \u043f\u0430\u043a\u0435\u0442\u0430: <a href=\"https:\/\/habr.com\/ru\/users\/role\/\" class=\"user_link\">role<\/a> (@hasrole), @hasanyrole, @hasallroles, @unlessrole.<\/li>\n<li>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0430\u0432 \u0438 \u0440\u043e\u043b\u0435\u0439.<\/li>\n<\/ol>\n<p>  <b>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b> \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 authorize() \u0434\u043b\u044f policy \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 permission \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0438\u043c\u044f, \u043a\u0430\u043a \u0438 policy, \u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043d\u043e, \u0430 \u043d\u0435 policy.<\/p>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wk\/vj\/i2\/wkvji2hqhzspjgkoy2mn4ynh5fu.png\"><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/b><\/p>\n<pre><code class=\"php\">\/\/ \u0412\u044b\u0434\u0430\u0447\u0430 \u043f\u0440\u0430\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e $user-&gt;givePermissionTo('edit articles');  \/\/ \u041f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0440\u043e\u043b\u0435\u0439 $user-&gt;assignRole('writer', 'admin'); \/\/ \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 $user-&gt;assignRole(['writer', 'admin']);  \/\/ \u0412\u044b\u0434\u0430\u0447\u0430 \u043f\u0440\u0430\u0432 \u0440\u043e\u043b\u0438 $role-&gt;givePermissionTo('edit articles');<\/code><\/pre>\n<h3>Bouncer by Joseph Silber<\/h3>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0430:<\/b> <a href=\"https:\/\/github.com\/JosephSilber\/bouncer\">https:\/\/github.com\/JosephSilber\/bouncer<\/a><br \/>  <b>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/b> <a href=\"https:\/\/github.com\/JosephSilber\/bouncer#introduction\">https:\/\/github.com\/JosephSilber\/bouncer#introduction<\/a><br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/b> 418\u041a<br \/>  <b>\u0412\u0435\u0440\u0441\u0438\u044f Laravel:<\/b> \u043e\u0442 5.1.20<br \/>  <b>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/b> \u043d\u0435\u0442 (\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/LaravelDaily\/laravel-roles-permissions-bouncer\">\u043f\u0430\u043a\u0435\u0442<\/a>)<br \/>  <b>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 Laravel Auth:<\/b> \u0434\u0430<\/p>\n<p>  <b>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b>  <\/p>\n<ol>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437 Laravel.<\/li>\n<li>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0430\u0432 \u0438 \u0440\u043e\u043b\u0435\u0439.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0430\u0432\u0430 (\u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0438\u0431\u043e \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0443.<\/li>\n<li>\u0412\u044b\u0434\u0430\u0447\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u201c\u0441\u0432\u043e\u0438\u0445\u201d \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439: \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201ctoOwn\u201d \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f user_id \u0438 $user-&gt;id, \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c). \u041c\u043e\u0436\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cto\u201d.<\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Multitenancy (\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cscope\u201d).<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cscope\u201d \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u043e\u043b\u0438 \u0438 \u043f\u0440\u0430\u0432\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 (\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430) \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0430\u0432\u0430 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0430\u0439\u0442\u0430.<\/li>\n<li>\u041a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f artisan \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0411\u0414 \u043e\u0442 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 permission.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0431\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u043d\u044f\u0442\u044c \u0431\u0430\u043d (forbidden ability).<\/li>\n<\/ol>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b> \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u043e\u043b\u044c \u0438 \u043f\u0440\u0430\u0432\u0430 \u0434\u043b\u044f \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439.<\/p>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8l\/-7\/4t\/8l-74tbyt8ir3y9ilkgbhd-oj1u.png\"><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/b><\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0443:<\/b>  <\/p>\n<pre><code class=\"php\">Bouncer::allow($user)-&gt;to('edit', Post::class); Bouncer::allow($user)-&gt;to('edit', $post);<\/code><\/pre>\n<p>  <b>\u0412\u044b\u0434\u0430\u0447\u0430 \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u201c\u0441\u0432\u043e\u0438\u0445\u201d \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439:<\/b>  <\/p>\n<pre><code class=\"php\">Bouncer::allow($user)-&gt;toOwn(Post::class)-&gt;to(['view', 'update']);<\/code><\/pre>\n<h3>Laratrust by Santigarcor<\/h3>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0430:<\/b> <a href=\"https:\/\/github.com\/santigarcor\/laratrust\">https:\/\/github.com\/santigarcor\/laratrust<\/a><br \/>  <b>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/b> <a href=\"https:\/\/laratrust.santigarcor.me\/\">https:\/\/laratrust.santigarcor.me\/<\/a><br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/b> 601K<br \/>  <b>\u0412\u0435\u0440\u0441\u0438\u044f Laravel:<\/b> ~6.0<br \/>  <b>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/b> \u043d\u0435\u0442<br \/>  <b>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 Laravel Auth:<\/b> \u043d\u0435\u0442<\/p>\n<p>  <b>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b>  <\/p>\n<ol>\n<li>\u042d\u0442\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%BE%D1%80%D0%BA\">\u0444\u043e\u0440\u043a<\/a> ENTRUST (<a href=\"https:\/\/github.com\/Zizaco\/entrust\">https:\/\/github.com\/Zizaco\/entrust<\/a>).<\/li>\n<li>\u0415\u0441\u0442\u044c \u0441\u0432\u043e\u0438 blade directives.<\/li>\n<li>\u0418\u0437-\u0437\u0430 \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 Laravel \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 blade directive <a href=\"https:\/\/habr.com\/ru\/users\/can\/\" class=\"user_link\">can<\/a> \u2014 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c $user-&gt;can(\u2018edit-user\u2019) \u043b\u0438\u0431\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"https:\/\/habr.com\/ru\/users\/permission\/\" class=\"user_link\">permission<\/a>.<\/li>\n<li>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u043e\u043b\u0435\u0439\/\u043f\u0440\u0430\u0432.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 ability \u2014 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0440\u043e\u043b\u0438 \u0438 \u043f\u0440\u0430\u0432\u0430.<\/li>\n<li>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 middleware.<\/li>\n<li>Multitenancy \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 teams.<\/li>\n<\/ol>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9l\/eh\/my\/9lehmyzoqarmzmhgrasrd4pfpxm.png\"><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/b>  <\/p>\n<pre><code class=\"php\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043f\u0440\u0430\u0432 $user-&gt;hasRole(['owner', 'admin']);       $user-&gt;can(['edit-user', 'create-post']);  $user-&gt;hasRole('owner|admin');       $user-&gt;can('edit-user|create-post');  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 $user-&gt;owns($post) \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e $post-&gt;user_id  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 $owner = new Role(); $owner-&gt;name         = 'owner'; $owner-&gt;display_name = 'Project Owner'; \/\/ optional $owner-&gt;description  = 'User is the owner of a given project'; \/\/ optional $owner-&gt;save();<\/code><\/pre>\n<h3>Sentinel by Cartalyst<\/h3>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0430:<\/b> <a href=\"https:\/\/github.com\/cartalyst\/sentinel\">https:\/\/github.com\/cartalyst\/sentinel<\/a><br \/>  <b>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/b> <a href=\"https:\/\/cartalyst.com\/manual\/sentinel\/3.x\">https:\/\/cartalyst.com\/manual\/sentinel\/3.x<\/a><br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/b> 957K<br \/>  <b>\u0412\u0435\u0440\u0441\u0438\u044f Laravel:<\/b> 6.2<br \/>  <b>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/b> \u043d\u0435\u0442<br \/>  <b>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 Laravel Auth:<\/b> \u043d\u0435\u0442<\/p>\n<p>  <b>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b>  <\/p>\n<ol>\n<li>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u043e\u043b\u0438 \u0438 \u043f\u0440\u0430\u0432\u0430, \u043d\u043e \u0438 \u0432\u0441\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439.<\/li>\n<li>\u041f\u0430\u043a\u0435\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f framework agnostic, \u0442.\u0435. \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Laravel \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e composer: illuminate\/database, illuminate\/events, symfony\/http-foundation.<\/li>\n<li>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0434\u0434\u043e\u043d\u0430 Sentinel Expired-Permissions \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f.<\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 Multitenancy \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0434\u0434\u043e\u043d\u0430 Sentinel Multitenancy.<\/li>\n<\/ol>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: <\/b>\u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430 \u0447\u0438\u0441\u0442\u044b\u0439 Laravel 6.2 \u0438 PostgreSQL \u043f\u0440\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430: \u0442\u0430\u0431\u043b\u0438\u0446\u0430 users \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oa\/ra\/nx\/oaranx8jzv7cynf6qsyeexafrfu.png\"><\/p>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gp\/io\/po\/gpiopoubv-q65bd3ivraxjnbun0.png\"><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/b><\/p>\n<pre><code class=\"php\">\/\/ \u041f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 $user = Sentinel::findById(1); $role = Sentinel::findRoleByName('Subscribers'); $role-&gt;users()-&gt;attach($user);  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u043e\u043b\u0438 $admin = Sentinel::inRole('admin');  \/\/ \u0412\u044b\u0434\u0430\u0447\u0430 \u043f\u0440\u0430\u0432 $user-&gt;permissions = [     'user.create' =&gt; true,     'user.delete' =&gt; false, ]; $user-&gt;save();  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0430\u0432 $user-&gt;hasAccess(['user.create', 'user.update']); Sentinel::hasAnyAccess(['user.admin', 'user.update']);<\/code><\/pre>\n<h3>Laravel-ACL by Kodeine<\/h3>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0430:<\/b> <a href=\"https:\/\/github.com\/kodeine\/laravel-acl\">https:\/\/github.com\/kodeine\/laravel-acl<\/a><br \/>  <b>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/b> <a href=\"https:\/\/github.com\/kodeine\/laravel-acl\/wiki\">https:\/\/github.com\/kodeine\/laravel-acl\/wiki<\/a><br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/b> 170K<br \/>  <b>\u0412\u0435\u0440\u0441\u0438\u044f Laravel:<\/b> 5.0 \u0438 \u0432\u044b\u0448\u0435<br \/>  <b>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/b> \u043d\u0435\u0442<br \/>  <b>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 Laravel Auth:<\/b> \u043d\u0435\u0442<\/p>\n<p>  <b>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b>  <\/p>\n<ol>\n<li>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432.<\/li>\n<li>\u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u0432.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 blade directives: <a href=\"https:\/\/habr.com\/ru\/users\/role\/\" class=\"user_link\">role<\/a>, <a href=\"https:\/\/habr.com\/ru\/users\/permission\/\" class=\"user_link\">permission<\/a>.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e middleware.<\/li>\n<\/ol>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/b> \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438: <\/p>\n<ul>\n<li>\u0412 \u0444\u0430\u0439\u043b\u0435 config\/acl \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u0446\u0438\u044e users_table \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u00abdoctrine\/dbal\u00bb \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Laravel, \u0447\u0442\u043e\u0431\u044b \u201c\u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c\u201d \u0435\u0433\u043e \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0435\u0439.<\/li>\n<\/ul>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k8\/1o\/v4\/k81ov4logc5mzrpkz2vmqcbw4jc.png\"><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/b>  <\/p>\n<pre><code class=\"php\">\/\/ \u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u0432 $permissionInternship = Permission::create([             'name'        =&gt; 'internships',             'slug'        =&gt; [ \/\/ \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0430\u0432                 'create' =&gt; true,                 'view'   =&gt; true,                 'update' =&gt; true,                 'delete' =&gt; true,             ],             'description' =&gt; 'manage internships'         ]);  $permissionStudent = Permission::create([             'name'        =&gt; 'internships.student',             'slug'        =&gt; [ \/\/\u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0430\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430                 'create' =&gt; false,             ],             \/\/ \u0441\u0430\u043c\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435             'inherit_id' =&gt; $permissionInternship-&gt;getKey(),             'description' =&gt; 'student internship permissions'         ]);<\/code><\/pre>\n<h3>Laravel-acl by Mateus Junges<\/h3>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0430:<\/b> <a href=\"https:\/\/github.com\/mateusjunges\/laravel-acl\">https:\/\/github.com\/mateusjunges\/laravel-acl<\/a><br \/>  <b>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/b> <a href=\"https:\/\/mateusjunges.github.io\/laravel-acl\/\">https:\/\/mateusjunges.github.io\/laravel-acl\/<\/a><br \/>  <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/b> 1.8K<br \/>  <b>\u0412\u0435\u0440\u0441\u0438\u044f Laravel:<\/b> 5.0 \u0438 \u0432\u044b\u0448\u0435<br \/>  <b>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/b> \u0434\u0430 (\u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b)<br \/>  <b>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 Laravel Auth:<\/b> \u043d\u0435\u0442<\/p>\n<p>  <b>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b>  <\/p>\n<ol>\n<li>\u0413\u043e\u0442\u043e\u0432\u044b\u0435 scope.<\/li>\n<li>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 blade directives: <a href=\"https:\/\/habr.com\/ru\/users\/group\/\" class=\"user_link\">group<\/a>, @elsegroup, <a href=\"https:\/\/habr.com\/ru\/users\/permission\/\" class=\"user_link\">permission<\/a>, @elsepermission, @allpermission,@allgroups, @anypermission, @anygroup<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0434\u043b\u044f artisan \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0433\u0440\u0443\u043f\u043f\/\u043f\u0440\u0430\u0432 \u0438 \u0438\u0445 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u0430\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e middleware: PermissionMiddleware, GroupMiddleware, HierarchicalPermissions, PermissionOrGroupMiddleware.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0444\u043e\u0440\u043c \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u044f\u043c\u0438.<\/li>\n<\/ol>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qc\/ux\/ip\/qcuxip3a0lzwgtslkqnahpg7bxk.png\"><\/p>\n<h2>\u0421\u0432\u043e\u0434\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430<\/h2>\n<p>  <a href=\"https:\/\/habrastorage.org\/webt\/ay\/n3\/v2\/ayn3v2opfwm4lzzjyrabpvyyge4.png\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ay\/n3\/v2\/ayn3v2opfwm4lzzjyrabpvyyge4.png\" width=\"800\"><\/a><\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041f\u043e \u043d\u0430\u0448\u0438\u043c \u043e\u0446\u0435\u043d\u043a\u0430\u043c, \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u043e\u043b\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 Laravel-permission \u0438 Bouncer, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0441\u0442\u044c Laravel-ACL by Kodeine \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439 \u0440\u043e\u043b\u0435\u0439. Laravel-ACL by Mateus Junges \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u201c\u0441\u0432\u0435\u0436\u0438\u043c\u201d \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0438 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0443\u043c\u0435\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u043e\u043b\u0435\u0439. Sentinel \u2013 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u043a\u0443\u0447\u0435\u0439 \u0444\u0438\u0447, \u043f\u043e\u043c\u0438\u043c\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u044f\u043c\u0438. Laratrust \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0442\u0435\u043c, \u043a\u043e\u043c\u0443 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f Entrust.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 Laravel \u2013 Gates and Policies. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0430\u0432. \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u043e\u043b\u0435\u0439 \u0438\u043b\u0438 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u0442\u043e \u0432\u0430\u0448\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gates and Policies.<\/p>\n<h4>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/321678\/\">habr.com\/ru\/post\/321678<\/a> \u2014 \u0434\u043b\u044f \u201c\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445\u201d \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/li>\n<li><a href=\"https:\/\/laravel-news.com\/two-best-roles-permissions-packages\">laravel-news.com\/two-best-roles-permissions-packages<\/a> \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 Bouncer \u0438 Laravel-permission<\/li>\n<\/ul>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/481796\/\"> https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/481796\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/481796\/\">\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043a \u0442\u0435\u043c \u0438\u043b\u0438 \u0438\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u043c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nu\/g1\/_a\/nug1_ao419t1xnbdst80hw0c6re.png\">  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-296482","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296482"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296482\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}