// Load app claims

        // ###### OU and Tasks
        // OU
        /// Artist
        /// Publisher
        /// Customer
        /// Manager
        /// Employee
        // Tasks
        /// AlbumInfoEditor
        /// AlbumCreator
        /// CustomerInfoEditor
        /// PriceManager
        /// AlbumCoverCreator
        public static void LoadAppClaims()
        {
            var m = new Manager();

            string[] ous   = { "Artist", "Publisher", "Customer", "Manager", "Employee" };
            string[] tasks = { "AlbumInfoEditor", "AlbumCreator", "CustomerInfoEditor", "PriceManager", "AlbumCoverCreator" };
            string[] roles = { "Student", "Mentor" };
            if (m.AppClaimGetAll().Count() == 0)
            {
                foreach (var item in ous)
                {
                    var newItem = new AppClaimAdd();
                    newItem.ClaimType  = "OU";
                    newItem.ClaimValue = item;
                    m.AppClaimAdd(newItem);
                }


                foreach (var item in tasks)
                {
                    var newItem = new AppClaimAdd();
                    newItem.ClaimType  = "Task";
                    newItem.ClaimValue = item;
                    m.AppClaimAdd(newItem);
                }

                foreach (var item in roles)
                {
                    var newItem = new AppClaimAdd();
                    newItem.ClaimType  = "role";
                    newItem.ClaimValue = item;
                    m.AppClaimAdd(newItem);
                }
            }
        }
