{"id":1017,"date":"2010-10-13T09:46:11","date_gmt":"2010-10-13T01:46:11","guid":{"rendered":"http:\/\/blog.pighead.cc\/whsyu\/?p=1017"},"modified":"2010-10-14T09:56:28","modified_gmt":"2010-10-14T01:56:28","slug":"acl-in-cakephp","status":"publish","type":"post","link":"https:\/\/blog.pighead.cc\/whsyu\/2010\/10\/13\/acl-in-cakephp\/","title":{"rendered":"ACL in CakePHP"},"content":{"rendered":"<p class=\"bb-post-separator\"><strong>[\u83ef\u8a9e, cmn-Hant-TW]  <\/strong><\/p><p>cakephp \u4e0b\u958b acl \u7684\u7c21\u55ae<del>\u758f\u5931<\/del>\u5fc3\u5f97\uff0c\u7576\u7136\u8cc7\u6599\u5eab\u9023\u7d50\u4e4b\u985e\u7684\u8a2d\u5b9a\u8981\u5148\u5f04\u597d\uff0c\u7136\u5f8c\u81f3\u5c11\u8981\u6709\u4e00\u500b\u5beb\u597d\u7684 controller \u3002<\/p>\n<p>\u7528 console \u5de5\u5177\u4f86\u5f04\u6703\u6bd4\u8f03\u65b9\u4fbf\uff0c\u9996\u5148\u8981\u5207\u5230 app \u7684\u76ee\u9304\u4e0b<\/p>\n<pre lang=\"bash\">..\/cake\/console\/cake schema create DbAcl<\/pre>\n<p>\u9019\u662f 1.3 \u7684\u8a9e\u6cd5\uff0c\u5982\u679c\u662f 1.2 \u7684\u8a71\u8acb\u7528 schema run create\uff0c\u63a5\u8457\u5728 controller \u88e1\u9762\u52a0\u4e0a <\/p>\n<pre lang=\"php\">var $components = array('Acl');<\/pre>\n<p>\u4e00\u5b9a\u8981\u52a0\uff0c\u4e0d\u7136\u5c31\u6709\u53ef\u80fd\u6703\u5403\u5230\u50cf\u662f\u9019\u6a23\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<br \/>\nError: Missing database table &#8216;aros&#8217; for model &#8216;Aro&#8217;<\/p>\n<p>\u7136\u5f8c\u5c31\u53ef\u4ee5\u52a0 ACO \u8ddf ARO \u4e86\u3002<\/p>\n<pre lang=\"php\">..\/cake\/console\/cake acl create aro 0 Users<\/pre>\n<p>\u5c31\u53ef\u4ee5\u958b\u4e00\u500b\u53eb Users \u7684 ARO\u4e86\uff0cACO \u4e5f\u662f\u4e00\u6a23\u7684\u60c5\u6cc1\u3002<\/p>\n<p>\u518d\u52a0\u4e0a login \u7684\u6a5f\u5236\u5f8c\uff0c\u6574\u500b ACL \u7684\u67b6\u69cb\u61c9\u8a72\u5c31\u7b97\u662f\u5b8c\u6574\u4e86\uff0c\u518d\u4f86\u5c31\u8981\u53bb\u5b9a\u7fa9\u54ea\u4e9b ARO \u53ef\u4ee5\u7528\u54ea\u4e9b ACO \u4e4b\u985e\u7684\uff0c\u628a\u4ed6\u88dc\u9f4a\u5c31\u5dee\u4e0d\u591a\u53ef\u4ee5\u7528\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[\u83ef\u8a9e, cmn-Hant-TW] cakephp \u4e0b\u958b acl \u7684\u7c21\u55ae\u758f\u5931\u5fc3\u5f97\uff0c\u7576\u7136\u8cc7\u6599\u5eab\u9023\u7d50\u4e4b\u985e\u7684\u8a2d\u5b9a\u8981\u5148\u5f04\u597d\uff0c\u7136\u5f8c\u81f3\u5c11\u8981\u6709\u4e00\u500b\u5beb\u597d\u7684 controller \u3002 \u7528 console \u5de5\u5177\u4f86\u5f04\u6703\u6bd4\u8f03\u65b9\u4fbf\uff0c\u9996\u5148\u8981\u5207\u5230 app \u7684\u76ee\u9304\u4e0b ..\/cake\/console\/cake schema create DbAcl \u9019\u662f 1.3 \u7684\u8a9e\u6cd5\uff0c\u5982\u679c\u662f 1.2 \u7684\u8a71\u8acb\u7528 schema run create\uff0c\u63a5\u8457\u5728 controller \u88e1\u9762\u52a0\u4e0a var $components = array(&#8216;Acl&#8217;); \u4e00\u5b9a\u8981\u52a0\uff0c\u4e0d\u7136\u5c31\u6709\u53ef\u80fd\u6703\u5403\u5230\u50cf\u662f\u9019\u6a23\u7684\u932f\u8aa4\u8a0a\u606f\uff1a Error: Missing database table &#8216;aros&#8217; for model &#8216;Aro&#8217;&hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[200],"tags":[4261,4262],"class_list":["post-1017","post","type-post","status-publish","format-standard","hentry","category-development","tag-cakephp","tag-php"],"_links":{"self":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts\/1017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/comments?post=1017"}],"version-history":[{"count":2,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts\/1017\/revisions"}],"predecessor-version":[{"id":1019,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts\/1017\/revisions\/1019"}],"wp:attachment":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/media?parent=1017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/categories?post=1017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/tags?post=1017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}