Exemple #1
0
        public Player(uint ID      = 0, string Name    = "", Race?Race_ = null, uint Level = 0, uint Exp = 0,
                      uint?GuildID = null, uint[] Gear = null, uint[] Inventory = null, Class?setClass = null, Role?Role_ = null)
        {
            /*******************************************************************
             * Alternate constructor.
             * Allows caller to define class attributes when class is created.
             * All undefined attributes are set to 0, "", or null.
             *****************************************************************/


            id      = ID;
            name    = Name;
            race    = Race_;
            level   = Level;
            exp     = Exp;
            guildID = GuildID;
            if (Gear == null)
            {
                gear = new uint[Constants.GEAR_SLOTS];
            }
            else
            {
                gear = Gear;
            }
            if (Inventory != null)
            {
                inventory = new List <uint>(Inventory);
            }
            else
            {
                inventory = null;
            }
            class_ = setClass;
            role   = Role_;
        }
        public void Divine()
        {
            foreach (Agent agent in AliveAgentList)
            {
                if (gameData.GetRole(agent) == Role.SEER)
                {
                    Agent target     = gameServer.RequestDivineTarget(agent);
                    Role? targetRole = gameData.GetRole(target);
                    if (gameData.GetStatus(target) == Status.DEAD || target == null || targetRole == null)
                    {
                        //					target = getRandomAgent(agentList, agent);
                    }
                    else
                    {
                        Judge divine = new Judge(gameData.Day, agent, target, ((Role)targetRole).GetSpecies());
                        gameData.Divine = divine;

                        if (GameLogger != null)
                        {
                            GameLogger.Log(string.Format("{0},divine,{1},{2},{3}", gameData.Day, divine.Agent.AgentIdx, divine.Target.AgentIdx, divine.Result));
                        }
                    }
                }
            }
        }
Exemple #3
0
 public TcpipClient(string host, int port, Role?requestRole)
 {
     this.host        = host;
     this.port        = port;
     this.RequestRole = requestRole;
     Running          = false;
 }
