首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

关于zend_acl,该如何解决

2012-04-14 
关于zend_acl用zend_acl ,把$acl最后生成的放到一个文件里,现在我把它反序列取出来,成为一个数组。但是我要

关于zend_acl
用zend_acl ,把$acl最后生成的放到一个文件里,现在我把它反序列取出来,成为一个数组。但是我要取出单独一个角色和资源来判断非常麻烦,不知道大牛们是怎么做的,愿听指教。

PHP code
Zend_Acl Object(    [_roleRegistry:protected] => Zend_Acl_Role_Registry Object        (            [_roles:protected] => Array                (                    [guest] => Array                        (                            [instance] => Zend_Acl_Role Object                                (                                    [_roleId:protected] => guest                                )                            [parents] => Array                                (                                )                            [children] => Array                                (                                    [member] => Zend_Acl_Role Object                                        (                                            [_roleId:protected] => member                                        )                                )                        )                    [member] => Array                        (                            [instance] => Zend_Acl_Role Object                                (                                    [_roleId:protected] => member                                )                            [parents] => Array                                (                                    [guest] => Zend_Acl_Role Object                                        (                                            [_roleId:protected] => guest                                        )                                )                            [children] => Array                                (                                )                        )                    [admin] => Array                        (                            [instance] => Zend_Acl_Role Object                                (                                    [_roleId:protected] => admin                                )                            [parents] => Array                                (                                )                            [children] => Array                                (                                )                        )                )        )    [_resources:protected] => Array        (            [entertain] => Array                (                    [instance] => Zend_Acl_Resource Object                        (                            [_resourceId:protected] => entertain                        )                    [parent] =>                     [children] => Array                        (                        )                )            [sports] => Array                (                    [instance] => Zend_Acl_Resource Object                        (                            [_resourceId:protected] => sports                        )                    [parent] =>                     [children] => Array                        (                        )                )            [news] => Array                (                    [instance] => Zend_Acl_Resource Object                        (                            [_resourceId:protected] => news                        )                    [parent] =>                     [children] => Array                        (                        )                )        )    [_isAllowedRole:protected] =>     [_isAllowedResource:protected] =>     [_isAllowedPrivilege:protected] =>     [_rules:protected] => Array        (            [allResources] => Array                (                    [allRoles] => Array                        (                            [allPrivileges] => Array                                (                                    [type] => TYPE_DENY                                    [assert] =>                                 )                            [byPrivilegeId] => Array                                (                                )                        )                    [byRoleId] => Array                        (                        )                )            [byResourceId] => Array                (                    [entertain] => Array                        (                            [byRoleId] => Array                                (                                    [guest] => Array                                        (                                            [byPrivilegeId] => Array                                                (                                                    [watch] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                )                                            [allPrivileges] => Array                                                (                                                    [type] =>                                                     [assert] =>                                                 )                                        )                                    [member] => Array                                        (                                            [byPrivilegeId] => Array                                                (                                                    [watch] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                    [edit] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                    [add] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                )                                            [allPrivileges] => Array                                                (                                                    [type] =>                                                     [assert] =>                                                 )                                        )                                    [admin] => Array                                        (                                            [byPrivilegeId] => Array                                                (                                                    [watch] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                    [edit] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                    [add] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                    [delete] => Array                                                        (                                                            [type] => TYPE_ALLOW                                                            [assert] =>                                                         )                                                )                                            [allPrivileges] => Array                                                (                                                    [type] =>                                                     [assert] =>                                                 )                                        )                                )                        )………………) 



[解决办法]
不知你要干什么

大多数属性的是保护(protected)方式的
你应该反序列化到对象,然后用对象的方法去访问
[解决办法]
放到数据库里面吧。


其实zend 的acl,我现在是不敢用啦。
。以前的系统用过,效率太低了,也可能是我码的能力不行吧,反正最后换掉了。
用传统的role user priv解决的。

热点排行