bool CheckUserPermissions(ClientCredentials clientCredentials, User user) { PermissionType? permission = null; if (clientCredentials.ClientType == ClientType.Administrator) permission = PermissionType.Adm_ViewConfig; else if (clientCredentials.ClientType == ClientType.Monitor) permission = PermissionType.Oper_Login; if (!permission.HasValue) return true; return user == null ? false : user.HasPermission(permission.Value); }