Exemple #4
0
        /// <inheritdoc />
        public Task <Result <CheckpointState> > GetCheckpointStateAsync(OperationContext context)
        {
            return(context.PerformOperationAsync(
                       Tracer,
                       async() =>
            {
                var(checkpoints, startCursor) = await ExecuteRedisFallbackAsync(context, async redisDb =>
                                                                                Result.Success(await redisDb.ExecuteBatchAsync(context, batch => batch.GetCheckpointsInfoAsync(_checkpointsKey, _clock.UtcNow), RedisOperation.GetCheckpoint)))
                                                .ThrowIfFailureAsync();

                var roleResult = await UpdateRoleAsync(context, release: false);
                if (!roleResult.Succeeded)
                {
                    return new ErrorResult(roleResult).AsResult <Result <CheckpointState> >();
                }

                _role = roleResult.Value;

                var maxCheckpoint = checkpoints.MaxByOrDefault(c => c.CheckpointCreationTime);
                if (maxCheckpoint == null)
                {
                    Tracer.Debug(context, $"Getting checkpoint state: Can't find a checkpoint: Start cursor time: {startCursor}");

                    // Add slack for start cursor to account for clock skew between event hub and redis
                    var epochStartCursor = startCursor - _configuration.EventStore.NewEpochEventStartCursorDelay;
                    return CheckpointState.CreateUnavailable(_role.Value, epochStartCursor);
                }

                Tracer.Debug(context, $"Getting checkpoint state: Found checkpoint '{maxCheckpoint}'");

                return Result.Success(new CheckpointState(_role.Value, new EventSequencePoint(maxCheckpoint.SequenceNumber), maxCheckpoint.CheckpointId, maxCheckpoint.CheckpointCreationTime));
            },
                       Counters[GlobalStoreCounters.GetCheckpointState]));
        }
        public CounterSet GetCounters(OperationContext context, Role?role, Counter counter)
        {
            var counters = new CounterSet();

            counters.Merge(Counters.ToCounterSet(), "RaidedRedis.");
            counters.Merge(PrimaryRedisDb.Counters.ToCounterSet(), "Redis.");

            if (role != Role.Worker)
            {
                // Don't print redis counters on workers
                counters.Merge(PrimaryRedisDb.GetRedisCounters(context, Tracer, counter), "RedisInfo.");
            }

            if (SecondaryRedisDb != null)
            {
                counters.Merge(SecondaryRedisDb.Counters.ToCounterSet(), "SecondaryRedis.");

                if (role != Role.Worker)
                {
                    // Don't print redis counters on workers
                    counters.Merge(SecondaryRedisDb.GetRedisCounters(context, Tracer, counter), "SecondaryRedisInfo.");
                }
            }

            return(counters);
        }
        /// <summary>
        /// Checks if user can be deleted from mapping table based on its references to assessments and role.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="role">The user role.</param>
        /// <param name="db">The db context.</param>
        /// <exception cref="ServiceException">If user cannot be deleted.</exception>
        /// <remarks>Any other exceptions will be propagated to the caller.</remarks>
        private void CheckReferenceForDelete(string username, Role?role, CustomDbContext db)
        {
            if (role == Role.Owner || role == Role.BUFunctionalApprover)
            {
                // don't check approved assessments, since user cannot be deleted, removing role
                // won't affect the assessments as approved assessments are only read only
                var query   = db.AssessmentSet.Where(p => p.ApprovalStatus != ApprovalStatus.Approved);
                var message = "user is approver in";

                //if user role is BUFunctionalApprover check if he is assigned as approver
                // in any assessments in approval work-flow
                if (role == Role.BUFunctionalApprover)
                {
                    query = query.Where(p => (p.DepartmentHead.Name == username ||
                                              p.FunctionalAreaOwner.Name == username) &&
                                        p.ApprovalStatus != ApprovalStatus.Draft &&
                                        p.ApprovalStatus != ApprovalStatus.Rejected);
                }
                else if (role == Role.Owner)
                {
                    // for owner check if he has any assessments submitted
                    query   = query.Where(p => p.SubmitterUsername == username);
                    message = "user is submitter of";
                }

                var referencedAssessmentIds = query.Select(p => p.Id).ToList();
                if (referencedAssessmentIds.Count > 0)
                {
                    throw new ServiceException($"The user cannot be deleted because {message} " +
                                               $"some active assessments with ids ({string.Join(",", referencedAssessmentIds)})");
                }
            }
        }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="role"></param>
        public static void Authorize(AuthorizationFilterContext context, Role?role)
        {
            if (!role.HasValue)
            {
                return;
            }

            var user = context.HttpContext.User.GetUser();

            if (user.IsRoot)
            {
                return;
            }

            var requiredRole = role;

            if (requiredRole == Role.Admin && (user.Role == Role.Admin))
            {
                return;
            }

            if (requiredRole == Role.Editor && (user.Role == Role.Editor || user.Role == Role.Admin))
            {
                return;
            }

            if (requiredRole == Role.Viewer)
            {
                return;
            }

            context.Result = new ForbidResult();
        }
Exemple #8
0
 private void cboRole_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cboRole.SelectedValue.ToString() == Role.Admin.ToString())
     {
         role = Role.Admin;
     }
     else if (cboRole.SelectedValue.ToString() == Role.Cashier.ToString())
     {
         role = Role.Cashier;
     }
     else if (cboRole.SelectedValue.ToString() == Role.Chef.ToString())
     {
         role = Role.Chef;
     }
     else if (cboRole.SelectedValue.ToString() == Role.InventoryController.ToString())
     {
         role = Role.InventoryController;
     }
     else if (cboRole.SelectedValue.ToString() == Role.Waiter.ToString())
     {
         role = Role.Waiter;
     }
     else if (cboRole.SelectedValue.ToString() == "All")
     {
         role = null;
     }
     showList();
 }
