Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CheckBan method #29

Merged
merged 1 commit into from

2 participants

@keverw
Collaborator

returns if a user is banned or not, and infomation pertaining to the ban such as if it was permeant or not, and if temp banned, it gives BannedUntil unix timestamp.

@RevolutionSmythe RevolutionSmythe merged commit 51ccf81 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2013
  1. @keverw

    CheckBan method

    keverw authored
This page is out of date. Refresh to see the latest.
Showing with 47 additions and 0 deletions.
  1. +47 −0 AuroraService/addon-modules/AuroraWebUI/Modules/WebUIHandler.cs
View
47 AuroraService/addon-modules/AuroraWebUI/Modules/WebUIHandler.cs
@@ -1188,6 +1188,53 @@ private OSDMap UnBanUser(OSDMap map)
return resp;
}
+ private OSDMap CheckBan(OSDMap map)
+ {
+ OSDMap resp = new OSDMap();
+
+ UUID agentID = map["UserID"].AsUUID();
+ IAgentInfo agentInfo = DataPlugins.RequestPlugin<IAgentConnector>().GetAgent(agentID);
+
+ if (agentInfo != null) //found
+ {
+ resp["UserFound"] = OSD.FromBoolean(true);
+
+ bool banned = ((agentInfo.Flags & IAgentFlags.TempBan) == IAgentFlags.TempBan) || ((agentInfo.Flags & IAgentFlags.PermBan) == IAgentFlags.PermBan);
+
+ resp["banned"] = OSD.FromBoolean(banned);
+
+ if (banned) //get ban type
+ {
+ if ((agentInfo.Flags & IAgentFlags.PermBan) == IAgentFlags.PermBan)
+ {
+ resp["BanType"] = OSD.FromString("PermBan");
+ }
+ else if ((agentInfo.Flags & IAgentFlags.TempBan) == IAgentFlags.TempBan)
+ {
+ resp["BanType"] = OSD.FromString("TempBan");
+ if (agentInfo.OtherAgentInformation.ContainsKey("TemperaryBanInfo") == true)
+ {
+ resp["BannedUntil"] = OSD.FromInteger(Util.ToUnixTime(agentInfo.OtherAgentInformation["TemperaryBanInfo"]));
+ }
+ else
+ {
+ resp["BannedUntil"] = OSD.FromInteger(0);
+ }
+ }
+ else
+ {
+ resp["BanType"] = OSD.FromString("Unknown");
+ }
+ }
+ }
+ else //not found
+ {
+ resp["UserFound"] = OSD.FromBoolean(false);
+ }
+
+ return resp;
+ }
+
#endregion
private OSDMap FindUsers(OSDMap map)
Something went wrong with that request. Please try again.