コード例 #1
0
ファイル: AuthScopeSet.cs プロジェクト: bcrosnier/CK-DB
 /// <summary>
 /// Adds a <see cref="AuthScopeItem"/>. Existing scope with the same <see cref="AuthScopeItem.ScopeName"/> is replaced.
 /// </summary>
 /// <param name="scope">The scope to add.</param>
 public void Add(AuthScopeItem scope)
 {
     if (scope == null)
     {
         throw new ArgumentNullException(nameof(scope));
     }
     _wrapper.Scopes[scope.ScopeName] = scope;
 }
コード例 #2
0
ファイル: AuthScopeSet.cs プロジェクト: bcrosnier/CK-DB
        /// <summary>
        /// Removes the scope with the same <see cref="AuthScopeItem.ScopeName"/> and <see cref="AuthScopeItem.Status"/>.
        /// </summary>
        /// <param name="scope">The scope to remove.</param>
        /// <returns>True on success, false if not found.</returns>
        public bool Remove(AuthScopeItem scope)
        {
            if (scope == null)
            {
                throw new ArgumentNullException(nameof(scope));
            }
            AuthScopeItem s;

            return(_wrapper.Scopes.TryGetValue(scope.ScopeName, out s) && s.Status == scope.Status && _wrapper.Scopes.Remove(scope.ScopeName));
        }