/// <summary> /// Retrieves a particular principal as being the "owner" of the item. /// </summary> /// <remarks>Required by OS X.</remarks> /// <returns> /// Item that represents owner of this item and implements <see cref="IPrincipalAsync"/>. /// </returns> public async Task <IPrincipalAsync> GetOwnerAsync() { return(context.FileOperation( this, () => { FileSecurity acl = File.GetAccessControl(fileSystemInfo.FullName); return AclFactory.GetPrincipalFromSid(acl.GetOwner(typeof(SecurityIdentifier)).Value, context); }, Privilege.Read)); }
/// <summary> /// Returns instance of <see cref="IPrincipalAsync"/> which represents current user. /// </summary> /// <returns>Current user.</returns> /// <remarks> /// This method is usually called by the Engine when CalDAV/CardDAV client /// is trying to discover current user URL. /// </remarks> public async Task <IPrincipalAsync> GetCurrentUserPrincipalAsync() { // Typically there is no need to load all user properties here, only current // user ID (or name) is required to form the user URL: [DAVLocation]/acl/users/[UserID] return(AclFactory.GetPrincipalFromSid(context.WindowsIdentity.User.Value, context)); }