Exemple #1
0
        public bool CreateAndAuthorizeUser(string userName, string password, string rolePath)
        {
            var configurationApiClient = ConfigurationApiClient.CreateClient();
            var newUserPath            = CreateUser(configurationApiClient, userName, password);
            var success = AuthorizeUser(configurationApiClient, newUserPath, rolePath);

            return(success);
        }
Exemple #2
0
        /// <summary>
        /// Queries all the roles in the system using the configuration API
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, string> QueryRoles()
        {
            var configurationApiClient = ConfigurationApiClient.CreateClient();

            // The existing roles are children under of the RoleFolder
            string roleFolderPath  = String.Format("/{0}", ItemTypes.RoleFolder);
            var    roleConfigItems = configurationApiClient.GetChildItems(roleFolderPath);

            var roles = new Dictionary <string, string>();

            foreach (var role in roleConfigItems)
            {
                roles.Add(role.DisplayName, role.Path);
            }

            return(roles);
        }