<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<pre>Dear grass comunity,</pre>

<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Yesterday for the first time since I use grass, I&nbsp;have been</pre>

<pre>faced with an interesting question:</pre>

<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; can different users work on the same mapset ?</pre>

<pre>So I tried, I&nbsp;played with unix privileges moved mapsets changed user</pre>

<pre>and group etc. etc. and discovered that finally THE&nbsp;ANSWER&nbsp;IS&nbsp;NO&nbsp;!!!</pre>

<pre>at lest not in grass5beta3 on alinux RH6.0 (posix compliant) platform.</pre>

<pre></pre>

<pre>Well, this is a little bit strange. Why shouldn't be possible in a</pre>

<pre>multi user environment such as unix to use the same mapset under</pre>

<pre>different usernames (maybe in the same group) ?</pre>

<pre>This could be very usefull especially for large projects whit many</pre>

<pre>people involved in.</pre>

<pre>The problem is in a GRASS&nbsp;GIS&nbsp;library call G__mapset_permissions,</pre>

<pre>that looks like:</pre>

<pre>int G__mapset_permissions (char *mapset)
{
&nbsp;&nbsp;&nbsp; char path[256];
&nbsp;&nbsp;&nbsp; struct stat info;

&nbsp;&nbsp;&nbsp; G__file_name (path,"","",mapset);

&nbsp;&nbsp;&nbsp; if (stat (path, &amp;info) != 0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;

&nbsp;&nbsp;&nbsp; if (info.st_uid != getuid())
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;
&nbsp;&nbsp;&nbsp; if (info.st_uid != geteuid())
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; return 1;
}

Simple, everytime that a call access mapsets data a check is done</pre>

<pre>for the userid of the mapsets file to be equal to that of real and</pre>

<pre>effective ids of the invoking process. So if I own a mapset I can</pre>

<pre>work on it, if I&nbsp;do not own it I&nbsp;cannot regardeless of the unix</pre>

<pre>mapsets files privileges.</pre>

<pre>I&nbsp;have only one question, why ? I do not understand this idea.</pre>

<pre></pre>

<pre>Ok so I&nbsp;went forward and changed a little bit the code. But if we</pre>

<pre>release this constraint by for example commenting the last two ifs</pre>

<pre>in the call, we will have to check for access permission to the mapsets.</pre>

<pre>This is done at start time in gis_set. I've done some work on that</pre>

<pre>and modified the gis_set and the g.access programs.</pre>

<pre>Anyhow at this stage I&nbsp;do not think it is a good idea to post my bugfixes,</pre>

<pre>that are to be considered much more as tournarounds. A sound understanding</pre>

<pre>of the global grass structure and clear objectives on how to manage mapset</pre>

<pre>permissions are needed in order to produce a proper code.</pre>

<pre>So here I&nbsp;just want to point out that THIS&nbsp;IS&nbsp;AN&nbsp;IMPORTANT&nbsp;ISSUE. Clearly</pre>

<pre>if somebody is interested in having my patch I can send it. But I would first</pre>

<pre>like to understand the developping strategy beneath the G__mapset_permissions</pre>

<pre>call.</pre>

<pre></pre>

<pre>Comments are welcome</pre>

<pre>LP</pre>

<pre></pre>

<pre>--> Luca Palmeri - Dip. Proc. Chimici dell'Ingengeria
&nbsp;&nbsp;&nbsp; Universita' di Padova&nbsp; TEL: +390498275527 -------
-------------------------&nbsp; FAX: +390498275528 -------
--> Think holistic @ the end of the 2nd millenium &lt;--</pre>
&nbsp;</html>