Пример #1
0
        /// <summary>
        /// Grabs all the roles from the DB
        /// </summary>
        /// <returns>
        /// </returns>
        public override string[] GetAllRoles()
        {
            // get all roles...
            DataTable roles = DB.Current.GetRoles(ConnectionStringName, this.ApplicationName, null);

            // make a string collection to store the role list...
            var roleNames = new StringCollection();

            foreach (DataRow row in roles.Rows)
            {
                roleNames.Add(row["RoleName"].ToStringDBNull());
            }

            return roleNames.ToStringArray(); // return as a string array
        }
Пример #2
0
        /// <summary>
        /// Gets a list of usernames in a a particular role
        /// </summary>
        /// <param name="roleName">
        /// Rolename
        /// </param>
        /// <returns>
        /// List of Usernames
        /// </returns>
        public override string[] GetUsersInRole(string roleName)
        {
            if (roleName.IsNotSet())
            {
                ExceptionReporter.ThrowArgument("ROLES", "ROLENAMEBLANK");
            }

            DataTable users = DB.Current.FindUsersInRole(ConnectionStringName,this.ApplicationName, roleName);

            var userNames = new StringCollection();

            foreach (DataRow dr in users.Rows)
            {
                userNames.Add(dr["Username"].ToStringDBNull());
            }

            return userNames.ToStringArray();
        }
        /// <summary>
        /// Adds a list of users to a list of groups
        /// </summary>
        /// <param name="roleName">
        /// Rolename
        /// </param>
        /// <param name="usernameToMatch">
        /// like Username used in search
        /// </param>
        /// <returns>
        /// List of Usernames
        /// </returns>
        public override string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            if (roleName.IsNotSet())
              {
            ExceptionReporter.ThrowArgument("ROLES", "ROLENAMEBLANK");
              }

              // Roles
              DataTable users = FbDB.Current.FindUsersInRole( this.ApplicationName, roleName);
              var usernames = new StringCollection();
              foreach (DataRow user in users.Rows)
              {
            usernames.Add(user["Username"].ToStringDBNull());
              }

              return usernames.ToStringArray();
        }