public async Task CreateSecurityProfiles(EnvironmentSeed seed, string accessToken)
        {
            var profiles = DefaultSecurityProfiles.Select(p =>
                                                          new SecurityProfile()
            {
                Name        = p.CustomRole.ToString(),
                ID          = p.CustomRole.ToString(),
                CustomRoles = p.CustomRoles == null ? new List <string>()
                {
                    p.CustomRole.ToString()
                } : p.CustomRoles.Append(p.CustomRole).Select(r => r.ToString()).ToList(),
                Roles = p.Roles
            }).ToList();

            profiles.Add(new SecurityProfile()
            {
                Roles = new List <ApiRole> {
                    ApiRole.FullAccess
                },
                Name = _fullAccessSecurityProfile,
                ID   = _fullAccessSecurityProfile
            });

            var profileCreateRequests = profiles.Select(p => _oc.SecurityProfiles.CreateAsync(p, accessToken));
            await Task.WhenAll(profileCreateRequests);
        }
Exemplo n.º 2
0
        public async Task CreateSecurityProfiles(string accessToken)
        {
            var profiles = DefaultSecurityProfiles.Select(p =>
                                                          new SecurityProfile()
            {
                Name        = p.ID.ToString(),
                ID          = p.ID.ToString(),
                CustomRoles = p.CustomRoles.Select(r => r.ToString()).ToList(),
                Roles       = p.Roles
            }).ToList();

            profiles.Add(new SecurityProfile()
            {
                Roles = new List <ApiRole> {
                    ApiRole.FullAccess
                },
                Name = _fullAccessSecurityProfile,
                ID   = _fullAccessSecurityProfile
            });

            var profileCreateRequests = profiles.Select(p => _oc.SecurityProfiles.SaveAsync(p.ID, p, accessToken));
            await Task.WhenAll(profileCreateRequests);
        }