[]
        
(Showing Draft Content)

支持单元格权限

可以通过实现 ISupportUIPermission 接口支持单元格权限,支持单元格的可编辑权限需要和 ISupportReadOnly 接口配合, 支持单元格的禁用权限需要和 ISupportDisable 配合。

C#示例代码如下:

public class MyPluginCellType : CellType, ISupportDisable, ISupportReadOnly, ISupportUIPermission
    {
        [DisplayName("只读")]
        public bool ReadOnly { get; set; }

        [DisplayName("禁用")]
        public bool IsDisabled { get; set; }

        [DisplayName("单元格权限")]
        public List<UIPermission> UIPermissions { get; set; } = GetDefaultPermission();

        public static List<UIPermission> GetDefaultPermission()
        {
            var defaultAllowRoles = new List<string>() { "FGC_Anonymous" };
            return new List<UIPermission>
            {
                new UIPermission(){ Scope = UIPermissionScope.Enable, AllowRoles = defaultAllowRoles },
                new UIPermission(){ Scope = UIPermissionScope.Editable, AllowRoles = defaultAllowRoles },
                new UIPermission(){ Scope = UIPermissionScope.Visible, AllowRoles = defaultAllowRoles },
            };
        }
    }

JavaScript 代码可分别参考 [支持只读](第五十四章 活字格插件开发/开发插件/开发单元格插件/开发表单类单元格/支持只读) 和 支持禁用 章节。