private void apPrivs_AccountPrivilegesChanged(AccountPrivilege item) { if (item.Privileges.CanLogin == false) { this.ForcefullyDisconnectAccount(item.Owner.Name); } }
public void Initialize(PRoConApplication praApplication, PRoConClient prcClient) { this._application = praApplication; foreach (Account accAccount in this._application.AccountsList) { if (this.AccountPrivileges.Contains(accAccount.Name) == false) { AccountPrivilege apPrivs = new AccountPrivilege(accAccount, new CPrivileges()); apPrivs.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(apPrivs_AccountPrivilegesChanged); this.AccountPrivileges.Add(apPrivs); } else { this.AccountPrivileges[accAccount.Name].AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(apPrivs_AccountPrivilegesChanged); } } this._application.AccountsList.AccountAdded += new AccountDictionary.AccountAlteredHandler(AccountsList_AccountAdded); this._application.AccountsList.AccountRemoved += new AccountDictionary.AccountAlteredHandler(AccountsList_AccountRemoved); this._client = prcClient; this._client.SocketException += new PRoConClient.SocketExceptionHandler(m_prcClient_SocketException); this._client.ConnectionFailure += new PRoConClient.FailureHandler(m_prcClient_ConnectionFailure); this._client.ConnectionClosed += new PRoConClient.EmptyParamterHandler(m_prcClient_ConnectionClosed); this._client.Game.Login += new FrostbiteClient.EmptyParamterHandler(m_prcClient_CommandLogin); this.ClientConnected += PRoConLayer_ClientConnected; if (this.IsEnabled == true && this.IsOnline == false) { this.Start(); } }
public void Initialize(PRoConApplication praApplication, PRoConClient prcClient) { this.m_praApplication = praApplication; foreach (Account accAccount in this.m_praApplication.AccountsList) { if (this.AccountPrivileges.Contains(accAccount.Name) == false) { AccountPrivilege apPrivs = new AccountPrivilege(accAccount, new CPrivileges()); apPrivs.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(apPrivs_AccountPrivilegesChanged); this.AccountPrivileges.Add(apPrivs); } else { this.AccountPrivileges[accAccount.Name].AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(apPrivs_AccountPrivilegesChanged); } } this.m_praApplication.AccountsList.AccountAdded += new AccountDictionary.AccountAlteredHandler(AccountsList_AccountAdded); this.m_praApplication.AccountsList.AccountRemoved += new AccountDictionary.AccountAlteredHandler(AccountsList_AccountRemoved); this.m_prcClient = prcClient; this.m_prcClient.SocketException += new PRoConClient.SocketExceptionHandler(m_prcClient_SocketException); this.m_prcClient.ConnectionFailure += new PRoConClient.FailureHandler(m_prcClient_ConnectionFailure); this.m_prcClient.ConnectionClosed += new PRoConClient.EmptyParamterHandler(m_prcClient_ConnectionClosed); this.m_prcClient.Game.Login += new FrostbiteClient.EmptyParamterHandler(m_prcClient_CommandLogin); this.ClientConnected += new LayerAccountHandler(PRoConLayer_ClientConnected); if (this.LayerEnabled == true && this.IsLayerOnline == false) { this.StartLayerListener(); } }
private void AccountsList_AccountAdded(Account item) { AccountPrivilege apPrivs = new AccountPrivilege(item, new CPrivileges()); this.AccountPrivileges.Add(apPrivs); item.AccountPasswordChanged += new Account.AccountPasswordChangedHandler(item_AccountPasswordChanged); apPrivs.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(apPrivs_AccountPrivilegesChanged); }
void uscAccountsPanel_AccountPrivilegesChanged(AccountPrivilege item) { if (this.lsvLayerAccounts.Items.ContainsKey(item.Owner.Name) == true) { ListViewItem lviAccount = this.lsvLayerAccounts.Items[item.Owner.Name]; lviAccount.SubItems["rconaccess"].Tag = item.Privileges; this.RefreshLayerPrivilegesPanel(); } }
/// <summary> /// Creates a new instance of an AccountRole object, and initializes with the specified arguments. /// </summary> /// <param name="account"></param> /// <param name="name"></param> /// <param name="privileges"></param> public AccountRole(Account account, string name, AccountPrivilege privileges) { if (String.IsNullOrWhiteSpace(name)) { throw new ArgumentException($"Argument '{nameof(name)}' is required and cannot be nullable or empty."); } this.AccountId = account?.Id ?? throw new ArgumentNullException(nameof(account)); this.Account = account; this.Name = name; this.Privileges = privileges; }
public IReadOnlyCollection <FunctionState> UserOperationsOnObject(IAcSession subject, IAcSession targetSession, IManagedObject obj) { AccountPrivilege accountPrivilege = targetSession.AccountPrivilege; var functions = new HashSet <FunctionState>(); foreach (var f in accountPrivilege.AuthorizedFunctions) { functions.Add(f); } // TODO:执行实体级策略筛选返回的功能列表 return(functions.ToList()); }
void item_AccountPrivilegesChanged(AccountPrivilege item) { this.InvokeOnAllLoaded("OnAccountPrivilegesUpdate", item.Owner.Name, item.Privileges); }
private void AccountPrivileges_AccountPrivilegeAdded(AccountPrivilege item) { item.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(item_AccountPrivilegesChanged); this.InvokeOnAllLoaded("OnAccountCreated", item.Owner.Name); }
private void AccountPrivileges_AccountPrivilegeRemoved(AccountPrivilege item) { this.InvokeOnAllLoaded("OnAccountDeleted", item.Owner.Name); item.AccountPrivilegesChanged -= new AccountPrivilege.AccountPrivilegesChangedHandler(item_AccountPrivilegesChanged); }
public IReadOnlyCollection <FunctionState> UserPermissions(IAcSession subject, IAcSession targetSession) { AccountPrivilege accountPrivilege = targetSession.AccountPrivilege; return(accountPrivilege.AuthorizedFunctions); }
private void item_AccountPrivilegesChanged(AccountPrivilege item) { this.SaveConnectionConfig(); }
public IReadOnlyCollection <RoleState> AuthorizedRoles(IAcSession subject, IAcSession targetSession) { AccountPrivilege accountPrivilege = targetSession.AccountPrivilege; return(accountPrivilege.AuthorizedRoles); }
public UserAccount(int id, string name, string pass, string mail, bool banned, AccountPrivilege accPrivileges, DateTime lastLogin, int lastUniverse) { UID = id; Name = name; PasswordHash = pass; EMail = mail; Banned = banned; Level = accPrivileges == AccountPrivilege.Error ? AccountPrivilege.Player : accPrivileges; LastLogin = lastLogin; LastUniverse = lastUniverse; }
private void CPRoConLayerClient_AccountPrivilegesChanged(AccountPrivilege item) { CPrivileges cpPrivs = new CPrivileges(item.Privileges.PrivilegesFlags); cpPrivs.SetLowestPrivileges(this.Client.Privileges); if (this.IsLoggedIn == true && this.EventsEnabled == true && this.PacketDispatcher != null) { this.PacketDispatcher.SendRequest("procon.account.onAltered", item.Owner.Name, cpPrivs.PrivilegesFlags.ToString(CultureInfo.InvariantCulture)); } if (System.String.CompareOrdinal(this.Username, item.Owner.Name) == 0) { this.Privileges = cpPrivs; } }
private void CPRoConLayerClient_AccountPrivilegesChanged(AccountPrivilege item) { CPrivileges cpPrivs = new CPrivileges(item.Privileges.PrivilegesFlags); cpPrivs.SetLowestPrivileges(this.m_prcClient.Privileges); if (this.IsLoggedIn == true && this.m_blEventsEnabled == true && this.Game != null) { this.Game.SendRequest("procon.account.onAltered", item.Owner.Name, cpPrivs.PrivilegesFlags.ToString()); //this.send(new Packet(true, false, this.AcquireSequenceNumber, new List<string>() { "procon.account.onAltered", item.Owner.Name, cpPrivs.PrivilegesFlags.ToString() })); } if (String.Compare(this.m_strUsername, item.Owner.Name) == 0) { this.m_sprvPrivileges = cpPrivs; } }
private void AccountPrivileges_AccountPrivilegeAdded(AccountPrivilege item) { item.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(item_AccountPrivilegesChanged); this.SaveConnectionConfig(); }