예제 #1
0
        private static async Task updateResourceGroupFromTemplate(App app, AppVersion version, AppApiGroupTemplateModel groupTemplate)
        {
            var modCategory = await app.TryAddModCategory(new ModifierCategoryName(groupTemplate.ModCategory));

            var groupName     = new ResourceGroupName(groupTemplate.Name);
            var resourceGroup = await version.AddOrUpdateResourceGroup(groupName, modCategory);

            if (groupTemplate.IsAnonymousAllowed)
            {
                await resourceGroup.AllowAnonymous();
            }
            else
            {
                await resourceGroup.DenyAnonymous();
            }
            var allowedGroupRoles = await rolesFromNames(app, groupTemplate.Roles.Select(r => new AppRoleName(r)));

            await resourceGroup.SetRoleAccess(allowedGroupRoles);

            foreach (var actionTemplate in groupTemplate.ActionTemplates)
            {
                await updateResourceFromTemplate(app, resourceGroup, actionTemplate);
            }
        }