Beispiel #1
0
 public void OnAuthorization(AuthorizationFilterContext context)
 {
     if (!_userContext.Has(_permission))
     {
         context.Result = new ForbidResult();
     }
 }
        public List <HomeScreenEnumeration> GetHomeScreenDisplays()
        {
            var homeScreenDisplayList = new List <HomeScreenEnumeration>();

            if (_userContext.Has(Permission.AccessGlobalSettings))
            {
                homeScreenDisplayList.Add(HomeScreenEnumeration.Global);
            }

            if (CloudOdsAdminAppSettings.Instance.Mode.SupportsMultipleInstances)
            {
                homeScreenDisplayList.Add(HomeScreenEnumeration.OdsInstances);
            }
            else
            {
                homeScreenDisplayList.Add(HomeScreenEnumeration.Settings);
            }

            return(homeScreenDisplayList);
        }
Beispiel #3
0
        public virtual List <HomeScreenDisplay <HomeScreenEnumeration> > GetHomeScreenDisplays()
        {
            var homeScreenDisplayList = new List <HomeScreenDisplay <HomeScreenEnumeration> >
            {
                new HomeScreenDisplay <HomeScreenEnumeration>
                {
                    IsEnabled  = true,
                    HomeScreen = HomeScreenEnumeration.OdsInstances
                },
                new HomeScreenDisplay <HomeScreenEnumeration>
                {
                    IsEnabled  = true,
                    HomeScreen = HomeScreenEnumeration.Settings
                },
                new HomeScreenDisplay <HomeScreenEnumeration>
                {
                    IsEnabled  = true,
                    HomeScreen = HomeScreenEnumeration.Global
                },
                new HomeScreenDisplay <HomeScreenEnumeration>
                {
                    IsEnabled  = true,
                    HomeScreen = HomeScreenEnumeration.Updates
                }
            };

            if (CloudOdsAdminAppSettings.Instance.Mode.SupportsMultipleInstances)
            {
                homeScreenDisplayList.Single(x =>
                                             x.HomeScreen == HomeScreenEnumeration.Settings).IsEnabled = false;
            }

            if (!_userContext.Has(Permission.AccessGlobalSettings))
            {
                homeScreenDisplayList.RemoveAll(x => x.HomeScreen == HomeScreenEnumeration.Global);
            }

            return(homeScreenDisplayList);
        }