基础访问控制与命名空间路由的实现
1. 限制项目操作访问权限
当运行 rake cucumber:ok 时,所有测试用例再次通过,此时表明访问操作已被成功限制。为了记录这一阶段的工作,我们进行一次提交:
git add .
git commit -m "Restrict access to project actions to admins only"
git push
此外,为了提升用户体验,对于非管理员用户,我们应该隐藏那些他们无法执行的操作链接。
2. 隐藏新建项目链接
为了实现隐藏特定链接(如新建项目链接)的功能,我们需要编写一个新的特性文件 features/hidden_links.feature ,内容如下:
Feature: Hidden Links
In order to clean up the user experience
As the system
I want to hide links from users who can't act on them
Background:
Given there are the following users:
| email | password | admin |
| user@ticketee.com | password | false |
| admin@ticketee.com | password | true
超级会员免费看
订阅专栏 解锁全文
171万+

被折叠的 条评论
为什么被折叠?



