- Settings *.xml eingefügt - div. Anwendungen eingefügt - kleine Fehler behoben automatische zentrieren der Maus entfernt div. Anpassungen Squashed 'FSI.Lib/' changes from 24aa22a..9a24247 9a24247 Version erhöht 9536f8a div. Anpassungen für FSI.BT.Tools git-subtree-dir: FSI.Lib git-subtree-split: 9a242472bc63c937efcdaaa4e391c5733abe2891 div. Anpassungen div. Fehlerbehoben
65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using FSI.Lib.Helpers;
|
|
|
|
namespace FSI.BT.Tools
|
|
{
|
|
internal class Admin
|
|
{
|
|
public static bool CheckSuperAdminRight()
|
|
{
|
|
if (Global.Settings.SuperAdmin == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
|
|
|
|
if (string.Equals(Global.Settings.SuperAdmin, windowsIdentity.ShortName(), StringComparison.OrdinalIgnoreCase))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
public static bool CheckAdminRight()
|
|
{
|
|
if (Global.Settings.Admins == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
List<string> admins = new List<string>(Global.Settings.Admins);
|
|
|
|
System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
|
|
|
|
foreach (string admin in admins)
|
|
{
|
|
if (string.Equals(admin, windowsIdentity.ShortName(), StringComparison.OrdinalIgnoreCase))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static bool CheckUserRight()
|
|
{
|
|
if (Global.Settings.Users == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
List<string> users = new List<string>(Global.Settings.Users);
|
|
|
|
System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
|
|
|
|
foreach (string user in users)
|
|
{
|
|
if (string.Equals(user, windowsIdentity.ShortName(), StringComparison.OrdinalIgnoreCase))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|