Beispiel #1
0
        public static async Task Update()
        {
            // Arrange
            var group       = new Response.ApplicationGroup();
            var permission  = new Response.Permission();
            var permissions = new Response.PermissionsSetId {
                Permissions = new[] { permission, }
            };

            var mock = Substitute.For <IFor>();

            mock
            .IdentitiesAsync()
            .Returns(new Response.ApplicationGroups {
                Identities = new[] { group }
            });
            mock
            .PermissionSetAsync(group)
            .Returns(permissions);

            // Act
            var target = new ManagePermissions(mock);
            await target.SetToAsync(4);

            // Assert
            await mock
            .Received()
            .UpdateAsync(group, permissions, permission);

            permission
            .PermissionId
            .ShouldBe(4);
        }
 public async Task <Response.PermissionsSetId> PermissionSetAsync(Response.ApplicationGroup identity)
 {
     if (identity == null)
     {
         throw new ArgumentNullException(nameof(identity));
     }
     return((await _client.GetAsync(Requests.Permissions.PermissionsGroupProjectId(_projectId, identity.TeamFoundationId)).ConfigureAwait(false)).Security);
 }
        public Task <Response.PermissionsSetId> PermissionSetAsync(Response.ApplicationGroup identity)
        {
            if (identity == null)
            {
                throw new ArgumentNullException(nameof(identity));
            }

            return(_client.GetAsync(Requests.Permissions.PermissionsGroupRepository(_projectId, SecurityNamespaceIds.GitRepositories, identity.TeamFoundationId, _itemId)));
        }
Beispiel #4
0
        public Task <Response.PermissionsSetId> PermissionSetAsync(Response.ApplicationGroup identity)
        {
            if (identity == null)
            {
                throw new ArgumentNullException(nameof(identity));
            }

            return(_client.GetAsync(Requests.Permissions.PermissionsGroupSetIdDefinition(
                                        _projectId, _namespaceId, identity.TeamFoundationId, ExtractToken())));
        }
Beispiel #5
0
        public Task UpdateAsync(Response.ApplicationGroup identity,
                                Response.PermissionsSetId permissionSet, Response.Permission permission)
        {
            if (identity == null)
            {
                throw new ArgumentNullException(nameof(identity));
            }

            return(_client.PostAsync(Requests.Permissions.ManagePermissions(_projectId),
                                     new ManagePermissionsData(identity.TeamFoundationId, permissionSet.DescriptorIdentifier,
                                                               permissionSet.DescriptorIdentityType, permission.PermissionToken, permission).Wrap()));
        }