<commit_before>namespace Trifolia.DB.Migrations
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.IO;
    using System.Linq;
    using System.Reflection;

    internal sealed class Configuration : DbMigrationsConfiguration<Trifolia.DB.TrifoliaDatabase>
    {
        private AppSecurable[] appSecurables;
        private Role[] roles;

        public Configuration()
        {
            AutomaticMigrationsEnabled = false;

            this.appSecurables = new AppSecurable[]
            {
                new AppSecurable() { Name = "TemplateList", DisplayName = "List Templates", Description = "NULL" },
                new AppSecurable() { Name = "IGManagementList", DisplayName = "List Implementation Guides", Description = "NULL" },
                new AppSecurable() { Name = "LandingPage", DisplayName = "Landing Page", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuideEdit", DisplayName = "Edit Implementation Guide", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuideEditBookmarks", DisplayName = "Edit Implementation Guide Bookmarks", Description = "" },
                new AppSecurable() { Name = "ImplementationGuideNotes", DisplayName = "View Implementation Guide Notes", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuidePrimitives", DisplayName = "View Implementation Guide Primitives", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuideAuditTrail", DisplayName = "View Implementation Guide Audit Trail", Description = "NULL" },
                new AppSecurable() { Name = "ValueSetList", DisplayName = "List Value Sets", Description = "NULL" },
                new AppSecurable() { Name = "ValueSetEdit", DisplayName = "Edit Value Sets", Description = "NULL" },
                new AppSecurable() { Name = "CodeSystemList", DisplayName = "List Code Systems", Description = "NULL" },
                new AppSecurable() { Name = "CodeSystemEdit", DisplayName = "Edit Code Systems", Description = "NULL" },
                new AppSecurable() { Name = "ExportWordDocuments", DisplayName = "Export MS Word Documents", Description = "NULL" },
                new AppSecurable() { Name = "ExportVocabulary", DisplayName = "Export Vocabulary", Description = "NULL" },
                new AppSecurable() { Name = "ExportSchematron", DisplayName = "Export Schematron", Description = "NULL" },
                new AppSecurable() { Name = "TemplateEdit", DisplayName = "Edit Templates", Description = "NULL" },
                new AppSecurable() { Name = "TemplateCopy", DisplayName = "Copy Templates", Description = "NULL" },
                new AppSecurable() { Name = "TemplateDelete", DisplayName = "Delete Templates", Description = "NULL" },
                new AppSecurable() { Name = "Admin", DisplayName = "Admin Functions", Description = "NULL" },
                new AppSecurable() { Name = "ReportTemplateReview", DisplayName = "View Template Review Report", Description = "NULL" },
                new AppSecurable() { Name = "ReportTemplateCompliance", DisplayName = "View Template Compliance Report", Description = "NULL" },
                new AppSecurable() { Name = "OrganizationList", DisplayName = "Organization List", Description = "NULL" },
                new AppSecurable() { Name = "OrganizationDetails", DisplayName = "Organization Details", Description = "NULL" },
                new AppSecurable() { Name = "PublishSettings", DisplayName = "Publish Settings", Description = "NULL" },
                new AppSecurable() { Name = "ExportXML", DisplayName = "Export Templates XML", Description = "Ability to export templates to an XML format" },
                new AppSecurable() { Name = "IGFileManagement", DisplayName = "IG File Management", Description = "Allows users to upload/update/remove files associated with an implementation guide." },
                new AppSecurable() { Name = "IGFileView", DisplayName = "IG File View", Description = "Allows users view files associated with implementation guides they have permission to access." },
                new AppSecurable() { Name = "ExportGreen", DisplayName = "Export green artifacts", Description = "NULL" },
                new AppSecurable() { Name = "TerminologyOverride", DisplayName = "Terminology Override", Description = "Ability to override locked value sets and code systems." },
                new AppSecurable() { Name = "GreenModel", DisplayName = "Green Modeling", Description = "Allows user to create, edit and delete green models for templates." },
                new AppSecurable() { Name = "TemplateMove", DisplayName = "Move Templates", Description = "Ability to move a template from one implementation guide to another" },
                new AppSecurable() { Name = "WebIG", DisplayName = "Web-based IG", Description = "Ability to view an implementation guide's web-based IG" },
                new AppSecurable() { Name = "Import", DisplayName = "Import", Description = "The ability to import implementation guides and templates into Trifolia" }
            };

            this.roles = new Role[] {
                new Role() { Name = "Administrators", IsDefault = true, IsAdmin = true },
                new Role() { Name = "Template Authors", IsDefault = false, IsAdmin = false },
                new Role() { Name = "Users", IsDefault = false, IsAdmin = false },
                new Role() { Name = "IG Admins", IsDefault = false, IsAdmin = false },
                new Role() { Name = "Terminology Admins", IsDefault = false, IsAdmin = false }
            };
        }

        private void AssignSecurableToRole(Trifolia.DB.TrifoliaDatabase context, string securableName, string roleName)
        {
            AppSecurable appSecurable = this.appSecurables.SingleOrDefault(y => y.Name == securableName);
            Role role = this.roles.SingleOrDefault(y => y.Name == roleName);

            if (context.RoleAppSecurables.FirstOrDefault(y => y.Role.Name == roleName && y.AppSecurable.Name == securableName) != null)
                return;

            context.RoleAppSecurables.Add(new RoleAppSecurable()
            {<commit_msg>Changing seed configuration to set TemplateAuthors as default, rather than Administrators<commit_after>namespace Trifolia.DB.Migrations
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.IO;
    using System.Linq;
    using System.Reflection;

    internal sealed class Configuration : DbMigrationsConfiguration<Trifolia.DB.TrifoliaDatabase>
    {
        private AppSecurable[] appSecurables;
        private Role[] roles;

        public Configuration()
        {
            AutomaticMigrationsEnabled = false;

            this.appSecurables = new AppSecurable[]
            {
                new AppSecurable() { Name = "TemplateList", DisplayName = "List Templates", Description = "NULL" },
                new AppSecurable() { Name = "IGManagementList", DisplayName = "List Implementation Guides", Description = "NULL" },
                new AppSecurable() { Name = "LandingPage", DisplayName = "Landing Page", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuideEdit", DisplayName = "Edit Implementation Guide", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuideEditBookmarks", DisplayName = "Edit Implementation Guide Bookmarks", Description = "" },
                new AppSecurable() { Name = "ImplementationGuideNotes", DisplayName = "View Implementation Guide Notes", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuidePrimitives", DisplayName = "View Implementation Guide Primitives", Description = "NULL" },
                new AppSecurable() { Name = "ImplementationGuideAuditTrail", DisplayName = "View Implementation Guide Audit Trail", Description = "NULL" },
                new AppSecurable() { Name = "ValueSetList", DisplayName = "List Value Sets", Description = "NULL" },
                new AppSecurable() { Name = "ValueSetEdit", DisplayName = "Edit Value Sets", Description = "NULL" },
                new AppSecurable() { Name = "CodeSystemList", DisplayName = "List Code Systems", Description = "NULL" },
                new AppSecurable() { Name = "CodeSystemEdit", DisplayName = "Edit Code Systems", Description = "NULL" },
                new AppSecurable() { Name = "ExportWordDocuments", DisplayName = "Export MS Word Documents", Description = "NULL" },
                new AppSecurable() { Name = "ExportVocabulary", DisplayName = "Export Vocabulary", Description = "NULL" },
                new AppSecurable() { Name = "ExportSchematron", DisplayName = "Export Schematron", Description = "NULL" },
                new AppSecurable() { Name = "TemplateEdit", DisplayName = "Edit Templates", Description = "NULL" },
                new AppSecurable() { Name = "TemplateCopy", DisplayName = "Copy Templates", Description = "NULL" },
                new AppSecurable() { Name = "TemplateDelete", DisplayName = "Delete Templates", Description = "NULL" },
                new AppSecurable() { Name = "Admin", DisplayName = "Admin Functions", Description = "NULL" },
                new AppSecurable() { Name = "ReportTemplateReview", DisplayName = "View Template Review Report", Description = "NULL" },
                new AppSecurable() { Name = "ReportTemplateCompliance", DisplayName = "View Template Compliance Report", Description = "NULL" },
                new AppSecurable() { Name = "OrganizationList", DisplayName = "Organization List", Description = "NULL" },
                new AppSecurable() { Name = "OrganizationDetails", DisplayName = "Organization Details", Description = "NULL" },
                new AppSecurable() { Name = "PublishSettings", DisplayName = "Publish Settings", Description = "NULL" },
                new AppSecurable() { Name = "ExportXML", DisplayName = "Export Templates XML", Description = "Ability to export templates to an XML format" },
                new AppSecurable() { Name = "IGFileManagement", DisplayName = "IG File Management", Description = "Allows users to upload/update/remove files associated with an implementation guide." },
                new AppSecurable() { Name = "IGFileView", DisplayName = "IG File View", Description = "Allows users view files associated with implementation guides they have permission to access." },
                new AppSecurable() { Name = "ExportGreen", DisplayName = "Export green artifacts", Description = "NULL" },
                new AppSecurable() { Name = "TerminologyOverride", DisplayName = "Terminology Override", Description = "Ability to override locked value sets and code systems." },
                new AppSecurable() { Name = "GreenModel", DisplayName = "Green Modeling", Description = "Allows user to create, edit and delete green models for templates." },
                new AppSecurable() { Name = "TemplateMove", DisplayName = "Move Templates", Description = "Ability to move a template from one implementation guide to another" },
                new AppSecurable() { Name = "WebIG", DisplayName = "Web-based IG", Description = "Ability to view an implementation guide's web-based IG" },
                new AppSecurable() { Name = "Import", DisplayName = "Import", Description = "The ability to import implementation guides and templates into Trifolia" }
            };

            this.roles = new Role[] {
                new Role() { Name = "Administrators", IsDefault = false, IsAdmin = true },
                new Role() { Name = "Template Authors", IsDefault = true, IsAdmin = false },
                new Role() { Name = "Users", IsDefault = false, IsAdmin = false },
                new Role() { Name = "IG Admins", IsDefault = false, IsAdmin = false },
                new Role() { Name = "Terminology Admins", IsDefault = false, IsAdmin = false }
            };
        }

        private void AssignSecurableToRole(Trifolia.DB.TrifoliaDatabase context, string securableName, string roleName)
        {
            AppSecurable appSecurable = this.appSecurables.SingleOrDefault(y => y.Name == securableName);
            Role role = this.roles.SingleOrDefault(y => y.Name == roleName);

            if (context.RoleAppSecurables.FirstOrDefault(y => y.Role.Name == roleName && y.AppSecurable.Name == securableName) != null)
                return;

            context.RoleAppSecurables.Add(new RoleAppSecurable()
            {
{'fraction_non_alphanumeric': 0.11148755121336275, 'fraction_numerical': 0.0, 'mean_word_length': 2.928505106778087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1545156', 'n_tokens_mistral': 3176, 'n_tokens_neox': 3034, 'n_words': 1010}