Ejemplo n.º 2
0
        // Load app claims

        public static void LoadAppClaims()
        {
            //// Remove the following statement when you are ready to
            //// actually ready to use this method
            //return;

            // Get a reference to the manager
            Manager m = new Manager();

            // If there are no claims, add them
            if (m.AppClaimGetAll().Count() == 0)
            {
                // Add claims here
                AppClaimAdd r1 = new AppClaimAdd();
                r1.ClaimType    = "role";
                r1.ClaimValue   = "AccountAdministrator";
                r1.ClaimTypeUri = "http://senecaflea.azurewebsites.net/role";
                r1.Description  = "Account Administrator";
                m.AppClaimAdd(r1);

                AppClaimAdd r2 = new AppClaimAdd();
                r2.ClaimType    = "role";
                r2.ClaimTypeUri = "http://senecaflea.azurewebsites.net/role";
                r2.ClaimValue   = "SenecaFleaAdministrator";
                r2.Description  = "Seneca Flea Administrator";
                m.AppClaimAdd(r2);

                AppClaimAdd r3 = new AppClaimAdd();
                r3.ClaimType    = "role";
                r3.ClaimTypeUri = "http://senecaflea.azurewebsites.net/role";
                r3.ClaimValue   = "User";
                r3.Description  = "A normal user who would be a seller or a buyer";
                m.AppClaimAdd(r3);
            }
        }
        // Load app claims

        public static void LoadAppClaims()
        {
            // Get a reference to the manager
            Manager m = new Manager();

            // If there are no claims, add them
            if (m.AppClaimGetAll().Count() == 0)
            {
                string[] tasks = { "ProjectView", "ProjectContribute" };
                string[] roles = { "User", "Member" };
                if (m.AppClaimGetAll().Count() == 0)
                {
                    foreach (var item in tasks)
                    {
                        var newItem = new AppClaimAdd();
                        newItem.ClaimType  = "task";
                        newItem.ClaimValue = item;
                        m.AppClaimAdd(newItem);
                    }

                    foreach (var item in roles)
                    {
                        var newItem = new AppClaimAdd();
                        newItem.ClaimType  = "role";
                        newItem.ClaimValue = item;
                        m.AppClaimAdd(newItem);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        // Load app claims

        public static void LoadAppClaims()
        {
            // Get a reference to the manager
            Manager m = new Manager();

            // If there are no claims, add them
            if (m.AppClaimGetAll().Count() == 0)
            {
                string[] ous   = { "sales", "marketing", "service", "toronto", "york", "london" };
                string[] tasks = { "manageEmployee", "addMusic", "editMusic" };
                string[] roles = { "customer", "employee" };
                if (m.AppClaimGetAll().Count() == 0)
                {
                    foreach (var item in ous)
                    {
                        var newItem = new AppClaimAdd();
                        newItem.ClaimType  = "ou";
                        newItem.ClaimValue = item;
                        m.AppClaimAdd(newItem);
                    }


                    foreach (var item in tasks)
                    {
                        var newItem = new AppClaimAdd();
                        newItem.ClaimType  = "task";
                        newItem.ClaimValue = item;
                        m.AppClaimAdd(newItem);
                    }

                    foreach (var item in roles)
                    {
                        var newItem = new AppClaimAdd();
                        newItem.ClaimType  = "role";
                        newItem.ClaimValue = item;
                        m.AppClaimAdd(newItem);
                    }
                }
            }
        }
        // Load app claims

        public static void LoadAppClaims()
        {
            // Get a reference to the manager
            Manager m = new Manager();

            // If there are no claims, add them
            if (m.AppClaimGetAll().Count() == 0)
            {
                // Add the app's allowed claims here

                // Employee Role
                var employee = new AppClaimAdd();
                employee.ClaimType   = ClaimTypes.Role;
                employee.ClaimValue  = "Employee";
                employee.Description = "Assigned to accounts for employees of the music business";
                m.AppClaimAdd(employee);

                // Customer Role
                var customer = new AppClaimAdd();
                customer.ClaimType   = ClaimTypes.Role;
                customer.ClaimValue  = "Customer";
                customer.Description = "Assigned to accounts for customers of the music business";
                m.AppClaimAdd(customer);

                // Department OU's
                var sales = new AppClaimAdd();
                sales.ClaimType   = "OU";
                sales.ClaimValue  = "Sales";
                sales.Description = "Assigned to employee accounts who work in the sales department";
                m.AppClaimAdd(sales);

                var customerService = new AppClaimAdd();
                customerService.ClaimType   = "OU";
                customerService.ClaimValue  = "Customer Service";
                customerService.Description = "Assigned to employee accounts who work in the customer service department";
                m.AppClaimAdd(customerService);

                var marketing = new AppClaimAdd();
                marketing.ClaimType   = "OU";
                marketing.ClaimValue  = "Marketing";
                marketing.Description = "Assigned to employee accounts who work in the marketing department";
                m.AppClaimAdd(marketing);

                // Location OU's
                var toronto = new AppClaimAdd();
                toronto.ClaimType   = "OU";
                toronto.ClaimValue  = "Toronto";
                toronto.Description = "Assigned to accounts working at the Toronto office";
                m.AppClaimAdd(toronto);

                var london = new AppClaimAdd();
                london.ClaimType   = "OU";
                london.ClaimValue  = "London";
                london.Description = "Assigned to accounts working at the London office";
                m.AppClaimAdd(london);

                var newYork = new AppClaimAdd();
                newYork.ClaimType   = "OU";
                newYork.ClaimValue  = "New York";
                newYork.Description = "Assigned to accounts working at the New York office";
                m.AppClaimAdd(newYork);

                // Tasks
                var purchase = new AppClaimAdd();
                purchase.ClaimType   = "Task";
                purchase.ClaimValue  = "Purchase";
                purchase.Description = "Assigned to customers purchasing music or music products";
                m.AppClaimAdd(purchase);

                var setPrice = new AppClaimAdd();
                setPrice.ClaimType   = "Task";
                setPrice.ClaimValue  = "Set Price";
                setPrice.Description = "Assigned to sales employees who can set the price of music products";
                m.AppClaimAdd(setPrice);

                var modifyEmployeeInfo = new AppClaimAdd();
                modifyEmployeeInfo.ClaimType   = "Task";
                modifyEmployeeInfo.ClaimValue  = "Modify Employee";
                modifyEmployeeInfo.Description = "Assigned to employees who are authorized to make changes to other employees";
                m.AppClaimAdd(modifyEmployeeInfo);
            }
        }