fixed useless query for being useless. Added in code that checks the list of groups and not the db itself.
TSDEV-49
This commit is contained in:
parent
15af989826
commit
987d9e793b
1 changed files with 4 additions and 18 deletions
|
|
@ -131,27 +131,13 @@ namespace TShockAPI.DB
|
|||
if (group == "superadmin")
|
||||
return true;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (var com = database.CreateCommand())
|
||||
{
|
||||
com.CommandText = "SELECT * FROM Grouplist WHERE GroupName=@groupname";
|
||||
com.AddParameter("@groupname", group);
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
if (reader.Get<string>("GroupName") == group)
|
||||
return true;
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
foreach (Group g in groups)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
if (g.Name.Equals(group))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue