예제 #1
0
        public void ACLs_Scenario_Add_Named_User()
        {
            this.Initialize();
            var dir = create_test_dir();

            var fname = dir.Append(nameof(ACLs_Scenario_Add_Named_User) + ".txt");

            if (this.StoreClient.FileSystem.PathExists(fname))
            {
                this.StoreClient.FileSystem.Delete(fname);
            }

            var cfo = new FileCreateParameters();

            cfo.Overwrite = true;
            this.StoreClient.FileSystem.Create(fname, "HelloWorld", cfo);


            var u = this.StoreClient.RestClients.AADclient.Users.Get("*****@*****.**");


            var permissions_before = this.StoreClient.FileSystem.GetAclStatus(fname);
            var acl_entry          = new FsAclEntry(FsAclType.NamedUser, u.ObjectId, FsPermission.All);

            this.StoreClient.FileSystem.ModifyAclEntries(fname, acl_entry);

            var permissions_after = this.StoreClient.FileSystem.GetAclStatus(fname);

            var new_entries = permissions_after.Entries.Where(e => e.Type == FsAclType.NamedUser).ToList();
            int count       = new_entries.Where(i => i.Name == u.ObjectId).Count();

            Assert.AreEqual(1, count);
        }
예제 #2
0
        public void ACLs_Scenario()
        {
            this.Initialize();
            var dir = create_test_dir();

            var fname = dir.Append("foo.txt");

            if (this.StoreClient.FileSystem.PathExists(fname))
            {
                this.StoreClient.FileSystem.Delete(fname);
            }

            var cfo = new FileCreateParameters();

            cfo.Overwrite = true;
            this.StoreClient.FileSystem.Create(fname, "HelloWorld", cfo);

            var permissions_before = this.StoreClient.FileSystem.GetAclStatus(fname);

            Assert.AreEqual(true, permissions_before.OwnerPermission.Value.Read);
            Assert.AreEqual(true, permissions_before.OwnerPermission.Value.Write);
            Assert.AreEqual(true, permissions_before.OwnerPermission.Value.Execute);

            Assert.AreEqual(true, permissions_before.GroupPermission.Value.Read);
            Assert.AreEqual(true, permissions_before.GroupPermission.Value.Write);
            Assert.AreEqual(true, permissions_before.GroupPermission.Value.Execute);

            Assert.AreEqual(false, permissions_before.OtherPermission.Value.Read);
            Assert.AreEqual(false, permissions_before.OtherPermission.Value.Write);
            Assert.AreEqual(false, permissions_before.OtherPermission.Value.Execute);

            var modified_entry = new FsAclEntry(FsAclType.Other, null, new FsPermission("r-x"));

            this.StoreClient.FileSystem.ModifyAclEntries(fname, modified_entry);

            var permissions_after = this.StoreClient.FileSystem.GetAclStatus(fname);

            Assert.AreEqual(true, permissions_after.OwnerPermission.Value.Read);
            Assert.AreEqual(true, permissions_after.OwnerPermission.Value.Write);
            Assert.AreEqual(true, permissions_after.OwnerPermission.Value.Execute);

            Assert.AreEqual(true, permissions_after.GroupPermission.Value.Read);
            Assert.AreEqual(true, permissions_after.GroupPermission.Value.Write);
            Assert.AreEqual(true, permissions_after.GroupPermission.Value.Execute);

            Assert.AreEqual(true, permissions_after.OtherPermission.Value.Read);
            Assert.AreEqual(false, permissions_after.OtherPermission.Value.Write);
            Assert.AreEqual(true, permissions_after.OtherPermission.Value.Execute);
        }
예제 #3
0
        public void RemoveAclEntries(FsPath path, IEnumerable <FsAclEntry> entries)
        {
            foreach (var entry in entries)
            {
                if (entry.Permission.HasValue)
                {
                    var perm = entry.Permission.Value;

                    if (perm.Integer > 0)
                    {
                        throw new System.ArgumentOutOfRangeException("For RemoveAclEntries the RWX must be empty");
                    }
                }
            }
            var s = FsAclEntry.EntriesToString(entries);

            s = s.Replace("---", ""); // NOTE: RemoveAclEntries doesn't support --- only empty
            this.RestClients.FileSystemClient.FileSystem.RemoveAclEntries(this.Account.Name, path.ToString(), s);
        }
예제 #4
0
        public void SetAcl(StoreAccount store, FsPath path, IEnumerable <FsAclEntry> entries)
        {
            var s = FsAclEntry.EntriesToString(entries);

            this.RestClient.FileSystem.SetAcl(store.Name, path.ToString(), s);
        }
예제 #5
0
 public void ModifyAclEntries(StoreAccount store, FsPath path, FsAclEntry entry)
 {
     this.RestClient.FileSystem.ModifyAclEntries(store.Name, path.ToString(), entry.ToString());
 }
        public void SetAcl(AdlClient.Models.StoreAccountRef account, FsPath path, IEnumerable <FsAclEntry> entries)
        {
            var s = FsAclEntry.EntriesToString(entries);

            this.RestClient.FileSystem.SetAcl(account.Name, path.ToString(), s);
        }
 public void ModifyAclEntries(AdlClient.Models.StoreAccountRef account, FsPath path, FsAclEntry entry)
 {
     this.RestClient.FileSystem.ModifyAclEntries(account.Name, path.ToString(), entry.ToString());
 }
예제 #8
0
 public void ModifyAclEntries(FsPath path, FsAclEntry entry)
 {
     this.RestClients.FileSystemRest.ModifyAclEntries(this.GetUri(path), entry);
 }
예제 #9
0
        public void ModifyAclEntries(FsPath path, IEnumerable <FsAclEntry> entries)
        {
            var s = FsAclEntry.EntriesToString(entries);

            this.RestClients.FileSystemClient.FileSystem.ModifyAclEntries(this.Account.Name, path.ToString(), s);
        }
예제 #10
0
 public void ModifyAclEntries(FsPath path, FsAclEntry entry)
 {
     this.RestClients.FileSystemClient.FileSystem.ModifyAclEntries(this.Account.Name, path.ToString(), entry.ToString());
 }
예제 #11
0
        public void SetAcl(FsUri uri, IEnumerable <FsAclEntry> entries)
        {
            var s = FsAclEntry.EntriesToString(entries);

            this.RestClient.FileSystem.SetAcl(uri.Account, uri.Path, s);
        }
예제 #12
0
 public void ModifyAclEntries(FsUri uri, FsAclEntry entry)
 {
     this.RestClient.FileSystem.ModifyAclEntries(uri.Account, uri.Path, entry.ToString());
 }
예제 #13
0
 public void ModifyAclEntries(FsPath path, FsAclEntry entry)
 {
     this.RestClients.FileSystemRest.ModifyAclEntries(this.Account, path, entry);
 }