public static PaperLetter Create (Person creator, Organization organization, string fromName, string[] replyAddressLines, DateTime receivedDate, Person recipient, RoleType recipientRole, bool personal) { return Create(creator.Identity, organization.Identity, fromName, replyAddressLines, receivedDate, recipient.Identity, recipientRole, personal); }
public bool AuthorizeRequest(HttpContext httpContext, RoleType minimumRoleType) { try { // If global admin services, authentication was handled by IIS if (ServiceContext.IsAdminServiceHost) return HttpContext.Current.User.Identity.IsAuthenticated; // Attempt to obtain token from request var token = ExtractAuthorizationToken(httpContext.Request); if (token != null) { // Create a user context from the token var userContext = CreateUserContextFromToken(httpContext, token, minimumRoleType); if (userContext != null) { // Add token to HTTP context for future reference HttpContext.Current.Items.Add(CommonParameters.UserContext, userContext); return true; } } } catch (Exception ex) { ServiceContext.Logger.Error("Error while authenticating user", ex); } return false; }
public static PaperLetter Create(int creatingPersonId, int organizationId, string fromName, string[] replyAddressLines, DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal) { return FromIdentity(SwarmDb.GetDatabaseForWriting(). CreatePaperLetter(organizationId, fromName, String.Join("|", replyAddressLines), receivedDate, toPersonId, toPersonInRole, personal, creatingPersonId)); }
public DocumentShare ShareDocument(Guid dlId, Guid usId, string message = "", RoleType linkRole = RoleType.Viewer) { if (dlId.Equals(Guid.Empty)) { throw new ArgumentException("dlId is required but was an empty Guid", "dlId"); } if (usId.Equals(Guid.Empty)) { throw new ArgumentException("dlId is required but was an empty Guid", "usId"); } switch (linkRole) { case RoleType.Owner: case RoleType.Editor: linkRole = RoleType.Editor; break; default: linkRole = RoleType.Viewer; break; } dynamic postData = new ExpandoObject(); postData.users = usId; postData.message = message; postData.baseUrl = ShareUrl; postData.isPublic = "true"; postData.linkRole = linkRole.ToString().ToLower(); return HttpHelper.Put<DocumentShare>(VVRestApi.GlobalConfiguration.Routes.DocumentsIdShares, "", GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData, dlId, usId); }
/// <summary> /// constructor /// </summary> /// <param name="id">id of the user</param> /// <param name="name">name of the user</param> /// <param name="username">username of the user (represented by email)</param> /// <param name="roleId">role represented by the enum</param> public User(int id, string name, string username, int roleId) { this.Id = id; this.Name = name; this.Username = username; Role = (RoleType)roleId; }
/// <summary> /// constructor /// </summary> /// <param name="id">id of the user</param> /// <param name="name">name of the user</param> /// <param name="username">username of the user (represented by email)</param> /// <param name="roleId">role represented by the enum</param> public User(int id, string name, string username, int roleId) { Allowedpages = new List<string>(); this.Id = id; this.Name = name; this.Username = username; Role = (RoleType)roleId; if (RoleId == 1) { Allowedpages.Add("beheer"); Allowedpages.Add("inuitrij"); Allowedpages.Add("reparatie"); Allowedpages.Add("schoonmaak"); } if (RoleId == 2) { Allowedpages.Add("inuitrij"); } if (RoleId == 3) { Allowedpages.Add("beheer"); } if (RoleId == 4) { Allowedpages.Add("reparatie"); } if (RoleId == 5) { Allowedpages.Add("schoonmaak"); } }
public List<DocumentShare> ShareDocument(Guid dlId, List<Guid> usIdList, string message = "", RoleType linkRole = RoleType.Viewer) { if (dlId.Equals(Guid.Empty)) { throw new ArgumentException("dlId is required but was an empty Guid", "dlId"); } switch (linkRole) { case RoleType.Owner: case RoleType.Editor: linkRole = RoleType.Editor; break; default: linkRole = RoleType.Viewer; break; } var jarray = new JArray(); foreach (var usId in usIdList) { jarray.Add(new JObject(new JProperty("id", usId))); } var jobjectString = JsonConvert.SerializeObject(jarray); dynamic postData = new ExpandoObject(); postData.users = jobjectString; postData.message = message; postData.baseUrl = ShareUrl; postData.isPublic = "true"; postData.linkRole = linkRole.ToString().ToLower(); return HttpHelper.PutListResult<DocumentShare>(VVRestApi.GlobalConfiguration.Routes.DocumentsIdShares, "", GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData, dlId); }
private object AddRoleSyncRoot(RoleType roleType) { var roleSyncRoot = new object(); RoleSyncRoots.Add(roleType, roleSyncRoot); return roleSyncRoot; }
public void ParseRoleType_ReturnsCorrectString(RoleType roleType, string expected) { //act var result = EnumFactory.ParseRoleType(roleType); //assert result.Should().Be(expected); }
/// <summary> /// Gets the business account for an Id. /// It will return one entity as an IQueryable for performance. /// Returns null if the user does not have access to the BusinessAccount. /// </summary> /// <param name="coreEntitiesContainer">The core entities container.</param> /// <param name="businessAccountId">The businessAccount Id.</param> /// <param name="allowedRoleTypes">Return null if the user does not have access to one of these role types.</param> public static IQueryable<BusinessAccount> BusinessAccount(this CoreEntitiesContainer coreEntitiesContainer, Guid businessAccountId, RoleType[] allowedRoleTypes) { var ownerParty = from role in RolesCurrentUserHasAccessTo(coreEntitiesContainer, allowedRoleTypes) where role.OwnerBusinessAccountId == businessAccountId select role.OwnerBusinessAccount; return ownerParty; }
/// <summary> /// Normal constructor. /// </summary> /// <param name="personId">The person Id.</param> /// <param name="roleType">The node-specific role.</param> /// <param name="organizationId">The organization Id.</param> /// <param name="geographyId">The node Id.</param> public BasicPersonRole (int roleId, int personId, RoleType type, int organizationId, int geographyId) { this.roleId = roleId; this.personId = personId; this.type = type; this.organizationId = organizationId; this.geographyId = geographyId; }
public void EnumHelper_Parse_ReturnsCorrectEnum(string value, RoleType roleType) { //act var result = EnumHelper<RoleType>.Parse(value); //assert result.Should().Be(roleType); }
string PrintGeography (Geography geo) { StringBuilder sbl = new StringBuilder(); RoleType[] rolesToShow = new RoleType[] { RoleType.OrganizationChairman, RoleType.OrganizationVice1, RoleType.OrganizationSecretary, RoleType.LocalLead, RoleType.LocalDeputy }; Organizations orgs = Organizations.GetOrganizationsAvailableAtGeography(geo.Identity); foreach (Organization org in orgs) { Dictionary<int, bool> listedPersons = new Dictionary<int, bool>(); if (org.IsOrInherits(Organization.UPSEid)) { if (org.AnchorGeographyId == geo.Identity || org.UptakeGeographies.Contains(geo)) { RoleLookup officers = RoleLookup.FromOrganization(org); bool foundRole = false; foreach (RoleType rt in rolesToShow) { foundRole |= officers[rt].Count > 0; if (foundRole) break; } if (foundRole) { sbl.Append("<br><br><b>" + HttpUtility.HtmlEncode(org.Name) + ":</b>"); foreach (RoleType rt in rolesToShow) foreach (Activizr.Logic.Pirates.PersonRole r in officers[rt]) { if (!listedPersons.ContainsKey(r.PersonId)) { sbl.Append(PrintOfficer(r)); listedPersons[r.PersonId] = true; } } sbl.Append("<br>"); } } } else { RoleLookup officers = RoleLookup.FromGeographyAndOrganization(geo, org); if (officers[RoleType.LocalLead].Count > 0 || officers[RoleType.LocalDeputy].Count > 0) { sbl.Append("<br><br><b>" + HttpUtility.HtmlEncode(org.Name) + ", " + HttpUtility.HtmlEncode(geo.Name) + ":</b>"); foreach (RoleType rt in rolesToShow) foreach (Activizr.Logic.Pirates.PersonRole r in officers[rt]) if (!listedPersons.ContainsKey(r.PersonId)) { sbl.Append(PrintOfficer(r)); listedPersons[r.PersonId] = true; } sbl.Append("<br>"); } } } return sbl.ToString(); }
public Role GetRoleByType(RoleType type) { using (var db = new BlogContext()) { return (from p in db.Roles where p.Type == type select p).FirstOrDefault(); } }
public static bool IsInRole(this IPrincipal principal, RoleType roleType) { if (principal == null) { throw new ArgumentNullException("principal"); } return principal.IsInRole(Enum.GetName(typeof(RoleType), roleType)); }
public virtual ViewResult Create(RoleType roleType) { if(roleType != RoleType.Admin && roleType != RoleType.Broker && roleType != RoleType.Manager) { throw new NotSupportedException(); } return View(); }
public Role GetRole(RoleType roleType) { if (!Enum.IsDefined(typeof(RoleType), roleType)) { throw new ArgumentOutOfRangeException("roleType"); } return _cache[CreateRoleKey(roleType)] as Role; }
/// <summary> /// 检验当前登录用户的权限 /// </summary> /// <param name="role"></param> /// <returns></returns> public bool CheckRole(RoleType role) { AdminUser user = GetUser(); CommonLoger.Info(role.ToString() + user.RoleType.ToString()); if (user == null || (int)user.RoleType != (int)role) return false; else return true; }
public bool HasAnyRole(RoleType[] types) { foreach (var role in types) { if (HasRole(role)) return true; } return false; }
public bool CanModify(RoleType userRole, RoleType editUserRole) { var canModify = (userRole == RoleType.DvsSuperAdmin || userRole == RoleType.DvsAdmin); if (userRole != RoleType.DvsSuperAdmin && editUserRole == RoleType.DvsSuperAdmin) { canModify = false; } return canModify; }
public CompositionHelper(string mainConnectionString, string filesConnectionString, RoleType type = RoleType.Admin) { _type = type; _mainConnectionString = mainConnectionString; _filesConnectionString = filesConnectionString; _connection = new SqlConnection(_mainConnectionString); _transactionScope = new TransactionScope(); Init(); }
public static ICurrentUser GetFakeUser(RoleType roleType) { return new CurrentUser() { Role = roleType, Name = "name", ServicerId = 1, OrganizationId = 2 }; }
//获取存活物体索引号 public List<int> GetAliveItemIndex(RoleType type) { List<int> alive = new List<int>(); for (int i = 0; i < BattleRoleList.Count; i++) { if (BattleRoleList[i].roleType == type && BattleRoleList[i].hp > 0) { alive.Add(i); } } return alive; }
public RequestDetailsViewModel(Order order, IReferenceManagement refManager, AppraiserOrder appraiserOrder, ISecurityContext securityContext) { if (order != null) { bool isAppraiserUser = new RoleType[] { RoleType.AppraisalCompanyAdmin, RoleType.Appraiser, RoleType.CompanyAdminAndAppraiser } .Contains(securityContext.CurrentUser.PrimaryRole.RoleType); bool isDVSUser = new RoleType[] { RoleType.DvsAdmin, RoleType.DvsDisbursementsProcessor, RoleType.DvsSuperAdmin } .Contains(securityContext.CurrentUser.PrimaryRole.RoleType); AcceptOrderData = new RequestDetailsAcceptOrderViewModel(); if (appraiserOrder != null) { Distance = appraiserOrder.Distance; AppraiserOrderId = appraiserOrder.Id; AllowAcceptDeclineOrder = appraiserOrder.Order.OrderStatus == OrderStatus.PendingAssignment && (isDVSUser || (!appraiserOrder.IsDeclined && isAppraiserUser)); AcceptOrderData.DefaultAppraiserId = appraiserOrder.AppraiserUser.Id; AcceptOrderData.DefaultAppraiserFirstName = appraiserOrder.AppraiserUser.User.FirstName; AcceptOrderData.DefaultAppraiserLastName = appraiserOrder.AppraiserUser.User.LastName; AcceptOrderData.DefaultAppraiserEmail = appraiserOrder.AppraiserUser.User.Email; AcceptOrderData.IsOtherAppraiser = false; } else { if (order.AcceptedAppraiserUser != null) { AcceptedInfo = String.Format("Accepted on {0} {1} by {2} ({3})", order.AcceptDate.Value.Date.ToString(Constants.DateTimeFormats.Date), order.AcceptDate.Value.ToString(Constants.DateTimeFormats.Time), order.AcceptedAppraiserUser.User.FullName, order.AcceptedAppraiserUser.User.Email); } else { AllowAcceptDeclineOrder = isDVSUser && order.OrderStatus == OrderStatus.PendingAssignment; } AcceptOrderData.IsOtherAppraiser = order.AcceptedAppraiserUser == null; } Address propertyAddress = order.GeneralInfo.PropertyAddress; if (!string.IsNullOrEmpty(order.GeocodingCounty)) propertyAddress.County = order.GeocodingCounty; Address = new AddressWithCountyViewModel { City = propertyAddress.City, County = propertyAddress.County, State = propertyAddress.State, Street = propertyAddress.Street, Street2 = propertyAddress.Street2, ZIP = propertyAddress.ZIP }; IsRush = order.AppraisalInfo.Rush; IsSecondAppraisalOrDuplicateAppraisal = order.AppraisalInfo.SecondDuplicateAppraisal; IsSupplementalREOAddendum = order.AppraisalInfo.SupplementalREOAddendum; DueDate = order.DueDate.Value; AppraisalFormType = order.AppraisalInfo.AppraisalForm.HasValue ? refManager.GetAppraisalForms().Single(e => e.Id == order.AppraisalInfo.AppraisalForm.Value).FormAbbreviation : null; ReviewFormType = order.AppraisalInfo.ReviewForm.HasValue ? refManager.GetAppraisalForms().Single(e => e.Id == order.AppraisalInfo.ReviewForm.Value).FormAbbreviation : null; AppraisalType = order.AppraisalInfo.AppraisalType.Value; LoanPurpose = refManager.GetReference(ReferenceType.LoanPurposeTypes)[order.LoanAndContactInfo.LoanPurposeTypeId.Value]; Occupancy = refManager.GetReference(ReferenceType.OccupancyTypes)[order.AppraisalInfo.OccupancyTypeId.Value]; PropertyType = refManager.GetReference(ReferenceType.PropertyTypes)[order.AppraisalInfo.PropertyTypeId.Value]; LoanType = order.AppraisalInfo.LoanType.HasValue ? order.AppraisalInfo.LoanType.Value.ToString() : Constants.Text.EmptyField; if (order.LoanAndContactInfo.LoanPurpose == Model.Enums.OrderManagement.LoanPurpose.Purchase) PurchasePrice = order.LoanAndContactInfo.PurchasePrice.Value.ToString(); TotalFee = order.AppraisersFee; Instructions = order.LoanAndContactInfo.Instructions != null ? order.LoanAndContactInfo.Instructions.ToList().Select(s => s.Id) : new List<int>(); } }
public BasicVolunteerRole (int volunteerRoleId, int volunteerId, int organizationId, int geographyId, RoleType roleType, bool open, bool assigned) { this.volunteerRoleId = volunteerRoleId; this.volunteerId = volunteerId; this.organizationId = organizationId; this.geographyId = geographyId; this.roleType = roleType; this.open = open; this.assigned = assigned; }
public void SetStateVisibilities(long stateId, RoleType[] roles) { if(roles == null) { throw new ArgumentNullException("roles"); } var table = TableParameters.GeIdsTable("Roles", roles.Select(x => (long)x).ToArray()); _executor.Execute("[dbo].[State_SetStateVisibilities]", new TableParameters(new { stateId }, table)); }
public virtual ViewResult Edit(RoleType roleType, long id) { if(roleType != RoleType.Admin && roleType != RoleType.Broker && roleType != RoleType.Manager) { throw new NotSupportedException(); } var model = _userService.Get(roleType, id); return View(model); }
public IList<NetworkLeagueModel.DTO.AdminUserNameIDDto> GetAdminUserNameIDsByRoleType(RoleType type) { try { return dal.GetAdminUserNameIDsByRoleType(type); } catch (Exception ex) { CommonLoger.Error(ex.ToString()); return new List<NetworkLeagueModel.DTO.AdminUserNameIDDto>(); } }
public Roles this[RoleType roleType] { get { if (this.lookup.ContainsKey(roleType)) { return this.lookup[roleType]; } return new Roles(); } }
/// <summary> /// 查询用户列表,如果角色为admin则查询所有用户 /// </summary> /// <param name="type"></param> /// <returns></returns> public IList<NetworkLeagueModel.AdminUser> GetAdminUsersByRoleType(RoleType type) { using (ISession session = NHibernateHelper.OpenSession()) { string sql = "select * from AdminUser where (:roleType = 0 or RoleType = :roleType) and RoleType <> 0"; IList<AdminUser> adverts = session.CreateSQLQuery(sql) .SetString("roleType",Convert.ToString((int)type)) .SetResultTransformer(Transformers.AliasToBean<AdminUser>()).List<AdminUser>(); return adverts; } }
public void AssertExistsNonEmptyString(IObject association, RoleType roleType) { this.AssertExists(association, roleType); this.AssertNonEmptyString(association, roleType); }
/// <summary> /// 根据角色加载权限,有缓存 /// </summary> /// <param name="roleType"></param> /// <param name="userId"></param> /// <param name="listRight"></param> /// <returns></returns> public Result <List <Base_Right> > LoadRightList(RoleType roleType, long userId = 0, List <long> listRight = null) { return(base.Channel.LoadRightList(roleType, userId, listRight)); }
public void SetCurrentRoleType(RoleType rt) { playerMng.SetCurrentRoleType(rt); }
public bool CompareRoleAuth(RoleType a, RoleType b) { return((int)a <= (int)b); }
public PersonRole AddRole(RoleType roleType, Organization organization, Geography geography) { return(AddRole(roleType, organization.Identity, geography.Identity)); }
public void SetCurrentRoleType(int rt) { currentRoleType = (RoleType)rt; }
/// <summary> /// Gets the random spawn point of the indicated role. /// </summary> /// <param name="role">RoleType</param> /// <returns>Vector3 spawnPoint</returns> public static Vector3 GetRandomSpawnPoint(RoleType role) { GameObject randomPosition = Object.FindObjectOfType <SpawnpointManager>().GetRandomPosition(role); return(randomPosition == null ? Vector3.zero : randomPosition.transform.position); }
public PersonRole AddRole(RoleType roleType, int organizationId, int geographyId) { return(PersonRole.Create(Identity, roleType, organizationId, geographyId)); }
public static PersonRole Create(int personId, RoleType roleType, int organizationId, int nodeId) { return(FromIdentityAggressive(SwarmDb.GetDatabaseForWriting().CreateRole(personId, roleType, organizationId, nodeId))); }
public JobDomain( string id, Guid categoryId, string title, JobTypeEnum jobTypeId, Guid creatorId, RoleType createdByRole, List <JobAddress> addressList, List <RelationGroupModel> relationGroupList, string parentId) : this() { Id = id; RaiseEvent(new JobCreated { ParentId = parentId, CategoryId = categoryId, Title = title, JobTypeId = jobTypeId, CreatorId = creatorId, AddressList = addressList, RelationGroupList = relationGroupList, CreatedByRole = createdByRole }); }
public static JobDomain Create( string id, Guid categoryId, string title, JobTypeEnum jobTypeId, Guid creatorId, RoleType createdByRole, List <JobAddress> addressList, List <RelationGroupModel> relationGroupList, string parentId) { return(new JobDomain(id, categoryId, title, jobTypeId, creatorId, createdByRole, addressList, relationGroupList, parentId)); }
public void AddError(IObject association, RoleType roleType, string errorMessage, params object[] messageParam) { var error = new DerivationErrorGeneric(this, new DerivationRelation(association, roleType), errorMessage, messageParam); this.AddError(error); }
public SetRoleMaxHPEvent(RoleType role, int maxHP) { Role = role; MaxHP = maxHP; }
public MatFiles(T page, RoleType roleType, params string[] scopes) : base(page.Driver, roleType, scopes) => this.Page = page;
/// <summary> /// Get a <see cref="RoleType">role's</see> <see cref="Color"/>. /// </summary> /// <param name="role">The <see cref="RoleType"/> to get the color of.</param> /// <returns>The <see cref="Color"/> of the role.</returns> public static Color GetColor(this RoleType role) => role == RoleType.None ? Color.white : CharacterClassManager._staticClasses.Get(role).classColor;
public MatFiles(IWebDriver driver, RoleType roleType, params string[] scopes) : base(driver) => this.Selector = By.XPath($".//a-mat-files{this.ByScopesPredicate(scopes)}//*[@data-allors-roletype='{roleType.IdAsString}']");
/// <summary> /// Get a <see cref="RoleType">role's</see> <see cref="Side"/>. /// </summary> /// <param name="role">The <see cref="RoleType"/> to check the side of.</param> /// <returns><see cref="Side"/>.</returns> public static Side GetSide(this RoleType role) => role.GetTeam().GetSide();
public List <Openings> OpeningJobsByRole(RoleType Role) { return(OpeningsList.Where(x => x.Role == Role).ToList()); }
/// <summary> /// Saves modified user data into the ASP Net Identity database /// </summary> public void AddUser(string firstName, string lastName, string userName, string email, string password, RoleType role) { var anotherUser = UserManager.FindByNameAsync(userName).Result; // Add if (anotherUser != null) { throw new Exceptions.Validation.ValidationException(Resources.Resources.Register_EmailAlreadyExists, false); } var user = new AspNetIdentityUser() { FirstName = firstName, LastName = lastName, Email = email, UserName = userName }; Call(UserManager.CreateAsync(user, password)); Call(UserManager.AddToRoleAsync(user, role.Name())); AspNetIdentityDbContext.SaveChanges(); }
/// ----------------------------------------------------------------------------- /// <summary> /// Reads a RoleInfo from an XmlReader /// </summary> /// <param name="reader">The XmlReader to use</param> /// ----------------------------------------------------------------------------- public void ReadXml(XmlReader reader) { //Set status to approved by default Status = RoleStatus.Approved; while (reader.Read()) { if (reader.NodeType == XmlNodeType.EndElement) { break; } if (reader.NodeType == XmlNodeType.Whitespace) { continue; } if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name.ToLowerInvariant()) { case "role": break; case "rolename": RoleName = reader.ReadElementContentAsString(); break; case "description": Description = reader.ReadElementContentAsString(); break; case "billingfrequency": BillingFrequency = reader.ReadElementContentAsString(); if (string.IsNullOrEmpty(BillingFrequency)) { BillingFrequency = "N"; } break; case "billingperiod": BillingPeriod = reader.ReadElementContentAsInt(); break; case "servicefee": ServiceFee = reader.ReadElementContentAsFloat(); if (ServiceFee < 0) { ServiceFee = 0; } break; case "trialfrequency": TrialFrequency = reader.ReadElementContentAsString(); if (string.IsNullOrEmpty(TrialFrequency)) { TrialFrequency = "N"; } break; case "trialperiod": TrialPeriod = reader.ReadElementContentAsInt(); break; case "trialfee": TrialFee = reader.ReadElementContentAsFloat(); if (TrialFee < 0) { TrialFee = 0; } break; case "ispublic": IsPublic = reader.ReadElementContentAsBoolean(); break; case "autoassignment": AutoAssignment = reader.ReadElementContentAsBoolean(); break; case "rsvpcode": RSVPCode = reader.ReadElementContentAsString(); break; case "iconfile": IconFile = reader.ReadElementContentAsString(); break; case "issystemrole": IsSystemRole = reader.ReadElementContentAsBoolean(); break; case "roletype": switch (reader.ReadElementContentAsString()) { case "adminrole": _RoleType = RoleType.Administrator; break; case "registeredrole": _RoleType = RoleType.RegisteredUser; break; case "subscriberrole": _RoleType = RoleType.Subscriber; break; case "unverifiedrole": _RoleType = RoleType.UnverifiedUser; break; default: _RoleType = RoleType.None; break; } _RoleTypeSet = true; break; case "securitymode": switch (reader.ReadElementContentAsString()) { case "securityrole": SecurityMode = SecurityMode.SecurityRole; break; case "socialgroup": SecurityMode = SecurityMode.SocialGroup; break; case "both": SecurityMode = SecurityMode.Both; break; } break; case "status": switch (reader.ReadElementContentAsString()) { case "pending": Status = RoleStatus.Pending; break; case "disabled": Status = RoleStatus.Disabled; break; default: Status = RoleStatus.Approved; break; } break; default: if (reader.NodeType == XmlNodeType.Element && !String.IsNullOrEmpty(reader.Name)) { reader.ReadElementContentAsString(); } break; } } } }
public MaterialFiles(IWebDriver driver, RoleType roleType) : base(driver) { this.Selector = By.CssSelector($"a-mat-files *[data-allors-roletype='{roleType.IdAsNumberString}']"); }
[Test] public void Test_LoadRoleTypes() { TestTaxonomy_IFRS_2004_06_15 s = new TestTaxonomy_IFRS_2004_06_15(); s.Load(IFRS_FILE); int errors = 0; s.LoadRoleTypes(out errors); Assert.AreEqual(0, errors); Assert.AreEqual(15, s.roleTypes.Count, s.roleTypes.Count.ToString() + " found. expected 15"); Assert.IsTrue(s.roleTypes.ContainsKey("http://www.xbrl.org/2003/frta/role/restated"), "http://www.xbrl.org/2003/frta/role/restated not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetClassified"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetClassified not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetLiquidity"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetLiquidity not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetNetAssets"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetNetAssets not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByFunction"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByFunction not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByNature"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByNature not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsDirect"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsDirect not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsIndirect"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsIndirect not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/Equity"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/Equity not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/AccountingPolicies"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/AccountingPolicies not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/ExplanatoryDisclosures"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/ExplanatoryDisclosures not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/Classes"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/Classes not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/CurrentNonCurrent"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/CurrentNonCurrent not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/NetGross"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/NetGross not found"); Assert.IsTrue(s.roleTypes.ContainsKey("http://xbrl.iasb.org/int/fr/ifrs/gp/role/TypeEnumerations"), "http://xbrl.iasb.org/int/fr/ifrs/gp/role/TypeEnumerations not found"); RoleType t = s.roleTypes["http://www.xbrl.org/2003/frta/role/restated"] as RoleType; TestRoleType rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("restated", rt.Id); Assert.AreEqual("http://www.xbrl.org/2003/frta/role/restated", rt.Uri); Assert.AreEqual(string.Empty, rt.Definition); Assert.AreEqual(1, rt.WhereUsed.Count); Assert.AreEqual("link:label", rt.WhereUsed[0]); // BalanceSheetClassified t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetClassified"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("BalanceSheetClassified", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetClassified", rt.Uri); Assert.AreEqual("Balance Sheet, Classified Format", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // BalanceSheetLiquidity t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetLiquidity"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("BalanceSheetLiquidity", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetLiquidity", rt.Uri); Assert.AreEqual("Balance Sheet, Order of Liquidity Format", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // BalanceSheetNetAssets t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetNetAssets"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("BalanceSheetNetAssets", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetNetAssets", rt.Uri); Assert.AreEqual("Balance Sheet, Net Assets Format", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // IncomeStatementByFunction t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByFunction"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("IncomeStatementByFunction", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByFunction", rt.Uri); Assert.AreEqual("Income Statement, By Function Format", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // IncomeStatementByNature t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByNature"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("IncomeStatementByNature", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/IncomeStatementByNature", rt.Uri); Assert.AreEqual("Income Statement, By Nature Format", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // CashFlowsDirect t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsDirect"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("CashFlowsDirect", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsDirect", rt.Uri); Assert.AreEqual("Cash Flows, Direct Method", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // CashFlowsIndirect t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsIndirect"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("CashFlowsIndirect", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/CashFlowsIndirect", rt.Uri); Assert.AreEqual("Cash Flows, Indirect Method", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // Equity t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/Equity"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("Equity", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/Equity", rt.Uri); Assert.AreEqual("Statement of Changes in Equity", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // AccountingPolicies t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/AccountingPolicies"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("AccountingPolicies", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/AccountingPolicies", rt.Uri); Assert.AreEqual("Accounting Policies", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // ExplanatoryDisclosures t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/ExplanatoryDisclosures"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("ExplanatoryDisclosures", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/ExplanatoryDisclosures", rt.Uri); Assert.AreEqual("Explanatory Disclosures", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // Classes t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/Classes"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("Classes", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/Classes", rt.Uri); Assert.AreEqual("Classes", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // CurrentNonCurrent t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/CurrentNonCurrent"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("CurrentNonCurrent", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/CurrentNonCurrent", rt.Uri); Assert.AreEqual("Current/Non Current Breakdown", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // NetGross t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/NetGross"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("NetGross", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/NetGross", rt.Uri); Assert.AreEqual("Net/Gross Breakdown", rt.Definition); Assert.AreEqual(2, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); Assert.AreEqual("link:calculationLink", rt.WhereUsed[1]); // NetGross t = s.roleTypes["http://xbrl.iasb.org/int/fr/ifrs/gp/role/TypeEnumerations"] as RoleType; rt = new TestRoleType(t); Assert.IsNotNull(rt); Assert.AreEqual("TypeEnumerations", rt.Id); Assert.AreEqual("http://xbrl.iasb.org/int/fr/ifrs/gp/role/TypeEnumerations", rt.Uri); Assert.AreEqual("Type Enumerations", rt.Definition); Assert.AreEqual(1, rt.WhereUsed.Count); Assert.AreEqual("link:presentationLink", rt.WhereUsed[0]); }
/// <summary> /// Initializes a new instance of the <see cref="EscapingEventArgs"/> class. /// </summary> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="newRole"><inheritdoc cref="NewRole"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public EscapingEventArgs(Player player, RoleType newRole, bool isAllowed = true) { Player = player; NewRole = newRole; IsAllowed = isAllowed; }
/// <summary> /// Saves modified user data into the ASP Net Identity database /// </summary> public void UpdateUser(string userId, string firstName, string lastName, string userName, string email, string password, RoleType role) { var user = UserManager.FindByIdAsync(userId).Result; if (user == null) { throw new EntityNotFoundException(CallContext.ResourceUri, typeof(AspNetIdentityUser), new[] { userId }, LogLevel.Error); } var anotherUser = UserManager.FindByNameAsync(userName).Result; if (anotherUser != null && string.Compare(anotherUser.Id, userId, true) != 0) { throw new ValidationException(Resources.Resources.Register_EmailAlreadyExists, false); } user.FirstName = firstName; user.LastName = lastName; user.Email = email; user.UserName = userName; Call(UserManager.UpdateAsync(user)); // Password if (!string.IsNullOrEmpty(password)) { Call(UserManager.RemovePasswordAsync(user)); Call(UserManager.AddPasswordAsync(user, password)); } // Roles var roles = UserManager.GetRolesAsync(user).Result; if (!roles.SequenceEqual(new[] { role.Name() })) { Call(UserManager.RemoveFromRolesAsync(user, roles.ToArray())); Call(UserManager.AddToRoleAsync(user, role.Name())); } AspNetIdentityDbContext.SaveChanges(); }
public PlayerInfo OnInit(PlayerData _playerData) { roleType = _playerData.RoleType; return(this); }
public async Task <bool> IsPermitted(string userId, RoleType roleType) => await database.UserRoleRepository.Find(ur => ur.UserId == userId && ur.Role.RoleType == roleType) != null;
public async Task <bool> RoleExists(RoleType roleType) => await database.RoleRepository.Find(r => r.RoleType == roleType) != null;
/// <summary> /// Defines that usage of this command is restricted to members with specified permissions. This check also verifies that the bot has the same permissions. /// </summary> /// <param name="roleType">Role required to execute this command.</param> public RequireCustomRole(RoleType roleType) { this.SpecifiedRole = roleType; }
public void CreateRole(RoleType role) { RoleManager.CreateAsync(new AspNetIdentityRole(role)).Wait(); }