/// <summary>
 /// Checks whether the specified user has the specified <paramref name="requiredPermission" /> for the specified object.
 /// </summary>
 /// <param name="item">The item which owns the entries.</param>
 /// <param name="userId">The user identifier.</param>
 /// <param name="requiredPermission">The required permission.</param>
 /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
 /// <returns>
 /// A task that represents the asynchronous operation.
 /// </returns>
 /// <exception cref="System.ArgumentNullException"></exception>
 public virtual Task <SecurityResult> CheckAccessAsync(SharedResourceItem item, int?userId, AccessPermission requiredPermission, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     return(CheckAccessAsync(item.ObjectType, item.Id, userId, requiredPermission, cancellationToken));
 }
 /// <summary>
 /// Retrieves the <see cref="AccessRuleItem" /> associated with the key, as an asynchronous operation.
 /// </summary>
 /// <param name="item">The item to be found.</param>
 /// <param name="userEmail">The email address of the user to be found.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken" /> used to propagate notifications that the operation should be canceled.</param>
 /// <returns>
 /// The <see cref="Task" /> for the asynchronous operation, containing the contact, if any which matched the specified key.
 /// </returns>
 public virtual Task <AccessRuleItem> GetAccessRuleByUserEmailAsync(SharedResourceItem item, string userEmail, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     return(GetAccessRuleByUserEmailAsync(item.ObjectType, item.Id, userEmail, cancellationToken));
 }
 /// <summary>
 /// Deletes all <see cref="AccessRuleItem" />s from the specified <paramref name="item" />.
 /// </summary>
 /// <param name="item">The shared to be unshared.</param>
 /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
 /// <returns>
 /// A task that represents the asynchronous operation.
 /// </returns>
 public virtual Task <ValidationResult> RemoveAccessRulesAsync(SharedResourceItem item, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     return(RemoveAccessRulesAsync(item.ObjectType, item.Id, cancellationToken));
 }
 /// <summary>
 /// Finds a collection of Access Control Entries (ACEs) with the given values.
 /// </summary>
 /// <param name="item">The item which owns the entries.</param>
 /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
 /// <returns>
 /// A task that represents the asynchronous operation.
 /// </returns>
 public virtual Task <ListResult <AccessRuleItem> > GetOwnersAsync(SharedResourceItem item, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     return(GetOwnersAsync(item.ObjectType, item.Id, cancellationToken));
 }