Ejemplo n.º 1
0
 public bool IsEnabledForUser(IFeatureUser user)
 {
     if (FeatureSwitchStatus == FeatureSwitchStatus.Disabled)
     {
         return(false);
     }
     if (FeatureSwitchStatus == FeatureSwitchStatus.EnabledForAll)
     {
         return(true);
     }
     if (FeatureSwitchStatus == FeatureSwitchStatus.EnabledForAuthenticatedUsers)
     {
         if (user != null)
         {
             return(true);
         }
         return(false);
     }
     if (FeatureSwitchStatus == FeatureSwitchStatus.EnabledForSpecifiedUsersOrGroups)
     {
         if (EnabledForUsers.Any(o => o == user.Username))
         {
             return(true);
         }
         if (EnabledForGroups.Any(o => user.Groups.Any(i => i == o)))
         {
             return(true);
         }
         return(false);
     }
     return(false);
 }
Ejemplo n.º 2
0
 public bool Check(Feature feature, IFeatureUser user)
 {
     if (_checkers.ContainsKey(feature))
     {
         return _checkers[feature].Any(c => c.Check(feature, user));
     }
     return false;
 }
Ejemplo n.º 3
0
 public bool Check(Feature feature, IFeatureUser user)
 {
     this.CheckCount++;
     this.Checked = feature;
     return _passed;
 }
Ejemplo n.º 4
0
 public bool Check(Feature feature, IFeatureUser user)
 {
     return false;
 }
Ejemplo n.º 5
0
 public bool IsEnabledForUser(IFeatureUser user)
 {
     if (FeatureSwitchStatus == FeatureSwitchStatus.Disabled)
         return false;
     if (FeatureSwitchStatus == FeatureSwitchStatus.EnabledForAll)
         return true;
     if (FeatureSwitchStatus == FeatureSwitchStatus.EnabledForAuthenticatedUsers)
     {
         if (user != null)
             return true;
         return false;
     }
     if (FeatureSwitchStatus == FeatureSwitchStatus.EnabledForSpecifiedUsersOrGroups)
     {
         if (EnabledForUsers.Any(o => o == user.Username))
             return true;
         if (EnabledForGroups.Any(o => user.Groups.Any(i => i == o)))
             return true;
         return false;
     }
     return false;
 }
Ejemplo n.º 6
0
 public bool Check(Feature feature, IFeatureUser user)
 {
     return _cultures.Contains(user.Culture);
 }
Ejemplo n.º 7
0
 public static bool IsEnabled(this Feature feature, IFeatureUser user)
 {
     return Checker.Check(feature, user);
 }
Ejemplo n.º 8
0
 public bool Check(Feature feature, IFeatureUser user)
 {
     return _d100.Next(0, 99) < _percent;
 }