public void SetPlayer(TPlayer player) { if (player == null) { return; } Player = player; if (UserAccessList.ContainsKey(player.User.Name)) { AccessLevel = UserAccessList[player.User.Name]; } if (Equipment.Count == 0) { for (int i = 0; i < EquipmentList.Count; i++) { Equipment.Add(0); } } if (Player.User.IsBot) { Ready = true; } Equipment[0] = 1; Equipment[2] = 3; }
private void LoadUserAccessList(WebsiteDBEntities context, LoggedInUser user) { var grantedRoles = context.UserRoles.Where(i => i.UserName == user.UserName); foreach (var role in grantedRoles) { var roleAccess = context.AccessControlLists.FirstOrDefault(i => i.RoleName == role.RoleName); if (roleAccess == null) { continue; } var parentMenu = new UserAccessList { Menu = roleAccess.AccessList.MenuDisplayText, Action = roleAccess.AccessList.RelativeLink, Children = roleAccess.AccessList .AccessList1.Select(i => new UserAccessList { Menu = i.MenuDisplayText, Action = i.RelativeLink, IsAccessed = false, IsActie = i.IsActive }).ToList(), IsAccessed = false }; user.AccessLists.Add(parentMenu); } }
public formUsersAccess() { InitializeComponent(); userAccessList = UserAccessList.getInstance(); }