mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-07 07:00:33 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
51
server/FSO.Server.Database/DA/Bans/SqlBans.cs
Executable file
51
server/FSO.Server.Database/DA/Bans/SqlBans.cs
Executable file
|
@ -0,0 +1,51 @@
|
|||
using Dapper;
|
||||
using System.Linq;
|
||||
|
||||
namespace FSO.Server.Database.DA.Bans
|
||||
{
|
||||
public class SqlBans : AbstractSqlDA, IBans
|
||||
{
|
||||
public SqlBans(ISqlContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public DbBan GetByIP(string ip)
|
||||
{
|
||||
return Context.Connection.Query<DbBan>("SELECT * FROM fso_ip_ban WHERE ip_address = @ip", new { ip = ip }).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a ban by MAC Address.
|
||||
/// </summary>
|
||||
/// <param name="client_id"></param>
|
||||
/// <returns></returns>
|
||||
public DbBan GetByClientId(string client_id)
|
||||
{
|
||||
return Context.Connection.Query<DbBan>("SELECT * FROM fso_ip_ban WHERE client_id = @client_id", new { client_id = client_id }).FirstOrDefault();
|
||||
}
|
||||
|
||||
public void Add(string ip, uint userid, string reason, int enddate, string client_id)
|
||||
{
|
||||
Context.Connection.Execute(
|
||||
"REPLACE INTO fso_ip_ban (user_id, ip_address, banreason, end_date, client_id) " +
|
||||
"VALUES (@user_id, @ip_address, @banreason, @end_date, @client_id)",
|
||||
new
|
||||
{
|
||||
user_id = userid,
|
||||
ip_address = ip,
|
||||
banreason = reason,
|
||||
end_date = enddate
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove ban by user_id.
|
||||
/// </summary>
|
||||
/// <param name="ip"></param>
|
||||
public void Remove(uint user_id)
|
||||
{
|
||||
Context.Connection.Query("DELETE FROM fso_ip_ban WHERE user_id = @user_id", new { user_id = user_id });
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue