Exemplo n.º 1
0
 /// <summary>
 /// Tests if contains any of the specific permission item.
 /// </summary>
 /// <param name="siteId">The site identifier.</param>
 /// <param name="values">The permission items to test.</param>
 /// <returns>true if contains; otherwise, false.</returns>
 protected async Task <bool> HasAnyPermissionAsync(string siteId, IEnumerable <string> values)
 {
     if (coreResources == null)
     {
         coreResources = await this.GetResourceAccessClientAsync();
     }
     return(await coreResources.HasAnyPermissionAsync(siteId, values));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Tests if contains any of the specific permission item.
 /// </summary>
 /// <param name="siteId">The site identifier.</param>
 /// <param name="value">The permission item to test.</param>
 /// <param name="otherValues">Other permission items to test.</param>
 /// <returns>true if contains; otherwise, false.</returns>
 protected async Task <bool> HasAnyPermissionAsync(string siteId, string value, params string[] otherValues)
 {
     if (coreResources == null)
     {
         coreResources = await this.GetResourceAccessClientAsync();
     }
     return(await coreResources.HasAnyPermissionAsync(siteId, value, otherValues));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Tests if contains any of the specific permission item.
 /// </summary>
 /// <param name="siteId">The site identifier.</param>
 /// <param name="value">The permission item to test.</param>
 /// <returns>true if contains; otherwise, false.</returns>
 protected async Task <bool> HasPermissionAsync(string siteId, string value)
 {
     if (coreResources == null)
     {
         coreResources = await this.GetResourceAccessClientAsync();
     }
     return(await coreResources.HasPermissionAsync(siteId, value));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the social network resource context instance.
 /// </summary>
 /// <param name="client">The resource access client.</param>
 /// <returns>The instance of the social network resource context.</returns>
 public static async Task <BaseSocialNetworkResourceContext> CreateAsync(BaseResourceAccessClient client)
 {
     if (client == null)
     {
         client = await ResourceAccessClients.CreateAsync();
     }
     if (factory != null)
     {
         return(await factory(client));
     }
     if (client is HttpResourceAccessClient h)
     {
         return(new HttpSocialNetworkResourceContext(h));
     }
     return(null);
 }
 /// <summary>
 /// Initializes a new instance of the OnPremisesPrincipal class.
 /// </summary>
 /// <param name="client">The resource access client.</param>
 internal OnPremisesPrincipal(BaseResourceAccessClient client)
     : base((ClaimsIdentity)client?.User)
 {
     ResourceAccessClient = client;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the OnPremisesSocialNetworkResourceContext class.
 /// </summary>
 /// <param name="client">The resource access client.</param>
 /// <param name="snsDataProvider">The social network resource data provider.</param>
 internal OnPremisesSocialNetworkResourceContext(BaseResourceAccessClient client, ISocialNetworkResourceDataProvider snsDataProvider)
     : base(client ?? new OnPremisesResourceAccessClient(null))
 {
     CoreResources = base.CoreResources as OnPremisesResourceAccessClient;
     DataProvider  = snsDataProvider;
 }