예제 #1
0
        public override string[] GetUsersInRole(string roleName)
        {
            var r  = DbEntryRole.FindOne(CK.K["Name"] == roleName);
            var ls = new List <string>();

            foreach (DbEntryMembershipUser u in r.Users)
            {
                ls.Add(u.UserName);
            }
            return(ls.ToArray());
        }
예제 #2
0
        public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            var r = DbEntryRole.FindOne(CK.K["Name"] == roleName);

            if (r != null)
            {
                if (throwOnPopulatedRole && r.Users.Count > 0)
                {
                    throw new DataException("This role has members.");
                }
                r.Delete();
                return(true);
            }
            return(false);
        }
예제 #3
0
        public override string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            var r = DbEntryRole.FindOne(CK.K["Name"] == roleName);

            if (r != null)
            {
                var ls = new List <string>();
                foreach (DbEntryMembershipUser u in r.Users)
                {
                    if (u.UserName.IndexOf(usernameToMatch) >= 0)
                    {
                        ls.Add(u.UserName);
                    }
                }
                return(ls.ToArray());
            }
            return(null);
        }
예제 #4
0
        public override bool RoleExists(string roleName)
        {
            var r = DbEntryRole.FindOne(CK.K["Name"] == roleName);

            return(r != null);
        }