public static bool TryGetChatSuffix(User user, out string suffix) { suffix = default(String); if (user.suffix != default(String) && user.suffix.Trim().Length > 0) suffix = user.suffix; else if (user.group.Count > 0) { Group grp = Permissions.GetGroup(user.group[0]); if (grp != null && grp.GroupInfo.Suffix != default(String) && grp.GroupInfo.Suffix.Trim().Length > 0) suffix = grp.GroupInfo.Suffix; } return suffix != default(String); }
public static bool TryGetChatSeperator(User user, out string seperator) { seperator = default(String); if (user.seperator != default(String) && user.seperator.Trim().Length > 0) seperator = user.seperator; else if (user.group.Count > 0) { Group grp = Permissions.GetGroup(user.group[0]); if (grp != null && grp.GroupInfo.Seperator != default(String) && grp.GroupInfo.Seperator.Trim().Length > 0) seperator = grp.GroupInfo.Seperator; } return seperator != default(String); }
public static bool TryGetChatColor(User user, out Color color) { color = default(Color); if (IsValidColor(user.chatColor)) color = user.chatColor; else if (user.group.Count > 0) { Group grp = Permissions.GetGroup(user.group[0]); if (grp != null && IsValidColor(grp.GroupInfo.color)) color = grp.GroupInfo.color; } return color != default(Color); }
public bool IsUserAllowed(string Node, User user) { if (user.hasPerm.Contains(Node) || user.hasPerm.Contains("*")) return true; Group grp; foreach (string group in user.group) { grp = Permissions.GetGroup(group); if (grp != null && grp.permissions != null && (grp.permissions.ContainsKey(Node) || grp.permissions.ContainsKey("*"))) return true; } return false; }
public static bool CanUserBuild(User user) { if(user.CanBuild) return true; bool canBuild = false; user.group.ForEach( delegate(string grpName) { Group grp = GetGroup(grpName); if (grp != null & grp.GroupInfo.CanBuild) { canBuild = true; return; } } ); return canBuild; }
public static bool TryGetChatSeperator(User user, out string seperator) { seperator = default(String); if (user.seperator != default(String) && user.seperator.Trim().Length > 0) seperator = user.seperator; else if (user.group.Count > 0) { int prevRank = 0; for (int i = 0; i < user.group.Count; i++) { Group grp = Permissions.GetGroup(user.group[i]); if (grp != null && grp.GroupInfo.Seperator != default(String) && grp.GroupInfo.Seperator.Trim().Length > 0) if (grp.GroupInfo.rank != -1 && grp.GroupInfo.rank > prevRank) { seperator = grp.GroupInfo.Seperator; prevRank = grp.GroupInfo.rank; } } } return seperator != default(String); }
public static bool TryGetChatPrefix(User user, out string prefix) { prefix = default(String); if (user.prefix != default(String) && user.prefix.Trim().Length > 0) prefix = user.prefix; else if (user.group.Count > 0) { int prevRank = 0; for (int i = 0; i < user.group.Count; i++) { Group grp = Permissions.GetGroup(user.group[i]); if (grp != null && grp.GroupInfo.Prefix != default(String) && grp.GroupInfo.Prefix.Trim().Length > 0) if (grp.GroupInfo.rank != -1 && grp.GroupInfo.rank > prevRank) { prefix = grp.GroupInfo.Prefix; prevRank = grp.GroupInfo.rank; } } } return prefix != default(String); }
public static bool TryGetChatColor(User user, out Color color) { color = default(Color); if (IsValidColor(user.chatColor)) color = user.chatColor; else if (user.group.Count > 0) { int prevRank = 0; for (int i = 0; i < user.group.Count; i++) { Group grp = Permissions.GetGroup(user.group[i]); if (grp != null && IsValidColor(grp.GroupInfo.color)) if (grp.GroupInfo.rank != -1 && grp.GroupInfo.rank > prevRank) { color = grp.GroupInfo.color; prevRank = grp.GroupInfo.rank; } } } return color != default(Color); }
private void ProcessIndent() { string tokenText = sc.TokenText; if (sc.NextToken() == Token.IndentSpaces) tokenText += sc.TokenText; if (tokenText == " ") { while (sc.NextToken() != Token.TextContent) { } if (!inUsers) { currentGroup = new Group(sc.TokenText); } else { currentUserName = sc.TokenText; currentUser = new User(); } } }
static Permissions() { groups = new List<Group>(); users = new Dictionary<String, User>(); currentUser = new User(); }