Exemple #1
0
        public Task <IEnumerable <UserAreaMicroSummary> > ExecuteAsync(GetAllQuery <UserAreaMicroSummary> query, IExecutionContext executionContext)
        {
            var areas   = _userAreaRepository.GetAll().OrderBy(u => u.Name);
            var results = Mapper.Map <IEnumerable <UserAreaMicroSummary> >(areas);

            return(Task.FromResult(results));
        }
Exemple #2
0
        public IEnumerable <AdminModule> GetModules()
        {
            foreach (var userArea in _userAreaRepository.GetAll())
            {
                var routeLibrary = new ModuleRouteLibrary(SlugFormatter.ToSlug(userArea.Name) + "-users");

                var module = new AdminModule()
                {
                    AdminModuleCode = "COFUSR" + userArea.UserAreaCode,
                    Title           = userArea.Name + " Users",
                    Description     = "Manage users in the " + userArea.Name + " user area.",
                    MenuCategory    = AdminModuleMenuCategory.Settings,
                    PrimaryOrdering = AdminModuleMenuPrimaryOrdering.Secondry,
                    Url             = routeLibrary.CreateAngularRoute()
                };

                if (userArea is CofoundryAdminUserArea)
                {
                    module.RestrictedToPermission = new CofoundryUserAdminModulePermission();
                }
                else
                {
                    module.RestrictedToPermission = new NonCofoundryUserAdminModulePermission();
                }

                yield return(module);
            }
        }
        public void RegisterRoutes(RouteCollection routes)
        {
            var controllerNamespace = new string[] { typeof(UsersRouteRegistration).Namespace };

            foreach (var userArea in _userAreaRepository.GetAll())
            {
                var routePrefix    = SlugFormatter.ToSlug(userArea.Name);
                var routeLibrary   = new ModuleRouteLibrary(routePrefix);
                var jsRouteLibrary = new ModuleJsRouteLibrary(routeLibrary);

                routes.MapRoute(
                    "Users Cofoundry Admin Module - " + userArea.Name,
                    RouteConstants.AdminAreaPrefix + "/" + routePrefix + "-users",
                    new { controller = "UsersModule", action = "Index", userArea = userArea, Area = RouteConstants.AdminAreaName },
                    controllerNamespace
                    );
            }
        }