[GRASSLIST:4203] Re: mapset permission denied....
Glynn Clements
glynn.clements at virgin.net
Fri Aug 2 04:08:16 EDT 2002
Eric G. Miller wrote:
> > Im trying to build an application to access grass raster file from a java
> > application. There is no problem accessing the file when im trying because
> > I am the owner of the mapset. However, when someone else is trying to start
> > the api, an error occur ( mapset permission denied... which is noprmal
> > because they are not the owner...). My question is : what should I put in
> > the mapset variable so that anyone can start the api an have access to the
> > raster files even if they are not the owner of the file....
>
> GRASS uses Unix permissions for access controls.
Er, not quite. You are only deemed to have permission to write to a
mapset if you own it, regardless of the actual Unix permissions on the
mapset directory:
int G__mapset_permissions (char *mapset)
{
char path[256];
struct stat info;
G__file_name (path,"","",mapset);
if (stat (path, &info) != 0)
return -1;
if (info.st_uid != getuid())
return 0;
if (info.st_uid != geteuid())
return 0;
return 1;
}
The set_data program won't allow you to select a mapset for which the
above function fails.
Note that simply disabling the check may cause other problems, e.g.
you can't have multiple sessions with the same current mapset (due to
the current region being stored in the mapset directory).
Basically, every user needs their own private mapset. You can read
maps from other mapsets, but any new maps are written to the current
mapset.
In short, I suspect that your application will need the ability to
create new mapsets on demand.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list