Exemplo n.º 1
0
        public static string AclTypeToString(FsAclType type)
        {
            string aclType = "ERROR";

            if (type == FsAclType.Mask)
            {
                aclType = "mask";
            }
            else if (type == FsAclType.NamedGroup)
            {
                aclType = "group";
            }
            else if (type == FsAclType.NamedUser)
            {
                aclType = "user";
            }
            else if (type == FsAclType.Other)
            {
                aclType = "other";
            }
            else if (type == FsAclType.OwningGroup)
            {
                aclType = "group";
            }
            else if (type == FsAclType.OwningUser)
            {
                aclType = "user";
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }
            return(aclType);
        }
Exemplo n.º 2
0
        public FsAclEntry(FsAclType type, string name, FsPermission permission)
        {
            this.Type = type;

            if (name == null)
            {
                name = "";
            }
            this.Name       = name;
            this.Permission = permission;
        }
Exemplo n.º 3
0
        public FsAclEntry(string entry)
        {
            var tokens = entry.Split(':');

            string type_str = tokens[0].ToLowerInvariant();
            string user     = tokens[1];

            if ((type_str == "user") && (user.Length == 0))
            {
                this.Type = FsAclType.OwningUser;
            }
            else if ((type_str == "user") && (user.Length > 0))
            {
                this.Type = FsAclType.NamedUser;
            }
            else if ((type_str == "group") && (user.Length == 0))
            {
                this.Type = FsAclType.OwningGroup;
            }
            else if ((type_str == "group") && (user.Length > 0))
            {
                this.Type = FsAclType.NamedGroup;
            }
            else if (type_str == "mask")
            {
                this.Type = FsAclType.Mask;
            }
            else if (type_str == "other")
            {
                this.Type = FsAclType.Other;
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }

            this.Name       = user;
            this.Permission = new FsPermission(tokens[2]);
        }