hook_menu_alter ，但意识到视图使用相同的钩子来添加它定义的菜单项 - 结果，我无法访问它们。
How can I change the access callback for a page view (Views module)? I tried
hook_menu_alter but realized that views uses the same hook to add the menu items defined by it - as a result of which, I am unable to have access to them.
Any way out?
Views allows you to set the acess within the UI, you can restrict based on roles or permission.
Usually that should be enought but if you need to set a custom access callback you can use hook_menu_alter but you will also need to make sure your module is called after the views hook_menu_alter, you can change the weight of your module in the database or you can use hook_module_implements_alter to make sure your module is called after the views module for the menu alter hook.
Try the Views Access Callback module.
Provides callback-based access control for Views.
Available callback functions are defined by modules using
hook_views_access_callbacks()function (in the same way as in
hook_perm()), then could be set in the view's "Access restrictions" configuration.
I can't directly answer that question, but you do have two options.
You can make a custom block and embed the view in it, and then hook_menu it into the system with access control.
The other option is to use a panel page, and add the view to a pane. You can then control access via the panels interface.