// Token: 0x06001231 RID: 4657 RVA: 0x0004D040 File Offset: 0x0004B240 public void Authorize(PhotoPrincipal requestor, PhotoPrincipal target) { if (requestor == null) { throw new ArgumentNullException("requestor"); } if (target == null) { throw new ArgumentNullException("target"); } if (requestor.IsSame(target)) { this.tracer.TraceDebug((long)this.GetHashCode(), "Photo authorization: authorized: requestor and target are same principal."); return; } if (requestor.InSameOrganization(target)) { this.tracer.TraceDebug((long)this.GetHashCode(), "Photo authorization: authorized: requestor and target are in same organization."); return; } if (this.PhotoSharingEnabled(requestor, target)) { this.tracer.TraceDebug((long)this.GetHashCode(), "Photo authorization: authorized: photo sharing enabled."); return; } this.tracer.TraceDebug((long)this.GetHashCode(), "Photo authorization: ACCESS DENIED."); throw new AccessDeniedException(Strings.UserPhotoAccessDenied); }
// Token: 0x060012BE RID: 4798 RVA: 0x0004E4D8 File Offset: 0x0004C6D8 public void Serialize(PhotoPrincipal requestor, WebRequest request) { ArgumentValidator.ThrowIfNull("requestor", requestor); ArgumentValidator.ThrowIfNull("request", request); if (requestor.OrganizationId == null) { return; } request.Headers.Set("X-Exchange-Photos-Requestor-Organization-Id", PhotoRequestorHeader.SerializeOrganizationId(requestor.OrganizationId)); }
// Token: 0x06001232 RID: 4658 RVA: 0x0004D0F0 File Offset: 0x0004B2F0 private bool PhotoSharingEnabled(PhotoPrincipal requestor, PhotoPrincipal target) { OrganizationIdCacheValue organizationIdCacheValue = this.organizationConfigCache.Get((target.OrganizationId == null) ? OrganizationId.ForestWideOrgId : target.OrganizationId); if (organizationIdCacheValue == null) { this.tracer.TraceError((long)this.GetHashCode(), "Photo authorization: target organization's configuration not available in cache."); return(false); } foreach (string domain in requestor.GetEmailAddressDomains()) { OrganizationRelationship organizationRelationship = organizationIdCacheValue.GetOrganizationRelationship(domain); if (organizationRelationship != null && organizationRelationship.Enabled && organizationRelationship.PhotosEnabled) { return(true); } } return(false); }
// Token: 0x06001273 RID: 4723 RVA: 0x0004DE50 File Offset: 0x0004C050 public bool IsSame(PhotoPrincipal other) { if (other == null) { return(false); } if (object.ReferenceEquals(this, other)) { return(true); } if (this.EmailAddresses == null || this.EmailAddresses.Count == 0) { return(false); } if (other.EmailAddresses == null || other.EmailAddresses.Count == 0) { return(false); } return((from s in this.EmailAddresses.Intersect(other.EmailAddresses, StringComparer.OrdinalIgnoreCase) where !string.IsNullOrEmpty(s) select s).Any <string>()); }
// Token: 0x06001274 RID: 4724 RVA: 0x0004DED8 File Offset: 0x0004C0D8 public bool InSameOrganization(PhotoPrincipal other) { return(other != null && (object.ReferenceEquals(this, other) || (!(this.OrganizationId == null) && !(other.OrganizationId == null) && this.OrganizationId.Equals(other.OrganizationId)))); }