public AbpUserConfigurationBuilder( IMultiTenancyConfig multiTenancyConfig, ILanguageManager languageManager, ILocalizationManager localizationManager, IFeatureManager featureManager, IFeatureChecker featureChecker, IPermissionManager permissionManager, IUserNavigationManager userNavigationManager, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IAbpAntiForgeryConfiguration abpAntiForgeryConfiguration, IAbpSession abpSession, IPermissionChecker permissionChecker) { _multiTenancyConfig = multiTenancyConfig; _languageManager = languageManager; _localizationManager = localizationManager; _featureManager = featureManager; _featureChecker = featureChecker; _permissionManager = permissionManager; _userNavigationManager = userNavigationManager; _settingDefinitionManager = settingDefinitionManager; _settingManager = settingManager; _abpAntiForgeryConfiguration = abpAntiForgeryConfiguration; _abpSession = abpSession; _permissionChecker = permissionChecker; }
public UserConfigurationBuilder( IMultiTenancyConfig multiTenancyConfig, ILanguageManager languageManager, ILocalizationManager localizationManager, IFeatureManager featureManager, IFeatureChecker featureChecker, IPermissionManager permissionManager, IUserNavigationManager userNavigationManager, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IAbpAntiForgeryConfiguration abpAntiForgeryConfiguration, IAbpSession abpSession, IPermissionChecker permissionChecker, IIocResolver iocResolver) { _multiTenancyConfig = multiTenancyConfig; _languageManager = languageManager; _localizationManager = localizationManager; _featureManager = featureManager; _featureChecker = featureChecker; _permissionManager = permissionManager; _userNavigationManager = userNavigationManager; _settingDefinitionManager = settingDefinitionManager; _settingManager = settingManager; _abpAntiForgeryConfiguration = abpAntiForgeryConfiguration; _abpSession = abpSession; _permissionChecker = permissionChecker; _iocResolver = iocResolver; }
public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, string featureName) { if (!(await featureChecker.IsEnabledAsync(featureName))) { throw new AbpAuthorizationException("Feature is not enabled: " + featureName); } }
public static string GetOrNull( [NotNull] this IFeatureChecker featureChecker, [NotNull] string name) { Check.NotNull(featureChecker, nameof(featureChecker)); return(AsyncHelper.RunSync(() => featureChecker.GetOrNullAsync(name))); }
public AbpUserConfigurationBuilder( IMultiTenancyConfig multiTenancyConfig, ILanguageManager languageManager, ILocalizationManager localizationManager, IFeatureManager featureManager, IFeatureChecker featureChecker, IPermissionManager permissionManager, IUserNavigationManager userNavigationManager, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IAbpAntiForgeryConfiguration abpAntiForgeryConfiguration, IAbpSession abpSession, IPermissionChecker permissionChecker, IIocResolver iocResolver, IAbpStartupConfiguration startupConfiguration) { MultiTenancyConfig = multiTenancyConfig; LanguageManager = languageManager; LocalizationManager = localizationManager; FeatureManager = featureManager; FeatureChecker = featureChecker; PermissionManager = permissionManager; UserNavigationManager = userNavigationManager; SettingDefinitionManager = settingDefinitionManager; SettingManager = settingManager; AbpAntiForgeryConfiguration = abpAntiForgeryConfiguration; AbpSession = abpSession; PermissionChecker = permissionChecker; _iocResolver = iocResolver; _startupConfiguration = startupConfiguration; CustomDataConfig = new Dictionary <string, object>(); }
public StudioXUserConfigurationBuilder( IMultiTenancyConfig multiTenancyConfig, ILanguageManager languageManager, ILocalizationManager localizationManager, IFeatureManager featureManager, IFeatureChecker featureChecker, IPermissionManager permissionManager, IUserNavigationManager userNavigationManager, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IStudioXAntiForgeryConfiguration antiForgeryConfiguration, IStudioXSession session, IPermissionChecker permissionChecker) { this.multiTenancyConfig = multiTenancyConfig; this.languageManager = languageManager; this.localizationManager = localizationManager; this.featureManager = featureManager; this.featureChecker = featureChecker; this.permissionManager = permissionManager; this.userNavigationManager = userNavigationManager; this.settingDefinitionManager = settingDefinitionManager; this.settingManager = settingManager; studioXAntiForgeryConfiguration = antiForgeryConfiguration; studioXSession = session; this.permissionChecker = permissionChecker; }
/// <summary> /// Checks if given feature is enabled. Throws <see cref="FrameworkException"/> if not. /// </summary> /// <param name="featureChecker"><see cref="IFeatureChecker"/> instance</param> /// <param name="featureName">Unique feature name</param> public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, string featureName) { if (!await featureChecker.IsEnabledAsync(featureName)) { throw new FrameworkException("Feature is not enabled: " + featureName); } }
/// <summary> /// Checks if given feature is enabled. Throws <see cref="AbpAuthorizationException"/> if not. /// </summary> /// <param name="featureChecker"><see cref="IFeatureChecker"/> instance</param> /// <param name="featureName">Unique feature name</param> public static void CheckEnabled(this IFeatureChecker featureChecker, string featureName) { if (!featureChecker.IsEnabled(featureName)) { throw new AbpAuthorizationException("Feature is not enabled: " + featureName); } }
public AuthorizationHelper(IFeatureChecker featureChecker) { _featureChecker = featureChecker; AbpSession = NullAbpSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public FeaturesScriptManager(IFeatureManager featureManager, IFeatureChecker featureChecker) { _featureManager = featureManager; _featureChecker = featureChecker; AbpSession = NullAbpSession.Instance; }
public FeatureManager_Tests() { _featureManager = GetRequiredService <IFeatureManager>(); _featureChecker = GetRequiredService <IFeatureChecker>(); _currentTenant = GetRequiredService <ICurrentTenant>(); _featureValueRepository = GetRequiredService <IFeatureValueRepository>(); }
public BXJGLocalFileManager(IRepository <TEntity, long> repository, IFeatureChecker featureChecker) { base.LocalizationSourceName = BXJGFileConsts.LocalizationSourceName; this.repository = repository; this.featureChecker = featureChecker; this.AsyncQueryableExecuter = NullAsyncQueryableExecuter.Instance; }
public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, bool requiresAll, params string[] featureNames) { if (featureNames.IsNullOrEmpty()) { return; } if (requiresAll) { foreach (var featureName in featureNames) { if (!(await featureChecker.IsEnabledAsync(featureName))) { throw new AbpAuthorizationException(code: AbpFeatureErrorCodes.AllOfTheseFeaturesMustBeEnabled) .WithData("FeatureNames", string.Join(", ", featureNames)); } } } else { foreach (var featureName in featureNames) { if (await featureChecker.IsEnabledAsync(featureName)) { return; } } throw new AbpAuthorizationException(code: AbpFeatureErrorCodes.AtLeastOneOfTheseFeaturesMustBeEnabled) .WithData("FeatureNames", string.Join(", ", featureNames)); } }
public UserConfigurationBuilder( IMultiTenancyConfig multiTenancyConfig, ILanguageManager languageManager, ILocalizationManager localizationManager, IFeatureManager featureManager, IFeatureChecker featureChecker, IPermissionManager permissionManager, IUserNavigationManager userNavigationManager, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IAntiForgeryConfiguration AntiForgeryConfiguration, IInfrastructureSession Session, IPermissionChecker permissionChecker) { _multiTenancyConfig = multiTenancyConfig; _languageManager = languageManager; _localizationManager = localizationManager; _featureManager = featureManager; _featureChecker = featureChecker; _permissionManager = permissionManager; _userNavigationManager = userNavigationManager; _settingDefinitionManager = settingDefinitionManager; _settingManager = settingManager; _AntiForgeryConfiguration = AntiForgeryConfiguration; _Session = Session; _permissionChecker = permissionChecker; }
public static async Task <bool> IsEnabledAsync(this IFeatureChecker featureChecker, int tenantId, long?organizationUnitId, bool requiresAll, params string[] featureNames) { if (!organizationUnitId.HasValue) { return(await featureChecker.IsEnabledAsync(tenantId, requiresAll, featureNames)); } else { if (featureNames.IsNullOrEmpty()) { return(true); } if (requiresAll) { foreach (var featureName in featureNames) { if (!(await featureChecker.IsEnabledAsync(tenantId, organizationUnitId, featureName))) { return(false); } } return(true); } foreach (var featureName in featureNames) { if (await featureChecker.IsEnabledAsync(tenantId, organizationUnitId, featureName)) { return(true); } } return(false); } }
/// <summary> /// Used to check if one or all of the given features are enabled. /// </summary> /// <param name="featureChecker"><see cref="IFeatureChecker"/> instance</param> /// <param name="requiresAll">True, to require that all the given features are enabled. False, to require one or more.</param> /// <param name="featureNames">Names of the features</param> public static bool IsEnabled(this IFeatureChecker featureChecker, bool requiresAll, params string[] featureNames) { if (featureNames.IsNullOrEmpty()) { return(true); } if (requiresAll) { foreach (var featureName in featureNames) { if (!featureChecker.IsEnabled(featureName)) { return(false); } } return(true); } foreach (var featureName in featureNames) { if (featureChecker.IsEnabled(featureName)) { return(true); } } return(false); }
public FeaturesScriptManager(IFeatureManager featureManager, IFeatureChecker featureChecker) { _featureManager = featureManager; _featureChecker = featureChecker; Session = NullInfrastructureSession.Instance; }
public static async Task <bool> IsEnabledAsync(this IFeatureChecker featureChecker, bool requiresAll, params string[] featureNames) { if (featureNames.IsNullOrEmpty()) { return(true); } if (requiresAll) { foreach (var featureName in featureNames) { if (!(await featureChecker.IsEnabledAsync(featureName))) { return(false); } } return(true); } foreach (var featureName in featureNames) { if (await featureChecker.IsEnabledAsync(featureName)) { return(true); } } return(false); }
public AuthorizationHelper(IFeatureChecker featureChecker) { _featureChecker = featureChecker; AbpSession = NullAbpSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public AbpUserConfigurationBuilder( IMultiTenancyConfig multiTenancyConfig, ILanguageManager languageManager, ILocalizationManager localizationManager, IFeatureManager featureManager, IFeatureChecker featureChecker, IPermissionManager permissionManager, IUserNavigationManager userNavigationManager, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IAbpAntiForgeryConfiguration abpAntiForgeryConfiguration, IAbpSession abpSession, IPermissionChecker permissionChecker) { MultiTenancyConfig = multiTenancyConfig; LanguageManager = languageManager; LocalizationManager = localizationManager; FeatureManager = featureManager; FeatureChecker = featureChecker; PermissionManager = permissionManager; UserNavigationManager = userNavigationManager; SettingDefinitionManager = settingDefinitionManager; SettingManager = settingManager; AbpAntiForgeryConfiguration = abpAntiForgeryConfiguration; AbpSession = abpSession; PermissionChecker = permissionChecker; }
public FeaturesScriptManager(IFeatureManager featureManager, IFeatureChecker featureChecker) { _featureManager = featureManager; _featureChecker = featureChecker; AbpSession = NullAbpSession.Instance; }
public EditionAndFeature_Tests() { _multiTenancyConfig = Resolve <IMultiTenancyConfig>(); _editionManager = Resolve <EditionManager>(); _tenantManager = Resolve <TenantManager>(); _featureChecker = Resolve <FeatureChecker>(); }
public FeaturesScriptManager(IFeatureManager featureManager, IFeatureChecker featureChecker) { this.featureManager = featureManager; this.featureChecker = featureChecker; StudioXSession = NullStudioXSession.Instance; }
public AuthorizationHelper(IFeatureChecker featureChecker, IAuthorizationConfiguration configuration) { _featureChecker = featureChecker; _configuration = configuration; AbpSession = NullAbpSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, string featureName) { if (!(await featureChecker.IsEnabledAsync(featureName))) { throw new AbpAuthorizationException(code: AbpFeatureErrorCodes.FeatureIsNotEnabled).WithData( "FeatureName", featureName); } }
public static T Get <T>( [NotNull] this IFeatureChecker featureChecker, [NotNull] string name, T defaultValue = default) where T : struct { return(AsyncHelper.RunSync(() => featureChecker.GetAsync(name, defaultValue))); }
public AuthorizationHelper(IFeatureChecker featureChecker, IAuthorizationConfiguration configuration) { _featureChecker = featureChecker; _configuration = configuration; AbpSession = NullAbpSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public AuthorizationHelper(IFeatureChecker featureChecker, IAuthorizationConfiguration authConfiguration) { _featureChecker = featureChecker; _authConfiguration = authConfiguration; MajidSession = NullMajidSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public AuthorizationHelper(IFeatureChecker featureChecker, IAuthorizationConfiguration authConfiguration) { this.featureChecker = featureChecker; this.authConfiguration = authConfiguration; StudioXSession = NullStudioXSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public AuthorizationHelper(IFeatureChecker featureChecker, IAuthorizationConfiguration authConfiguration, IMultiTenancyConfig multiTenancyConfig) { _featureChecker = featureChecker; _authConfiguration = authConfiguration; _multiTenancyConfig = multiTenancyConfig; AbpSession = NullAbpSession.Instance; PermissionChecker = NullPermissionChecker.Instance; LocalizationManager = NullLocalizationManager.Instance; }
public static async Task <T> GetAsync <T>([NotNull] this IFeatureChecker featureChecker, [NotNull] string name, T defaultValue = default) where T : struct { Check.NotNull(featureChecker, nameof(featureChecker)); Check.NotNull(name, nameof(name)); var value = await featureChecker.GetOrNullAsync(name); return(value?.To <T>() ?? defaultValue); }
public ApiAuthorizationHelper( IFeatureChecker featureChecker, IAuthorizationConfiguration authConfiguration, IPermissionedObjectManager permissionedObjectManager, ILocalizationManager localizationManager ) : base(featureChecker, authConfiguration) { _authConfiguration = authConfiguration; _permissionedObjectManager = permissionedObjectManager; }
public FeaturesLimitValidationInterceptor( IFeatureChecker featureChecker, IRequiresLimitFeatureChecker limitFeatureChecker, IFeatureDefinitionManager featureDefinitionManager, IOptions <AbpFeaturesLimitValidationOptions> options) { _options = options.Value; _featureChecker = featureChecker; _limitFeatureChecker = limitFeatureChecker; _featureDefinitionManager = featureDefinitionManager; }
public static async Task <IdentityTwoFactorBehaviour> Get([NotNull] IFeatureChecker featureChecker) { Check.NotNull(featureChecker, nameof(featureChecker)); var value = await featureChecker.GetOrNullAsync(IdentityFeature.TwoFactor); if (value.IsNullOrWhiteSpace() || !Enum.TryParse <IdentityTwoFactorBehaviour>(value, out var behaviour)) { throw new AbpException($"{IdentityFeature.TwoFactor} feature value is invalid"); } return(behaviour); }
public FeatureDependencyContext(IIocResolver iocResolver, IFeatureChecker featureChecker) { IocResolver = iocResolver; FeatureChecker = featureChecker; }
public void Add(Feature feature, IFeatureChecker featureChecker) { _checkers.Add(feature, featureChecker); }
public EditionAndFeature_Tests() { _editionManager = Resolve<EditionManager>(); _tenantManager = Resolve<TenantManager>(); _featureChecker = Resolve<FeatureChecker>(); }