Пример #1
0
        public async Task Create()
        {
            var groupShareClient = await Helper.GetAuthenticatedClient();
            var uniqueId = Guid.NewGuid();

            var newUser = new CreateUserRequest
            {
                UniqueId = uniqueId,
                Name = "testUser",
                Password = "******",
                DisplayName = "test",
                Description = null,
                PhoneNumber = null,
                Locale = "en-US",
                OrganizationId = new Guid("c03a0a9e-a841-47ba-9f31-f5963e71bbb7"),
                UserType = "SDLUser",
                Roles = new List<Role>
                {
                    new Role
                    {
                         OrganizationId = new Guid("c03a0a9e-a841-47ba-9f31-f5963e71bbb7"),
                          RoleId = new Guid("0340ad05-63d2-4db6-8bbd-696fac125a19"),//power user
                           UserId = uniqueId
                    }
                }
            };

            var userId = await groupShareClient.User.Create(newUser);

            Assert.True(userId != null);

            await groupShareClient.User.Delete(userId);
        }
Пример #2
0
        /// <summary>
        /// Create <see cref="User"/>.
        /// </summary>
        /// /// <remarks>
        /// This method requires authentication.
        /// See the <a href="http://gs2017dev.sdl.com:41234/documentation/api/index#/">API documentation</a> for more information.
        /// </remarks>
        /// <exception cref="AuthorizationException">
        /// Thrown when the current user does not have permission to make the request.
        /// </exception>
        /// <param name="user"><see cref="CreateUserRequest"/></param>
        /// <returns>Created user Id</returns>
        public async Task <string> Create(CreateUserRequest user)
        {
            Ensure.ArgumentNotNull(user, "user");

            return(await ApiConnection.Post <string>(ApiUrls.User(), user, "application/json"));
        }