各位大家好。
我们有一个dynamics系统,已经有一个商品实体。
现在客户增加了一个需求。
商品增加一个字段商品等级(普通,高级),以前的商品是普通,最近新录入的是高级商品。
而部门经理是可以读取,修改所有的商品记录。
销售专员只能查看普通的商品。
怎么实现啊?
已知有一个部门经理的安全角色
还有一个销售专员的安全角色。
dynamics如何实现对一个实体中特定的记录的权限访问
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- 港湾泊 2024-01-24 17:48关注
用C#实现这个实体类吗
public class Product { public string ProductLevel { get; set; } // Other product properties // Constructor, etc. } public class PermissionService { public bool CheckPermission(string userRole, Product productRecord) { if (userRole == "DepartmentManager") { return true; // Department manager has all permissions } else if (userRole == "SalesSpecialist") { return productRecord.ProductLevel == "Normal"; // Sales specialist can only view normal products } else { return false; // Other roles have no permissions } } } class Program { static void Main() { // Simulate getting current user role and product record string currentUserRole = GetCurrentUserRole(); Product productRecord = GetProductRecord(); // Create an instance of the permission service PermissionService permissionService = new PermissionService(); // Check permission if (permissionService.CheckPermission(currentUserRole, productRecord)) { // Allow execution of related operations, e.g., read or modify product record Console.WriteLine("Allow execution of related operations"); } else { // Do not allow execution of related operations, may need to return an error or display no permission message Console.WriteLine("No permission to execute related operations"); } } static string GetCurrentUserRole() { // Simulate logic to get the current user role return "SalesSpecialist"; } static Product GetProductRecord() { // Simulate logic to get the product record return new Product { ProductLevel = "Normal" }; } }
解决评论 打赏 举报 编辑记录无用 1
悬赏问题
- ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
- ¥15 Vue3地图和异步函数使用
- ¥15 C++ yoloV5改写遇到的问题
- ¥20 win11修改中文用户名路径
- ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
- ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
- ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
- ¥15 帮我写一个c++工程
- ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
- ¥15 关于smbclient 库的使用