cakephp acl控制访问插件(FullCalendar)

时间:2014-05-13 19:23:30

标签: cakephp plugins acl

我在蛋糕2.4和FullCalendar插件中使用了acl(跟着cake的教程)。

至于FullCalendar插件permisions不起作用。我目前正在使用控制台创建aros,acos和授予权限。

用户表:

id | username | role_id
-----------------------
12 | company  | 2       
13 | regular  | 3      
14 | admin    | 1      

角色表:

id | role          
--------------------
12 | Administrador 
13 | Company       
14 | Regular       

aro table:

+----+-----------+-------+-------------+-------+------+------+
| id | parent_id | model | foreign_key | alias | lft  | rght |
+----+-----------+-------+-------------+-------+------+------+
|  1 |      NULL | Role  |           1 | NULL  |    1 |    4 |
|  2 |      NULL | Role  |           2 | NULL  |    5 |    8 |
|  3 |      NULL | Role  |           3 | NULL  |    9 |   12 |
|  4 |         1 | User  |          14 | NULL  |    2 |    3 |
|  5 |         2 | User  |          12 | NULL  |    6 |    7 |
|  6 |         3 | User  |          13 | NULL  |   10 |   11 |
+----+-----------+-------+-------------+-------+------+------+

该插件位于此路径中:     饼/应用程序/插件/ FullCalendar

-Controller
    -FullCalendarAppController
    -EventsController
    -FullCalendarController
    -EventTypesController
-Model
    -Event
    -EventType
    -FullCalendar
    -FullCalendarAppModel
-View
    -Events: add, edit, feed, index, view
    -EventTypes: add, edit, index, view
    -FullCalendar: index
    -Layouts 
-webroot

我创建了这个acos:

cake acl create aco controllers FullCalendar
cake acl create aco controllers/FullCalendar index
cake acl create aco controllers Events
cake acl create aco controllers/Events index
cake acl create aco controllers/Events view
cake acl create aco controllers/Events add

我想要这些许可:

Administrador:全部

公司:索引,事件列表视图

/cake/full_calendar/events
/cake/full_calendar/events/view/1

常规:事件列表的索引

/cake/full_calendar/events

而且,我使用这些来授予权限:

cake acl grant Role.1 contollers/Fullcalendar all
cake acl grant Role.2 contollers/Fullcalendar/index all
cake acl grant Role.2 contollers/Fullcalendar/view all
cake acl grant Role.3 contollers/Fullcalendar/index all

这是我得到的错误:

Warning (512): DbAcl::check() - Failed ACO node lookup in permissions check. Node references:
Aro: Array
(
    [User] => Array
        (
            [id] => 14
            [username] => admin
            [role] => admin //this atribute was for testing, but i'm not using it anymore so I guess it doesn't really matters.
            [role_id] => 1
            [Role] => Array
            (
                [id] => 1
                [role] => Administrador
                [alias] => 
            )

    )

)

Aco: controllers/FullCalendar/Events/view [CORE\Cake\Model\Permission.php, line 103]

另外,你是否介意告诉aros_acos'表'_create,_read,_update,_delete'是什么意思?

提前致谢。

0 个答案:

没有答案