Ejemplo n.º 1
0
        /// <summary>
        /// Shortcut method for test. Example usage: aclEd.Allow("E2", "U1", false, "___________+___");
        /// Bitmask accepts two kind of characters: '_' means active, any other means inactive.
        /// </summary>
        /// <returns></returns>
        public static AclEditor Allow(this AclEditor aclEd, string entity, string identity, string bitMask, bool localOnly = false)
        {
            var perms = GetPermissionTypes(bitMask);

            aclEd.Allow(Tools.GetId(entity), Tools.GetId(identity), localOnly, perms);
            return(aclEd);
        }
Ejemplo n.º 2
0
        private static void SetPermission(AclEditor editor, int contentId, int identityId, bool localOnly,
                                          PermissionType permissionType, object permissionValue, List <string> messages)
        {
            switch (permissionValue.ToString().ToLowerInvariant())
            {
            case "0":
            case "u":
            case "undefined":
                // PermissionValue.Undefined;
                editor.ClearPermission(contentId, identityId, localOnly, permissionType);
                break;

            case "1":
            case "a":
            case "allow":
                // PermissionValue.Allowed;
                editor.Allow(contentId, identityId, localOnly, permissionType);
                break;

            case "2":
            case "d":
            case "deny":
                // PermissionValue.Denied;
                editor.Deny(contentId, identityId, localOnly, permissionType);
                break;

            default:
                messages.Add($"WARING: Unknown permissionValue: {permissionValue}");
                break;
            }
        }