public UserRoleDto[] Execute([NotNull] GetRolesByProjectQuery dataQuery) { if (dataQuery == null) { throw new ArgumentNullException(nameof(dataQuery)); } if (!_userAuthorityValidator.HasUserAuthorities( _userPrincipal.Info.Id, new[] { Authorities.UI.Project.Settings.ViewAccessControl }, dataQuery.ProjectId)) { throw new UnauthorizedAccessException(); } var roles = _roleProvider.Get(dataQuery.ProjectId); var spec = new RoleRenderer().GetSpec(); var userRolesDto = roles.Select(_ => spec.Invoke(_)).ToArray(); foreach (var userRole in userRolesDto) { var groupInfo = _solutionGroupManager.GetBySid(userRole.Sid); userRole.GroupName = groupInfo.GroupName; } return(userRolesDto.ToArray()); }
public bool Activate(Guid token) { if (!Guid.Empty.Equals(token)) { if (resetTokens.ContainsKey(token)) { IIdentityProvider idProv = IdentityManager.Instance.GetProvider(ctx); UserIdentityBase userId = idProv.Get(resetTokens[token].Token); if (userId != null && userId.UserState != UserState.Dead) { resetTokens.Remove(token); userId.UserState = UserState.Active; if (idProv.Update(userId)) { IRoleProvider roles = AuthorizationManager.Instance.GetRoleProvider(ctx); if (roles != null) { Role r = roles.Get(new Guid("a55c4810-de06-466e-8f30-4f02b138186f")); if (r != null) { return(roles.AddToRole(r, userId)); } } } } } } return(false); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "SiteAlias"), SiteUtils.SiteAliasCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "SiteAlias"), SiteUtils.SiteAliasDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "SiteAlias"), SiteUtils.SiteAliasGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "SiteAlias"), SiteUtils.SiteAliasUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "SiteAliasScheme"), SiteUtils.SiteAliasSchemeCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "SiteAliasScheme"), SiteUtils.SiteAliasSchemeDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "SiteAliasScheme"), SiteUtils.SiteAliasSchemeGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "SiteAliasScheme"), SiteUtils.SiteAliasSchemeUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "Site"), SiteUtils.SiteCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "Site"), SiteUtils.SiteDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "Site"), SiteUtils.SiteGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "Site"), SiteUtils.SiteUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "TaxaCommonName"), TaxonomyUtils.TaxaCommonNameCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "TaxaCommonName"), TaxonomyUtils.TaxaCommonNameGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "TaxaCommonName"), TaxonomyUtils.TaxaCommonNameUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "TaxaCommonName"), TaxonomyUtils.TaxaCommonNameDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "TaxaUnit"), TaxonomyUtils.TaxaUnitCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "TaxaUnit"), TaxonomyUtils.TaxaUnitGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "TaxaUnit"), TaxonomyUtils.TaxaUnitUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "TaxaUnit"), TaxonomyUtils.TaxaUnitDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "Taxonomy"), TaxonomyUtils.TaxonomyCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "Taxonomy"), TaxonomyUtils.TaxonomyGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "Taxonomy"), TaxonomyUtils.TaxonomyUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "Taxonomy"), TaxonomyUtils.TaxonomyDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
private void CreateAdminRole() { var adminRole = _roleProvider.Get(null, "sdl_admin"); var isEmpty = adminRole.Sid == null; var adminRoleGroup = _roleProvider.TryCreateGroup(adminRole); adminRole.Sid = adminRoleGroup.Sid; _projectRepository.Save(); if (isEmpty) { _roleProvider.AddUser(adminRole.Id, WindowsIdentity.GetCurrent().User?.Value); } }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "UserAffiliation"), UserAffiliationUtils.AddPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "UserAffiliation"), UserAffiliationUtils.GetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "UserAffiliation"), UserAffiliationUtils.RemovePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
public UserDto[] Execute(GetUsersByProjectQuery dataQuery) { if (dataQuery == null) { throw new ArgumentNullException(nameof(dataQuery)); } var canViewProjectUsers = _userAuthorityValidator.HasUserAuthorities( _userPrincipal.Info.Id, new[] { Authorities.UI.Project.ProjectsList.View }, dataQuery.ProjectId); if (!canViewProjectUsers) { throw new UnauthorizedAccessException(); } var roles = _roleProvider.Get(dataQuery.ProjectId); var users = new List <Users>(); // ReSharper disable once LoopCanBePartlyConvertedToQuery foreach (var role in roles) { var roleUsers = _userRoleProvider.GetUsersByRole(role); users.AddRange(roleUsers); } var userDtos = users .Select(_ => new UserDto { CurrentCulture = null, DisplayName = _.DisplayName, Email = _.Email, Id = _.Id, Login = _.Login, Sid = _.Sid }) .ToArray(); return(userDtos); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = EntityBundleUtils.EntityBundleCreatePermission; Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = EntityBundleUtils.EntityBundleDeletePermission; Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = EntityBundleUtils.EntityBundleGetPermission; Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = EntityBundleUtils.EntityBundleUpdatePermission; Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "Project"), ProjectUtils.ProjectCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "Project"), ProjectUtils.ProjectDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "Project"), ProjectUtils.ProjectGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "Project"), ProjectUtils.ProjectUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "ProjectStatusType"), ProjectUtils.ProjectStatusTypeCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "ProjectStatusType"), ProjectUtils.ProjectStatusTypeDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "ProjectStatusType"), ProjectUtils.ProjectStatusTypeGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "ProjectStatusType"), ProjectUtils.ProjectStatusTypeUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "InstrumentType"), InstrumentUtils.InstrumentTypeCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "InstrumentType"), InstrumentUtils.InstrumentTypeGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "InstrumentType"), InstrumentUtils.InstrumentTypeUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "InstrumentType"), InstrumentUtils.InstrumentTypeDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "InstrumentFamily"), InstrumentUtils.InstrumentFamilyCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "InstrumentFamily"), InstrumentUtils.InstrumentFamilyGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "InstrumentFamily"), InstrumentUtils.InstrumentFamilyUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "InstrumentFamily"), InstrumentUtils.InstrumentFamilyDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "Instrument"), InstrumentUtils.InstrumentCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "Instrument"), InstrumentUtils.InstrumentGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "Instrument"), InstrumentUtils.InstrumentUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "Instrument"), InstrumentUtils.InstrumentDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "SensorType"), InstrumentUtils.SensorTypeCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "SensorType"), InstrumentUtils.SensorTypeGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "SensorType"), InstrumentUtils.SensorTypeUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "SensorType"), InstrumentUtils.SensorTypeDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "Sensor"), InstrumentUtils.SensorCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "Sensor"), InstrumentUtils.SensorGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "Sensor"), InstrumentUtils.SensorUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "Sensor"), InstrumentUtils.SensorDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "InstrumentKnownArchetype"), InstrumentUtils.InstrumentKnownArchetypeCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "InstrumentKnownArchetype"), InstrumentUtils.InstrumentKnownArchetypeGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "InstrumentKnownArchetype"), InstrumentUtils.InstrumentKnownArchetypeUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "InstrumentKnownArchetype"), InstrumentUtils.InstrumentKnownArchetypeDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "OrganizationHierarchy"), OrganizationHierarchyUtils.OrganizationHierarchyCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "OrganizationHierarchy"), OrganizationHierarchyUtils.OrganizationHierarchyDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "OrganizationHierarchy"), OrganizationHierarchyUtils.OrganizationHierarchyGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "OrganizationHierarchy"), OrganizationHierarchyUtils.OrganizationHierarchyUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "OrganizationHierarchyMembership"), OrganizationHierarchyUtils.OrganizationHierarchyMembershipAddPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "OrganizationHierarchyMembership"), OrganizationHierarchyUtils.OrganizationHierarchyMembershipGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "OrganizationHierarchyMembership"), OrganizationHierarchyUtils.OrganizationHierarchyMembershipMovePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "OrganizationHierarchyMembership"), OrganizationHierarchyUtils.OrganizationHierarchyMembershipRemovePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "OrganizationAlias"), OrganizationUtils.OrganizationAliasCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "OrganizationAlias"), OrganizationUtils.OrganizationAliasDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "OrganizationAlias"), OrganizationUtils.OrganizationAliasGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "OrganizationAlias"), OrganizationUtils.OrganizationAliasUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "OrganizationAliasScheme"), OrganizationUtils.OrganizationAliasSchemeCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "OrganizationAliasScheme"), OrganizationUtils.OrganizationAliasSchemeDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "OrganizationAliasScheme"), OrganizationUtils.OrganizationAliasSchemeGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "OrganizationAliasScheme"), OrganizationUtils.OrganizationAliasSchemeUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "Organization"), OrganizationUtils.OrganizationCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "Organization"), OrganizationUtils.OrganizationDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "Organization"), OrganizationUtils.OrganizationGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "Organization"), OrganizationUtils.OrganizationUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }
static void Grant(UserSecurityContext context) { IRoleProvider perms = AuthorizationManager.Instance.GetRoleProvider(context); Permission p; Role r = perms.Get(SecurityUtils.AdminRole); //--field activity p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "FieldActivity"), FieldActivityUtils.FieldActivityCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "FieldActivity"), FieldActivityUtils.FieldActivityDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "FieldActivity"), FieldActivityUtils.FieldActivityGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "FieldActivity"), FieldActivityUtils.FieldActivityUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); //--field trip p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "FieldTrip"), FieldActivityUtils.FieldTripCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "FieldTrip"), FieldActivityUtils.FieldTripDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "FieldTrip"), FieldActivityUtils.FieldTripGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "FieldTrip"), FieldActivityUtils.FieldTripUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); //--sample event p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "SampleEvent"), FieldActivityUtils.SampleEventCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "SampleEvent"), FieldActivityUtils.SampleEventDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "SampleEvent"), FieldActivityUtils.SampleEventGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "SampleEvent"), FieldActivityUtils.SampleEventUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); //--field team p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "FieldTeam"), FieldActivityUtils.FieldTeamCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "FieldTeam"), FieldActivityUtils.FieldTeamGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "FieldTeam"), FieldActivityUtils.FieldTeamUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "FieldTeam"), FieldActivityUtils.FieldTeamDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); //--FT member role p = new Permission(PermissionUtils.PermissionName(OperationType.Create, "FieldTeamMemberRole"), FieldActivityUtils.FieldTeamMemberRoleCreatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Retrive, "FieldTeamMemberRole"), FieldActivityUtils.FieldTeamMemberRoleGetPermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Update, "FieldTeamMemberRole"), FieldActivityUtils.FieldTeamMemberRoleUpdatePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); p = new Permission(PermissionUtils.PermissionName(OperationType.Delete, "FieldTeamMemberRole"), FieldActivityUtils.FieldTeamMemberRoleDeletePermissionId); Console.WriteLine("Granting Permission: " + p.Name); perms.AddToRole(r, p); }