Esempio n. 1
0
        public void RemoveUserFromRole(string userName, string roleName)
        {
            userName = userName.ToLower();
            Query q = UserRole.CreateQuery();

            q.AndWhere(UserRole.Columns.UserId, (GraffitiUsers.GetUser(userName) as User).Id);
            q.AndWhere(UserRole.Columns.RoleName, roleName);
            UserRoleCollection urCol = new UserRoleCollection();

            urCol.LoadAndCloseReader(q.ExecuteReader());
            if (urCol.Count > 0)
            {
                UserRole.Destroy(urCol[0].Id);
            }
        }