1. 教程设置
以下教程旨在帮助插件作者在其插件中添加权限支持。 我们将在示例中添加权限支持todo-list和todo-list-backend插件,但其他插件的操作过程应该类似!
本页的其余部分主要是添加todo-list和todo-list-backend如果您想在自己的插件中添加对权限的支持,请跳转到下一节.
设置教程
我们将使用 "待办事项列表 "功能,该功能由todo-list和todo-list-backend插件及其依赖关系、todo-list-common.
源代码可在此处获取:
- Copy-paste the three folders into the plugins folder of your backstage application repository (removing the
example-prefix from each folder) or run the following script from the root of your backstage application:bash $ cd $(mktemp -d) git clone --depth 1 --quiet --no-checkout --filter=blob:none https://github.com/backstage/backstage.git . git checkout master -- plugins/example-todo-list/ git checkout master -- plugins/example-todo-list-backend/ git checkout master -- plugins/example-todo-list-common/ sed -i '' 's/workspace:\^/\*/g' plugins/example-todo-list/package.json sed -i '' 's/workspace:\^/\*/g' plugins/example-todo-list-backend/package.json sed -i '' 's/workspace:\^/\*/g' plugins/example-todo-list-common/package.json for file in plugins/*; do mv "$file" "$OLDPWD/${file/example-todo/todo}"; done cd -Thepluginsdirectory of your project should now includetodo-list,todo-list-backend, andtodo-list-common.Important: if you are on Windows, make sure you have WSL and git ins
现在,如果您启动应用程序,您应该可以到达/todo-listpage:

整合新插件
如果你玩一下用户界面,就会发现可以执行一些操作:
- 创建新的待办事项 (
POST /todos) * 查看待办事项 (GET /todos) * 编辑现有的待办事项 (PUT /todos)
让我们尝试把授权放在每一个人的头上。