Exemple #9
0
        public ActionResult ShowCustomer(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            int         customerId  = Convert.ToInt32(id);
            CustomerDTO customerDTO = null;

            string cacheKey = "show-customer-" + customerId.ToString();

            customerDTO = HttpContext.Cache[cacheKey] as CustomerDTO;

            if (customerDTO == null)
            {
                try
                {
                    customerDTO = _customerService.GetCustomerProfile(customerId);
                }
                catch (ValidationException e)
                {
                    return(new HttpStatusCodeResult(404));
                }

                HttpContext.Cache.Insert(cacheKey, customerDTO, null, DateTime.Now.AddSeconds(120), TimeSpan.Zero);
            }

            UserProfileViewModel userProfileView = _mapper.Map <UserProfileViewModel>(customerDTO);

            var    claimIdentity = HttpContext.User.Identity as ClaimsIdentity;
            string role          = "";
            Role?  clientRole    = null;
            int?   clientId      = null;

            if (claimIdentity != null)
            {
                var roleClaim = claimIdentity.FindFirst(ClaimsIdentity.DefaultRoleClaimType);
                if (roleClaim != null)
                {
                    role       = roleClaim.Value.Trim();
                    clientRole = (Role)Enum.Parse(typeof(Role), role);
                }
            }

            var varClientId = Session["Id"];

            if (varClientId != null)
            {
                clientId = Convert.ToInt32(varClientId);
            }

            if (clientId != null && (clientRole != null && clientRole == Role.Executor))
            {
                DefineIfExecutorCanSeePersonalCustomerData(ref userProfileView, clientId);
            }

            return(View(userProfileView));
        }
 /// <summary>
 /// Contains information about a configuration to be made to an occupant in a room.
 /// </summary>
 /// <param name="Jid">JID of occupant in room.</param>
 /// <param name="NickName">Nick-Name of occupant in room.</param>
 /// <param name="Affiliation">Affiliation change, if specified.</param>
 /// <param name="Role">Role change, if specified.</param>
 /// <param name="Reason">Optioanl Reason</param>
 public MucOccupantConfiguration(string Jid, string NickName, Affiliation?Affiliation, Role?Role, string Reason)
 {
     this.jid         = Jid;
     this.nickName    = NickName;
     this.affiliation = Affiliation;
     this.role        = Role;
     this.reason      = Reason;
 }
Exemple #11
0
 public NotificationClientEventArgs(DataFlow?flow, Role?role, string device, DeviceState?state, PropertyKey key)
 {
     this.Flow = flow;
     this.Role = role;
     this.Device = device;
     this.State = state;
     this.Key = key;
 }
 protected override bool RestartRequired(DataFlow?flow, Role?role)
 {
     if (!BassDirectSoundDevice.IsDefaultDevice)
     {
         return(false);
     }
     return(base.RestartRequired(flow, role));
 }
