private void UpdateUserRoles() { UpdateProgress(0, "Adding adninistrator/moderators to role table<br/>"); string[] admins = Moderators.GetForumAdmins(); var mods = Moderators.GetAll(); SnitzRoleProvider roles = new SnitzRoleProvider(); roles.AddUsersToRoles(admins, new string[] { "Administrator" }); roles.AddUsersToRoles(mods.Select(m => m.Name).ToArray(), new string[] { "Moderator" }); UpdateProgress(0, "UserRoles Table Updated</br>"); Thread.Sleep(500); }
protected void NewUsername_Click(object sender, EventArgs e) { string[] roles = new string[1]; string[] users = new string[1]; SnitzRoleProvider srp = new SnitzRoleProvider(); roles[0] = txtName.Text; users[0] = NewUserForRole.Text; srp.AddUsersToRoles(users, roles); RefreshUserList(); }
private void UpdateForumAllowedRoles() { //1, 6 '## Allowed Users //2 '## password //3 '## Either Password or Allowed //7 '## members or password //4, 5 '## members only UpdateProgress(0, "Updating allowed forum lists<br/>"); Thread.Sleep(500); SnitzRoleProvider roles = new SnitzRoleProvider(); var privateforums = Snitz.BLL.Admin.PrivateForums(); int newroleid = 500; foreach (ForumInfo forum in privateforums) { int forumid = forum.Id; string description = forum.Subject; switch (forum.PrivateForum) { case 4: //## members case 5: case 7: RoleInfo rInfo = SnitzMembership.Helpers.BusinessUtil.GetRoleFull(1); string role = rInfo.RoleName.ToLower(); SnitzMembership.Helpers.BusinessUtil.AddRolesToForum(forumid, new[] { role }); break; case 1: //## Allowed Users case 3: case 6: //create a Role for this forum string rolename = "Forum_" + forumid; roles.CreateRoleFullInfo(rolename, description, newroleid); SnitzMembership.Helpers.BusinessUtil.AddRolesToForum(forumid, new[] { rolename }); //get the allowed members for this forum and add to the new role string[] allowedmembers = Snitz.BLL.Admin.AllowedMembers(forumid); roles.AddUsersToRoles(allowedmembers, new[] { rolename }); newroleid++; break; } } UpdateProgress(0, "ForumAllowedRoles Updated</br>"); Thread.Sleep(500); }