[英]In EWL, what's the best practice for parent-page/breadcrumbs on an entity accessible by multiple roles?
Let's say I have a screen that lets the user edit a person's general information, and this screen can be access by either the person themselves or by administrators. 假设我有一个屏幕,用户可以通过该屏幕编辑人员的一般信息,该人员自己或管理员都可以访问此屏幕。 The administrators will be coming from a parent list of people, and ideally that would be defined as the parent for this entity.
管理员将来自上级人员列表,理想情况下,将其定义为该实体的上级人员。 The person, though, has no access above this level.
但是,此人无法访问此级别以上的权限。
I usually return null unconditionally in these situations, and provide nav links for admins to get back up, if necessary. 在这种情况下,我通常无条件返回null,并在必要时为管理员提供导航链接。 I'm also considering having the parent be conditional, and return the parent list only if the user is an admin.
我还考虑让父对象成为条件对象,并且仅当用户是管理员时才返回父列表。 What's the best practice here?
这里的最佳做法是什么?
partial class Info {
protected override PageInfo createParentPageInfo() {
var conditionalParent = MyParentPage.GetInfo();
return conditionalParent.UserCanAccessPageAndAllControls ? conditionalParent : null;
}
protected override ConnectionSecurity ConnectionSecurity { get { return ConnectionSecurity.SecureIfPossible; } }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.