Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【文档】如何配置字段权限实现某个字段新建记录时可以修改,编辑记录时不可以修改 #36

Open
yinlianghui opened this issue Dec 11, 2023 · 0 comments

Comments

@yinlianghui
Copy link
Contributor

yinlianghui commented Dec 11, 2023

字段权限配置中无法区别新建和编辑记录,此需要只能通过配置字段上的amis.disabledOn公式来实现。

单纯的新建可修改编辑不可修改

name: code
label: Code
type: text
amis:
  "disabledOn": "${recordId}"

需要区分简档和权限集

name: code
label: Code
type: text
amis:
  # "disabledOn": "${recordId && !global.user.is_space_admin}" #工作区管理员编辑记录时可以修改,其他人都不能修改
  # "disabledOn": "${recordId && ARRAYINCLUDES(global.user.roles, 'admin')}" #工作区管理员编辑记录时不可以修改,其他人都可以修改
  "disabledOn": "${recordId && (ARRAYINCLUDES(global.user.roles, 'admin') || ARRAYINCLUDES(global.user.roles, 'user'))}" #工作区管理员和普通用户编辑记录时不可以修改,其他人都可以修改

amis公式请参考文档:
https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/expression
https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/data-mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant