14
ACLを高速化する コンポーネント Jan 2011 CakePHP新春勉強会@東京 from 福岡サテライト

CakePHP SessionAcl Component

Embed Size (px)

DESCRIPTION

CakePHP新春勉強会@東京 LT

Citation preview

Page 1: CakePHP SessionAcl Component

ACLを高速化するコンポーネント

Jan 2011

CakePHP新春勉強会@東京from 福岡サテライト

Page 2: CakePHP SessionAcl Component

About Me

• WEB Developer / PHP / CakePHP / HTML / CSS / jQuery / MySQL / iPhone / 佐賀 / 福岡 / 島根 / 熊本 / プリン / キイロイトリ / ミッフィー / no more トマト

• BLOG: http://php-tips.com/

• TWITTER: @nojimage

名前: 野島 隆(のじま たかし)所属:イラスティックコンサルタンツ株式会社

Page 3: CakePHP SessionAcl Component

ACL Component

Page 4: CakePHP SessionAcl Component

Aclは重い

•権限を調べるcheckメソッドでは→Aroの取得→Acoの取得→Permissionの取得計3回のクエリを発行

Page 5: CakePHP SessionAcl Component

SessionACL Component

Page 6: CakePHP SessionAcl Component

SessionAcl

•http://bakery.cakephp.org/articles/macduy/2010/01/05/acl-caching-using-session

•Mac Duy Hai (macduy)

Page 7: CakePHP SessionAcl Component

SessionAcl

•AclComponentの代替えコンポーネント

•check()の結果をセッションにキャッシュ

→ 2回目以降の呼び出しが高速化

Page 8: CakePHP SessionAcl Component

How to use?

•bakery記事のコードをsession_acl.phpとしてapp/components/に保存<?phpclass AppController extends Controller {

// ...

// Aclの代わりにSessionAclを指定 public $components = array(‘SessionAcl’);

// ...

Page 9: CakePHP SessionAcl Component

wait!

•本当にAclComponent互換?

Page 10: CakePHP SessionAcl Component

wait!

•CakePHP1.3.6のAclComponent

のテストを走らせてみた

Page 11: CakePHP SessionAcl Component

wait!

•CakePHP1.3.6のAclComponent

のテストを走らせてみた→ いくつかのテストが失敗

Page 12: CakePHP SessionAcl Component

fixed!

•修正しましたhttps://gist.github.com/779479

Page 13: CakePHP SessionAcl Component

Attention!!

•セッションに権限情報を格納するのでログアウトするまでACLの変更が反映されない

Page 14: CakePHP SessionAcl Component

ご静聴ありがとうございました