Пример #1
0
        public List <ApplicationMode> GetSupportedApplicationModes()
        {
            var applicationModes = new List <ApplicationMode>();

            var userRoles = identityCacheService.GetRole(ActiveUserName);

            var hasApplicationLevelRolle = userRoles.Any(lr => applicationLevelRollen.Contains(lr.Rolle));

            if (hasApplicationLevelRolle)
            {
                applicationModes.Add(ApplicationMode.Application);
            }

            var mandantNames         = mandantenService.GetCurrentMandanten().Select(mm => mm.MandantName);
            var hasMandantLevelRolle = userRoles.Any(lr => mandantLevelRollen.Contains(lr.Rolle) && mandantNames.Contains(lr.MandatorName));

            if (hasMandantLevelRolle)
            {
                applicationModes.Add(ApplicationMode.Mandant);
            }

            if (applicationModes.IsEmpty())
            {
                applicationModes.Add(ApplicationMode.NoMandants);
                return(applicationModes);
            }

            return(applicationModes);
        }
Пример #2
0
 public List <UserRole> GetRole(string username)
 {
     return(GetCached(string.Format("GetRole_{0}", username), () => roleService.GetRole(username)));
 }