Exemple #13
0
 public static string Icon(Role?role)
 {
     if (role != null)
     {
         return($"/img/roles/{role}.png");
     }
     return("");
 }
        /// <summary>
        /// Get a page of membership.
        /// </summary>
        /// <param name="client">The HTTP client to use for this request.</param>
        /// <param name="serviceUrl">The membership service URL. In LTI 1 the parameter will be in the launch as <code>custom_context_membership</code>.</param>
        /// <param name="consumerKey">The OAuth Consumer Key.</param>
        /// <param name="consumerSecret">The OAuth Consumer Secret to use for signing the request.</param>
        /// <param name="limit">Specifies the maximum number of items that should be delivered per page. This parameter is merely a hint. The server is not obligated to honor this limit and may at its own discretion choose a different value for the number of items per page.</param>
        /// <param name="rlid">The ID of a resource link within the context and associated and the Tool Provider. The result set will be filtered so that it includes only those memberships that are permitted to access the resource link. If omitted, the result set will include all memberships for the context.</param>
        /// <param name="role">The role for a membership. The result set will be filtered so that it includes only those memberships that contain this role. The value of the parameter should be the full URI for the role, although the simple name may be used for context-level roles. If omitted, the result set will include all memberships with any role.</param>
        public static async Task <ClientResponse <MembershipContainerPage> > GetMembershipPageAsync(
            HttpClient client, string serviceUrl, string consumerKey, string consumerSecret,
            int?limit = null, string rlid = null, Role?role = null)
        {
            var filteredServiceUrl = GetFilteredServiceUrl(serviceUrl, limit, rlid, role);

            return(await GetFilteredMembershipPageAsync(client, filteredServiceUrl, consumerKey, consumerSecret,
                                                        LtiConstants.LisMembershipContainerMediaType));
        }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the FilePermission class.
 /// </summary>
 /// <param name="role">Possible values include: 'Unknown', 'Organizer',
 /// 'Owner', 'Writer', 'Commenter', 'Reader'</param>
 public FilePermission(string googleId = default(string), string domain = default(string), string emailAddress = default(string), System.DateTime?expirationTime = default(System.DateTime?), Role?role = default(Role?))
 {
     GoogleId       = googleId;
     Domain         = domain;
     EmailAddress   = emailAddress;
     ExpirationTime = expirationTime;
     Role           = role;
     CustomInit();
 }
        /// <summary>
        /// Get the membership of a context. Calls GetMembershipPageAsync until there is no NextPage, and returns all the <see cref="Membership"/> records collected.
        /// </summary>
        /// <param name="client">The HTTP client to use for this request.</param>
        /// <param name="serviceUrl">The membership service URL. In LTI 1 the parameter will be in the launch as <code>custom_context_membership</code>.</param>
        /// <param name="consumerKey">The OAuth Consumer Key.</param>
        /// <param name="consumerSecret">The OAuth Consumer Secret to use for signing the request.</param>
        /// <param name="rlid">The ID of a resource link within the context and associated and the Tool Provider. The result set will be filtered so that it includes only those memberships that are permitted to access the resource link. If omitted, the result set will include all memberships for the context.</param>
        /// <param name="role">The role for a membership. The result set will be filtered so that it includes only those memberships that contain this role. The value of the parameter should be the full URI for the role, although the simple name may be used for context-level roles. If omitted, the result set will include all memberships with any role.</param>
        public static async Task <ClientResponse <List <Membership> > > GetMembershipAsync(
            HttpClient client, string serviceUrl, string consumerKey, string consumerSecret,
            string rlid = null, Role?role = null)
        {
            var filteredServiceUrl = GetFilteredServiceUrl(serviceUrl, null, rlid, role);
            var pageResponse       = await GetFilteredMembershipPageAsync(client, filteredServiceUrl, consumerKey, consumerSecret, LtiConstants.LisMembershipContainerMediaType);

            Uri pageId = null;
            var result = new ClientResponse <List <Membership> >
            {
                Response = new List <Membership>()
            };

            do
            {
#if DEBUG
                result.HttpRequest  = pageResponse.HttpRequest;
                result.HttpResponse = pageResponse.HttpResponse;
#endif
                result.StatusCode = pageResponse.StatusCode;
                if (pageResponse.StatusCode != HttpStatusCode.OK)
                {
                    return(result);
                }
                if (pageResponse.Response == null)
                {
                    return(result);
                }

                // If the same page is comming back from the consumer, just
                // return what we have.
                if (pageId != null && pageId == pageResponse.Response.Id)
                {
                    return(result);
                }
                pageId = pageResponse.Response.Id;

                // Add the memberships to the list (the collection cannot be null)
                if (pageResponse.Response.MembershipContainer?.MembershipSubject?.Membership != null)
                {
                    result.Response.AddRange(pageResponse.Response.MembershipContainer.MembershipSubject.Membership);
                }

                // Repeat until there is no NextPage
                if (string.IsNullOrWhiteSpace(pageResponse.Response.NextPage))
                {
                    break;
                }

                // Get the next page
                filteredServiceUrl = GetFilteredServiceUrl(pageResponse.Response.NextPage, null, rlid, role);
                pageResponse       = await GetFilteredMembershipPageAsync(client, filteredServiceUrl, consumerKey, consumerSecret, LtiConstants.LisMembershipContainerMediaType);
            } while (true);

            return(result);
        }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Member" /> class.
 /// </summary>
 /// <param name="links">links.</param>
 /// <param name="id">id.</param>
 /// <param name="role">role.</param>
 /// <param name="email">email.</param>
 /// <param name="pendingInvite">pendingInvite.</param>
 /// <param name="isBeta">isBeta.</param>
 /// <param name="customRoles">customRoles.</param>
 public Member(Links links = default(Links), string id = default(string), Role?role = default(Role?), string email = default(string), bool?pendingInvite = default(bool?), bool?isBeta = default(bool?), List <Id> customRoles = default(List <Id>))
 {
     this.Links         = links;
     this.Id            = id;
     this.Role          = role;
     this.Email         = email;
     this.PendingInvite = pendingInvite;
     this.IsBeta        = isBeta;
     this.CustomRoles   = customRoles;
 }
Exemple #18
0
        internal void UserInLibrary(int accountId, int libraryId, Role?role)
        {
            var accounts = _connection.GetAccountLibraries(accountId);

            accounts.Should().Contain(t => t.LibraryId == libraryId, "user not found in library");
            if (role.HasValue)
            {
                accounts.Should().Contain(t => t.Role == role, "user with correct role not found in library");
            }
        }
Exemple #19
0
 private void Role_Selected(object sender, EventArgs e)
 {
     /*****************************************************************
     * CheckedChanged handler for Form1's radio buttons.
     *
     * Changes the value of role_rbtn_selection based on which role
     * was selected.
     *****************************************************************/
     role_rbtn_selection = (Role)((RadioButton)sender).TabIndex;
 }
