[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gambas-user] desktop portal file IDs


On Tue, 5 Mar 2024 at 13:45, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> wrote:

> Le 05/03/2024 à 14:30, Bruce Steers a écrit :
> > Am looking into that darn portal file definition problem.
>  > ...
>
> For me, "fd" = "file descriptor" as defined by the operating system.
>
> This is exactly what DBusFile.Handle property does: it opens the file
> and return the system file descriptor on it.
>
> Then this file descriptor is put in the "attachment_fds" argument of
> desktop portal ComposeEmail() mail.
>
> But as you noticed, it does not work.
>
> I didn't found any documentation, nor any example, so it's hard to guess
> what to do without looking in all desktop portal implementations source
> code.
>
> The difficulty is that the file descriptor is local to a process, so the
> desktop portal cannot use it with internal magic (it's possible to
> "send" a file descriptor to another process on Linux).
>
> Regards,
>
> --
> Benoît Minisini.
>

I'm sure that's what the Add method is for
I read here...
https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-org.freedesktop.portal.Documents
--------------
The document portal allows to make files from the outside world available
to sandboxed applications in a controlled way.

Exported files will be made accessible to the application via a fuse
filesystem that gets mounted at /run/user/$UID/doc/. The filesystem gets
mounted both outside and inside the sandbox, but the view inside the
sandbox is restricted to just those files that the application is allowed
to access.

Individual files will appear at /run/user/$UID/doc/$DOC_ID/filename, where
$DOC_ID is the ID of the file in the document store. It is returned by the
Add()
<https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-method-org-freedesktop-portal-Documents.Add>
and AddNamed()
<https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-method-org-freedesktop-portal-Documents.AddNamed>
calls.

The permissions that the application has for a document store entry (see
GrantPermissions()
<https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-method-org-freedesktop-portal-Documents.GrantPermissions>)
are reflected in the POSIX mode bits in the fuse filesystem.

The D-Bus interface for the document portal is available under the bus name
org.freedesktop.portal.Documents and the object path
/org/freedesktop/portal/documents.

This documentation describes version 4 of this interface."
--------------
I don't begin to understand it but it looks like you use Add to add files
to the "Document store" and somehow then they are accessible.
Perhaps this is how the "difficulty" is overcome?

I have tried various things but i'm out of my depth really.

perhaps you will understand the documentation better?

Respects
BruceS

References:
[Gambas-user] desktop portal file IDsBruce Steers <bsteers4@xxxxxxxxx>
Re: [Gambas-user] desktop portal file IDsBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>