protected IEnumerator <IAsyncResult> SetTableAclImpl(IAccountIdentifier identifier, string account, string tableName, ContainerAclSettings acl, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <NoResults> context) { byte[] numArray; Duration startingNow = Duration.StartingNow; if (identifier == null) { throw new ArgumentNullException("identifier"); } if (string.IsNullOrEmpty(account)) { throw new ArgumentException("account", "Cannot be null or empty"); } if (string.IsNullOrEmpty(tableName)) { throw new ArgumentException("tableName", "Cannot be null or empty"); } if (acl == null) { throw new ArgumentNullException("acl"); } if (acl.SASIdentifiers == null) { throw new ArgumentNullException("sasidentifiers"); } if (timeout <= TimeSpan.Zero) { throw new TimeoutException("Timed out in SetTableAcl"); } RemainingTime remainingTime = new RemainingTime(timeout); if (identifier is TableSignedAccessAccountIdentifier || identifier is AccountSasAccessIdentifier) { throw new NephosUnauthorizedAccessException("Signed access not supported for this request", AuthorizationFailureReason.InvalidOperationSAS); } IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identifier, account, tableName, null, PermissionLevel.WriteAcl, remainingTime, context.GetResumeCallback(), context.GetResumeState("TableManager.SetTableAclImpl")); yield return(asyncResult); this.authorizationManager.EndCheckAccess(asyncResult); using (IStorageAccount storageAccount = this.storageManager.CreateAccountInstance(account)) { using (ITableContainer tableContainer = storageAccount.CreateTableContainerInstance(tableName)) { acl.EncodeToServiceMetadata(out numArray); ContainerCondition containerCondition = null; tableContainer.ServiceMetadata = numArray; tableContainer.Timeout = startingNow.Remaining(timeout); asyncResult = tableContainer.BeginSetProperties(ContainerPropertyNames.ServiceMetadata, containerCondition, context.GetResumeCallback(), context.GetResumeState("TableManager.SetTableAclImpl")); yield return(asyncResult); tableContainer.EndSetProperties(asyncResult); } } }
protected IEnumerator <IAsyncResult> GetTableAclImpl(IAccountIdentifier identifier, string account, string tableName, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <ContainerAclSettings> context) { Duration startingNow = Duration.StartingNow; if (identifier == null) { throw new ArgumentNullException("identifier"); } if (string.IsNullOrEmpty(account)) { throw new ArgumentException("account", "Cannot be null or empty"); } if (string.IsNullOrEmpty(tableName)) { throw new ArgumentException("tableName", "Cannot be null or empty"); } if (timeout <= TimeSpan.Zero) { throw new TimeoutException("Timed out in GetTableAcl"); } if (identifier is TableSignedAccessAccountIdentifier || identifier is AccountSasAccessIdentifier) { throw new NephosUnauthorizedAccessException("Signed access not supported for this request", AuthorizationFailureReason.InvalidOperationSAS); } IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identifier, account, tableName, null, PermissionLevel.ReadAcl, startingNow.Remaining(timeout), context.GetResumeCallback(), context.GetResumeState("TableManager.GetTableAclImpl")); yield return(asyncResult); this.authorizationManager.EndCheckAccess(asyncResult); string str = account; string str1 = tableName; using (IStorageAccount storageAccount = this.storageManager.CreateAccountInstance(str)) { using (ITableContainer tableContainer = storageAccount.CreateTableContainerInstance(str1)) { ContainerPropertyNames containerPropertyName = ContainerPropertyNames.LastModificationTime | ContainerPropertyNames.ServiceMetadata; tableContainer.Timeout = startingNow.Remaining(timeout); asyncResult = tableContainer.BeginGetProperties(containerPropertyName, null, CacheRefreshOptions.SkipAllCache, context.GetResumeCallback(), context.GetResumeState("TableManager.GetTableAclImpl")); yield return(asyncResult); tableContainer.EndGetProperties(asyncResult); try { context.ResultData = new ContainerAclSettings(tableContainer.ServiceMetadata); } catch (MetadataFormatException metadataFormatException1) { MetadataFormatException metadataFormatException = metadataFormatException1; throw new NephosStorageDataCorruptionException(string.Format("Error decoding Acl setting for {0}", RealServiceManager.GetResourceString(account, tableName)), metadataFormatException); } } } }