Exemple #20
0
 public static bool FalseIfNullOrTrueIf(this Role?role, Func <Role, bool> trueIf)
 {
     if (!role.HasValue)
     {
         return(false);
     }
     else
     {
         return(trueIf(role.Value));
     }
 }
Exemple #21
0
 public static IList <Permission> Permissions(this Role?role)
 {
     if (role.HasValue)
     {
         return(DefaultPermissions[role.Value]);
     }
     else
     {
         return(new List <Permission>());
     }
 }
Exemple #22
0
        public async Task <IActionResult> GetAsync([FromQuery] Role?role = null)
        {
            IEnumerable <User> users = await userLogic.GetAsync(role).ConfigureAwait(false);

            if (users == null)
            {
                return(Ok(Enumerable.Empty <User>()));
            }

            return(Ok(users));
        }
Exemple #23
0
        public TestBase(Role?role = null, bool periodicalsEnabled = false, bool createLibrary = true)
        {
            _periodicalsEnabled = periodicalsEnabled;
            _role = role;

            var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
            var projectDir  = Directory.GetCurrentDirectory();
            var configPath  = Path.Combine(projectDir, "appsettings.json");

            _factory = new WebApplicationFactory <Startup>()
                       .WithWebHostBuilder(builder =>
            {
                builder.ConfigureAppConfiguration((context, conf) =>
                {
                    conf.AddJsonFile(configPath);

                    if (!string.IsNullOrWhiteSpace(environment))
                    {
                        conf.AddJsonFile(Path.Combine(projectDir, $"appsettings.json"), true);
                        //conf.AddJsonFile(Path.Combine(projectDir, $"appsettings.{environment}.json"), true);
                    }
                });
                builder.ConfigureTestServices(services => ConfigureServices(services));
            });

            var settings = Services.GetService <Settings>();

            AccountBuilder = _factory.Services.GetService <AccountDataBuilder>();

            if (role.HasValue)
            {
                AccountBuilder = AccountBuilder.As(_role.Value).Verified();
                _account       = AccountBuilder.Build();
            }

            if (createLibrary)
            {
                var builder = LibraryBuilder.WithPeriodicalsEnabled(_periodicalsEnabled);
                if (_account != null && role.HasValue)
                {
                    builder.AssignToUser(AccountId, _role.Value);
                }
                Library = builder.Build();
            }

            Client = _factory.CreateClient();

            if (_account != null)
            {
                var token = TokenBuilder.GenerateToken(settings, _account.Id);
                Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
            }
        }
        private static void PopulateRoles(DbContextAccessor accessor)
        {
            // Role
#pragma warning disable CS8602 // 解引用可能出现空引用。
            accessor.Roles.Add(new Role
            {
                Id    = StoreHelper.GenerateRoleId(),
                Name  = RoleNameAdministrator,
                Descr = "管理员"
            });
#pragma warning restore CS8602 // 解引用可能出现空引用。

            accessor.Roles.Add(new Role
            {
                Id    = StoreHelper.GenerateRoleId(),
                Name  = RoleNameRegister,
                Descr = "注册员"
            });

            _roleAdministrator = accessor.Roles.ReadyQuery().First(p => p.Name == RoleNameAdministrator);
            _roleRegister      = accessor.Roles.ReadyQuery().First(p => p.Name == RoleNameRegister);

            // RoleMenu
#pragma warning disable CS8604 // 可能的 null 引用参数。
            var adminMenuIds = accessor.Menus.ReadyQuery().Select(s => s.Id).ToList();
#pragma warning restore CS8604 // 可能的 null 引用参数。
#pragma warning disable CS8602 // 解引用可能出现空引用。
            var registMenuIds = adminMenuIds.Where(p => p.StartsWith("102") || p.StartsWith("103"));
#pragma warning restore CS8602 // 解引用可能出现空引用。

            adminMenuIds.ForEach(id =>
            {
#pragma warning disable CS8602 // 解引用可能出现空引用。
                accessor.RoleMenus.Add(new RoleMenu
#pragma warning restore CS8602 // 解引用可能出现空引用。
                {
                    RoleId = _roleAdministrator?.Id,
                    MenuId = id
                });
            });

            registMenuIds.ForEach(id =>
            {
#pragma warning disable CS8602 // 解引用可能出现空引用。
                accessor.RoleMenus.Add(new RoleMenu
#pragma warning restore CS8602 // 解引用可能出现空引用。
                {
                    RoleId = _roleRegister?.Id,
                    MenuId = id
                });
            });
        }
