Skip to content

Policies(権限)

オープンソース・ワークショップ 永原 篤 edited this page Oct 13, 2019 · 58 revisions
  • Authority and Roles(権限と役割)

Base(基本)

Authority(権限) role(役割)
Target
(対象)
action
(権限)
reporter
(記事追加)
arrangement
(配置)
approval
(承認)
article
(記事修正)
article_admin
(記事管理者)
frames
(フレーム)
create
(追加)
OK OK
move
(移動)
OK OK
edit
(編集)
OK OK
delete
(削除)
OK OK
change
(選択)
OK OK
buckets
(バケツ)
create
(作成)
OK OK
editColumn
(カラム編集)
OK OK
downloadCsv
(CSVダウンロード)
OK OK
delete
(削除)
Own Only OK
posts
(記事)
create
(追加)
OK OK OK
update
(変更)
Own Only OK OK
delete
(削除)
Own Only OK OK
approval
(承認)
OK OK
  • How to specify in PHP(PHPでの指定方法)
// Authority Check(権限チェック)
if ($this->can('posts.create')) {
    return $this->view_error(403);
}

// Authority Check with Posts(POSTデータの権限チェック)
if ($this->can('posts.update', $blogs_post, 'blogs')) {
    return $this->view_error(403);
}

// Role Check(役割チェック)
if ($this->can('role_reporter')) {
    return $this->view_error(403);
}

// Role Check with Posts(POSTデータの役割チェック)* Unimplemented(未実装)
if ($this->can('role_approval', $blogs_post, 'blogs')) {
    return $this->view_error(403);
}
  • How to specify in Blade Template(ブレードテンプレートでの指定方法)
{{-- Authority Check(権限チェック) --}}
@can('posts.create','blogs')
...
@endcan

{{-- Authority Check with Posts(POSTデータの権限チェック) --}}
@can('posts.update',[[$post, 'blogs']])
...
@endcan

{{-- Role Check(役割チェック) --}}
@can('role_reporter','blogs')
...
@endcan

{{-- Role Check with Posts(POSTデータの役割チェック)* Unimplemented(未実装) --}}
@can('role_reporter',[[$post, 'blogs']])
...
@endcan

Manage(管理)

role(役割)
Explain(説明) Define(定義)
System manager admin_system
Page manager admin_page
Site manager admin_site
User manager admin_user
Clone this wiki locally