Re: adding new info to GnomeVFSFileInfo



Ian McKellar said:
> On Tue, 2002-09-17 at 08:52, Nils Philippsen wrote:
>> > If the framework you describe can provide a
>> > function to easily get this information, and if it can be ready by
>> the end of october (which is the 2.2 freeze date iirc), then fine,
>> just drop my patch.
>>
>> Oh, I'm not the one to drop any patches here. Basically, I'm just the
>> guy who wants to fiddle with ACLs from within Nautilus and babbles
>> about how GnomeVFS needs to be extended in order to achieve that
>> since. I've yet to submit any patches because I've not produced
>> anything I consider worth submitting. You'd have to ask Seth or Ian or
>> someone else to drop your patches instead ;-).
>
> The way I see it ACL support will need to be a separate interface, but

Very much agreed.

> it will also need to expose this GNOME_VFS_PERM_ACCESS_* API so that
> apps who don't care about the details can find out what they want.

That's what I wanted to say: I would like to at least deprecate (if not
forbid) using the permissions member directly in favour of using
setter/getter functions for two reasons:

- (In my eyes) unnecessary redundancy: We would need to replicate the
access bits in the permissions field from whatever mechanism we use in the
future everytime we create a GnomeVFSFileInfo object instead of only when
the program really needs the information.
- Source of errors: If we ever forget to set the bits to the right value,
this might at least lead to confusion.

I'd really like to wrap this up into "legacy helper" functions which would
be e.g.:

gnome_vfs_fileinfo_unix_permissions(): Returns the permissions member now,
will return an equivalent in the future mapped from what ever
ACLs/permissions the file may have. Deprecate use of the permissions
member now, make it opaque later.

gnome_vfs_fileinfo_unix_access(): Returns `access()` for local files, `ssh
remotehost access blah` for ssh files,
EBEPATIENTWILLBEIMPLEMENTEDLATERMAYBE for other remote files now and will
use soon-to-be-done (hopefully) general purpose, ACL-compatible, shiny,
.... gnome_vfs_access() API later.

> I'll be eager to look at proposed APIs that people have for ACL support.
> I have little knowledge of (or indeed personal interest in) ACLs. I am
> open to people who do care though. It sounds like the sort of thing that
> will take more thinking and discussion than we'll have time for before
> 2.2. But now is a good time to start talking about it.

OK, let me wrap up what I've got in mind currently:

We need objects for:

- GnomeVFSUser, GnomeVFSGroup: users and groups (very lightweight, I don't
want to implement every aspect, rather just identify them)
- GnomeVFSUserNamespace: "namespaces" in which users/groups are valid,
this will in most cases be just what I'd call the URI root, e.g. "file://"
 for "file:/usr/share/blah", "http://machine"; for
"http://user!password machine/path/to/file" and the like
- GnomeVFSPermissions: permissions objects which (opaquely) describe who
can do what with a file

The relations are as follows:

- users, groups are tied to a namespace
- permissions are tied to GnomeVFSFileInfo objects

The following functions should be there (mostly self explanatory):

- Functions to get lists of users/groups, needed e.g. for modifying
permissions in nautilus:

   GList *gnome_vfs_namespace_get_users (GnomeVFSNamespace* ns)
   GList *gnome_vfs_namespace_get_groups (GnomeVFSNamespace* ns)
  possibly wrapped up into "convenience" functions:
   GList *gnome_vfs_file_get_users (GnomeVFSURI* uri)
   GList *gnome_vfs_file_get_groups (GnomeVFSURI* uri)

- Function to get the namespace for a file:

   GnomeVFSUserNamespace *gnome_vfs_file_get_namespace (GnomeVFSURI *uri)

- Function for permissions/access:

   GnomeVFSPermissions* gnome_vfs_file_get_permissions(GnomeVFSURI *uri)
   gint gnome_vfs_file_set_permissions (GnomeVFSURI *uri,
                                        GnomeVFSPermissions *perms)
   gboolean gnome_vfs_file_access_user (GnomeVFSURI *uri,
                                        GnomeVFSUser *user,
                                        GnomeVFSAccessType access)
  more conveniently for the current process:
   gboolean gnome_vfs_file_access (GnomeVFSURI *uri,
                                   GnomeVFSAccessType access);

And the question apparently no one wants to hear: Comments, ideas?

Nils
-- 
Nils Philippsen / Berliner Straße 39 / D-71229 Leonberg // +49.7152.209647
   nils wombat dialup fht-esslingen de / nils redhat de / nils lisas de
   PGP fingerprint:  C4A8 9474 5C4C ADE3 2B8F  656D 47D8 9B65 6951 3011
       Ever noticed that common sense isn't really all that common?





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