private async Task SetAccessControlAsync()
        {
            _accessControl.Acl.Clear();
            _accessControl.DefaultAcl.Clear();

            foreach (var acl in _expectedAcls)
            {
                _accessControl.Acl.Add(acl);
            }

            foreach (var acl in _expectedDefaultAcls)
            {
                _accessControl.DefaultAcl.Add(acl);
            }

            await _storage.SetAccessControlAsync(_directory.Path, _accessControl, _cancellationToken);
        }
        public async Task SetAccessControlAsync(string fullPath, AccessControl accessControl,
                                                CancellationToken cancellationToken = default)
        {
            for (var i = 1; i <= Retries; i++)
            {
                try
                {
                    await _storage.SetAccessControlAsync(fullPath, accessControl);

                    break;
                }
                catch (Exception e)
                {
                    if (i == Retries)
                    {
                        throw new ApplicationException($"Maximum {Retries} retries exceeded for request.", e);
                    }

                    await Task.Delay(Delay *i);
                }
            }
        }
Пример #3
0
        public async Task ProcessAsync()
        {
            var accessControl = await _storage.GetAccessControlAsync(_blob.FullPath, _upn, _cancellationToken);

            accessControl.Acl.Clear();

            foreach (var acl in _acls)
            {
                accessControl.Acl.Add(acl);
            }

            if (_blob.IsFolder)
            {
                accessControl.DefaultAcl.Clear();

                foreach (var acl in _defaultAcls)
                {
                    accessControl.DefaultAcl.Add(acl);
                }
            }

            await _storage.SetAccessControlAsync(_blob.FullPath, accessControl, _cancellationToken);
        }