private static bool IsSystemAdministrator (BasicAuthority authority) { foreach (BasicPersonRole role in authority.SystemPersonRoles) { if (role.Type == RoleType.SystemAdmin) { return true; } } return false; }
public static BasicGeography[] GetNodesInAuthorityForOrganization (BasicAuthority authority, int organizationId, RoleType[] roleTypes) { Organizations organizationLine = Organization.FromIdentity(organizationId).GetLine(); // Build lookup tables var orgLookup = new Dictionary<int, BasicOrganization>(); foreach (BasicOrganization organization in organizationLine) { orgLookup[organization.OrganizationId] = organization; } var roleLookup = new Dictionary<RoleType, bool>(); foreach (RoleType roleType in roleTypes) { roleLookup[roleType] = true; } // Create list var result = new List<BasicGeography>(); if (authority.AllPersonRoles.Length > 0) { Dictionary<int, BasicGeography> geoDict = GeographyCache.GetGeographyHashtable(Geography.RootIdentity); foreach (BasicPersonRole role in authority.AllPersonRoles) { if (orgLookup.ContainsKey(role.OrganizationId)) { if (roleLookup.ContainsKey(role.Type)) { result.Add(geoDict[role.GeographyId]); } } } } return result.ToArray(); }
public static Authority FromBasic (BasicAuthority basic) { return new Authority(basic); }
public static BasicGeography[] GetNodesInAuthorityForOrganization (BasicAuthority authority, int organizationId) { return GetNodesInAuthorityForOrganization(authority, organizationId, RoleTypes.AllRoleTypes); }
private Authority (BasicAuthority basic) : base(basic.PersonId, basic.SystemPersonRoles, basic.OrganizationPersonRoles, basic.LocalPersonRoles) { }