Esempio n. 1
0
        internal static void Init(IUsage <ModulePermission> permission)
        {
            Permission = permission;
            Instance   = permission.Instance;

            DefaultGroup = Instance.Groups.FirstOrDefault(p => p.Id == Instance.DefaultGroupId);
            AdminGroup   = Instance.Groups.FirstOrDefault(p => p.Id == Instance.AdminGroup);
        }
Esempio n. 2
0
        public static bool AddGroup(PermissionGroup group)
        {
            if (GetGroup(group.Id) != null)
            {
                return(false);
            }

            Instance.Groups.Add(group);
            Permission.Save();
            return(true);
        }
Esempio n. 3
0
        public static bool SaveGroup(PermissionGroup group)
        {
            var index = Instance.Groups.FindIndex(g => g.Id == group.Id);

            if (index == -1)
            {
                return(false);
            }

            Instance.Groups[index] = group;
            Permission.Save();
            return(true);
        }
Esempio n. 4
0
 public static bool IsInGroup(this IPlayer player, PermissionGroup group)
 {
     return(group.Members.Contains(player.CSteamId.m_SteamID));
 }