Exemple #25
0
        public OccupantNode(TreeNode Parent, string RoomId, string Domain, string NickName, Affiliation?Affiliation, Role?Role, string Jid)
            : base(Parent)
        {
            this.roomId       = RoomId;
            this.domain       = Domain;
            this.nickName     = NickName;
            this.jid          = Jid;
            this.affiliation  = Affiliation;
            this.role         = Role;
            this.availability = null;

            this.SetParameters();
        }
Exemple #26
0
        /// <inheritdoc />
        public async Task <Role?> ReleaseRoleIfNecessaryAsync(OperationContext context)
        {
            if (_role == Role.Master)
            {
                await context.PerformOperationAsync(
                    Tracer,
                    () => UpdateRoleAsync(context, release : true),
                    Counters[GlobalStoreCounters.ReleaseRole]).IgnoreFailure(); // Error is already observed.

                _role = null;
            }

            return(_role);
        }
Exemple #27
0
        public BindingListView <User> GetUsers(string contains, Role?role, string SortBy = null, bool?activeOnly = true)
        {
            ObservableCollection <User> list = GetUsers(Settings.GetCompanyName(), contains,
                                                        role ?? Role.AllRoles,
                                                        activeOnly);
            var ret = new BindingListView <User>(list.ToList());

            if (!String.IsNullOrWhiteSpace(SortBy))
            {
                ret.Sort = SortBy;
            }

            return(ret);
        }
Exemple #28
0
        private void RequireAuthorizedUserHaveRoleInGroup(Guid groupId, Role?role = null)
        {
            var userGroup = _groupUserRepository.GetByUserIdAndGroupId(_authorizedUser.Id, groupId);

            if (userGroup == null)
            {
                throw new LogicApiException("You are not member of this Group.");
            }

            if (role != null && userGroup.Role != role)
            {
                throw new NotEnoughRightsApiException();
            }
        }
Exemple #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClanMember" /> class.
 /// </summary>
 /// <param name="league">league.</param>
 /// <param name="tag">tag.</param>
 /// <param name="name">name.</param>
 /// <param name="role">role.</param>
 /// <param name="expLevel">expLevel.</param>
 /// <param name="clanRank">clanRank.</param>
 /// <param name="previousClanRank">previousClanRank.</param>
 /// <param name="donations">donations.</param>
 /// <param name="donationsReceived">donationsReceived.</param>
 /// <param name="trophies">trophies.</param>
 /// <param name="versusTrophies">versusTrophies.</param>
 public ClanMember(League league = default(League), string tag = default(string), string name = default(string), Role?role = default(Role?), int expLevel = default(int), int clanRank = default(int), int previousClanRank = default(int), int donations = default(int), int donationsReceived = default(int), int trophies = default(int), int versusTrophies = default(int))
 {
     League            = league;
     Tag               = tag;
     Name              = name;
     Role              = role;
     ExpLevel          = expLevel;
     ClanRank          = clanRank;
     PreviousClanRank  = previousClanRank;
     Donations         = donations;
     DonationsReceived = donationsReceived;
     Trophies          = trophies;
     VersusTrophies    = versusTrophies;
 }
 /// <summary>
 /// Event arguments for user presence events.
 /// </summary>
 /// <param name="e">Presence event arguments</param>
 /// <param name="RoomId">Room ID</param>
 /// <param name="Domain">Domain hosting the room.</param>
 /// <param name="UserNick">Nick-Name of user sending presence.</param>
 /// <param name="Affiliation">User affiliation.</param>
 /// <param name="Role">User role.</param>
 /// <param name="FullJid">Full JID, if privileges allow.</param>
 /// <param name="Reason">Optional reason provided for the change.</param>
 /// <param name="RoomDestroyed">If room has been destroyed.</param>
 /// <param name="Status">Status codes.</param>
 public UserPresenceEventArgs(PresenceEventArgs e, string RoomId, string Domain,
                              string UserNick, Affiliation Affiliation, Role Role, string FullJid,
                              string Reason, bool RoomDestroyed, params MucStatus[] Status)
     : base(e)
 {
     this.roomId        = RoomId;
     this.domain        = Domain;
     this.userNick      = UserNick;
     this.affiliation   = Affiliation;
     this.role          = Role;
     this.fullJid       = FullJid;
     this.reason        = Reason;
     this.roomDestroyed = RoomDestroyed;
     this.status        = Status;
 }
 public AuthorizeRolesAttribute(Role roles){Roles = roles;}