Exemplo n.º 1
0
        private static bool IsAllowedOnApplication(this InMemoryUser user, CompleteApplicationMetadataDefinition application)
        {
            var  appRoles        = RoleManager.ActiveApplicationRoles();
            bool isAppRoleActive = appRoles.Contains(application.Role);

            return(!isAppRoleActive || user.Roles.Any(r => r.Name == application.Role));
        }
Exemplo n.º 2
0
        public static IEnumerable <CompleteApplicationMetadataDefinition> Applications([NotNull] this InMemoryUser user, ClientPlatform platform)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            return(from application in MetadataProvider.Applications(platform)
                   where user.IsAllowedOnApplication(application)
                   select application);
        }