mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
(custom) types can have a group as owner now, which allos there acl to depend on that group and not the person who created it
This commit is contained in:
parent
fb4b851d3b
commit
98ca788a6d
@ -99,6 +99,12 @@ class boinfolog
|
||||
* @var array
|
||||
*/
|
||||
var $customfields=array();
|
||||
/**
|
||||
* Group owners for certain types read from the infolog config
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $group_owners=array();
|
||||
|
||||
/**
|
||||
* Constructor Infolog BO
|
||||
@ -145,8 +151,6 @@ class boinfolog
|
||||
'done' => 'done'
|
||||
));
|
||||
|
||||
$this->so =& new soinfolog();
|
||||
|
||||
if (!is_object($GLOBALS['egw']->link) && $instanciate_link)
|
||||
{
|
||||
$GLOBALS['egw']->link =& CreateObject('phpgwapi.bolink');
|
||||
@ -185,6 +189,9 @@ class boinfolog
|
||||
if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key);
|
||||
}
|
||||
natcasesort($this->enums['type']);
|
||||
|
||||
if ($this->config->config_data['group_owners']) $this->group_owners = $this->config->config_data['group_owners'];
|
||||
|
||||
if (isset($this->config->config_data['customfields']) && is_array($this->config->config_data['customfields']))
|
||||
{
|
||||
if (!($this->customfields = $this->config->config_data['customfields'])) $this->customfields = array();
|
||||
@ -220,6 +227,9 @@ class boinfolog
|
||||
$this->tz_offset_s = 60*60*$this->tz_offset;
|
||||
$this->user_time_now = time() + $this->tz_offset_s;
|
||||
|
||||
$this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true);
|
||||
$this->so =& new soinfolog($this->grants);
|
||||
|
||||
// are we called via xmlrpc?
|
||||
$this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
|
||||
|
||||
@ -558,7 +568,15 @@ class boinfolog
|
||||
$values['info_subject'] = $this->subject_from_des($values['info_des']);
|
||||
}
|
||||
}
|
||||
if (!$values['info_id'] && !$values['info_owner'])
|
||||
if (isset($this->group_owners[$values['info_type']]))
|
||||
{
|
||||
$values['info_owner'] = $this->group_owners[$values['info_type']];
|
||||
if (!($this->grants[$this->group_owners[$values['info_type']]] & EGW_ACL_EDIT))
|
||||
{
|
||||
return false; // no edit rights from the group-owner
|
||||
}
|
||||
}
|
||||
elseif (!$values['info_id'] && !$values['info_owner'] || $GLOBALS['egw']->accounts->get_type($values['info_owner']) == 'g')
|
||||
{
|
||||
$values['info_owner'] = $this->so->user;
|
||||
}
|
||||
|
@ -75,20 +75,21 @@ class soinfolog // DB-Layer
|
||||
var $tz_offset;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* Constructor
|
||||
*
|
||||
* @param array $grants
|
||||
* @return soinfolog
|
||||
*/
|
||||
function soinfolog( $info_id = 0)
|
||||
function soinfolog( &$grants )
|
||||
{
|
||||
$this->db = clone($GLOBALS['egw']->db);
|
||||
$this->db->set_app('infolog');
|
||||
$this->grants = $GLOBALS['egw']->acl->get_grants('infolog');
|
||||
$this->grants =& $grants;
|
||||
$this->user = $GLOBALS['egw_info']['user']['account_id'];
|
||||
|
||||
$this->links =& new solink();
|
||||
|
||||
$this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
|
||||
|
||||
$this->read( $info_id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,6 +49,12 @@ class uicustomfields
|
||||
* @var config
|
||||
*/
|
||||
var $config;
|
||||
/**
|
||||
* Group owners for certain types read from the infolog config
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $group_owners;
|
||||
|
||||
function uicustomfields( )
|
||||
{
|
||||
@ -58,6 +64,7 @@ class uicustomfields
|
||||
$this->status = &$this->bo->status;
|
||||
$this->config = &$this->bo->config;
|
||||
$this->fields = &$this->bo->customfields;
|
||||
$this->group_owners =& $this->bo->group_owners;
|
||||
|
||||
$GLOBALS['egw']->translation->add_app('etemplate');
|
||||
foreach($this->cf_types as $name => $label) $this->cf_types[$name] = lang($label);
|
||||
@ -160,6 +167,8 @@ class uicustomfields
|
||||
$content['fields'][++$n] = array('type2'=>'','order' => 10 * $n); // new line for create
|
||||
$readonlys['fields']["delete[]"] = True;
|
||||
|
||||
$content['group_owner'] = $this->group_owners[$content['type2']];
|
||||
|
||||
//echo '<p>uicustomfields.edit(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
||||
//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
|
||||
$this->tmpl->read('infolog.customfields');
|
||||
@ -317,6 +326,14 @@ class uicustomfields
|
||||
$this->update_status($content);
|
||||
$this->update_fields($content);
|
||||
|
||||
if ($content['group_owner'])
|
||||
{
|
||||
$this->group_owners[$content['type2']] = $content['group_owner'];
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($this->group_owners[$content['type2']]);
|
||||
}
|
||||
// save changes to repository
|
||||
$this->save_repository();
|
||||
}
|
||||
@ -372,6 +389,8 @@ class uicustomfields
|
||||
//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
|
||||
$this->config->value('customfields',$this->fields);
|
||||
|
||||
$this->config->value('group_owners',$this->group_owners);
|
||||
|
||||
$this->config->save_repository();
|
||||
}
|
||||
}
|
||||
|
@ -941,6 +941,42 @@ class uiinfolog
|
||||
$content['info_type'] = 'note';
|
||||
}
|
||||
}
|
||||
// group owners
|
||||
$types = $this->bo->enums['type'];
|
||||
if ($this->bo->group_owners)
|
||||
{
|
||||
// remove types owned by groups the user has no edit grant (current type is made readonly)
|
||||
foreach($this->bo->group_owners as $type => $group)
|
||||
{
|
||||
if (!($this->bo->grants[$group] & EGW_ACL_EDIT))
|
||||
{
|
||||
if ($type == $content['info_type'])
|
||||
{
|
||||
//echo "<p>setting type to r/o as user has no edit rights from group #$group</p>\n";
|
||||
$readonlys['info_type'] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($types[$type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// set group as owner if type has a group-owner set
|
||||
if (isset($this->bo->group_owners[$content['info_type']]))
|
||||
{
|
||||
$content['info_owner'] = $this->bo->group_owners[$content['info_type']];
|
||||
// Dont allow to change the type, if user has no delete rights from the group-owner
|
||||
if ($info_id && !($this->bo->grants[$content['info_owner']] & EGW_ACL_DELETE))
|
||||
{
|
||||
//echo "<p>setting type to r/o as user has no delete rights from group #$group</p>\n";
|
||||
$readonlys['info_type'] = true;
|
||||
}
|
||||
}
|
||||
elseif($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g')
|
||||
{
|
||||
$content['info_owner'] = $this->user;
|
||||
}
|
||||
}
|
||||
// for implizit edit of responsible user make all fields readonly, but status and percent
|
||||
if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT) && $this->bo->is_responsible($content))
|
||||
{
|
||||
@ -984,6 +1020,7 @@ class uiinfolog
|
||||
!isset($GLOBALS['egw_info']['user']['apps']['admin']);
|
||||
|
||||
$content['duration_format'] = $this->duration_format;
|
||||
if ($this->prefs['show_id']) $content['info_number'] = $info_id;
|
||||
|
||||
$old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id'];
|
||||
if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id;
|
||||
@ -993,7 +1030,7 @@ class uiinfolog
|
||||
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd'));
|
||||
//echo "<p>uiinfolog.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content);
|
||||
$this->tmpl->exec('infolog.uiinfolog.edit',$content,array(
|
||||
'info_type' => $this->bo->enums['type'],
|
||||
'info_type' => $types,
|
||||
'info_priority' => $this->bo->enums['priority'],
|
||||
'info_confirm' => $this->bo->enums['confirm'],
|
||||
'info_status' => $this->bo->status[$content['info_type']]
|
||||
@ -1016,6 +1053,8 @@ class uiinfolog
|
||||
'info_price' => $content['info_price'],
|
||||
'info_used_time' => $content['info_used_time'],
|
||||
'info_planned_time' => $content['info_planned_time'],
|
||||
// preserve the type in case it's readonly (no delete rights from group owner)
|
||||
'info_type' => $content['info_type'],
|
||||
),$no_popup ? 0 : 2);
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -123,8 +123,10 @@ finish infolog de wenn erledigt
|
||||
for which types should this field be used infolog de für welche Typen soll dieses Feld benutzt werden
|
||||
from infolog de Von
|
||||
general infolog de Allgemein
|
||||
group owner for infolog de Gruppeneigentümer für
|
||||
high infolog de hoch
|
||||
id infolog de Id
|
||||
if a type has a group owner, all entries of that type will be owned by the given group and not the user who created it! infolog de Wenn ein Typ einen Gruppeneigentümer hat, gehören alle Einträge dieses Typs der angegebenen Gruppe und NICHT dem Benutzer der sie angelegt hat!
|
||||
if not set, the line with search and filters is hidden for less entries then "max matches per page" (as defined in your common preferences). infolog de Falls nicht gesetzt, wird die Suche und die Filter ausgeblendet für weniger Einträge als "maximale Treffer pro Seite" (in ihren allg. Einstellungen definiert).
|
||||
import infolog de Import
|
||||
import next set infolog de Nächsten Satz importieren
|
||||
@ -292,6 +294,7 @@ urgent infolog de Dringend
|
||||
used time infolog de benötigte Zeit
|
||||
valid path on clientside<br>eg. \\server\share or e:\ infolog de gültiger Pfad clientseitig<br>zB. \\Server\Share oder e:\
|
||||
valid path on clientside<br>eg. \servershare or e: infolog de gültiger Pfad clientseitig<br>zB. \\Server\Share oder e:\
|
||||
valid path on clientside<br>eg. servershare or e: infolog de gültiger Pfad clientseitig<br>zB. \\Server\Share oder e:\
|
||||
values for selectbox infolog de Werte für die Auswahlbox
|
||||
view all subs of this entry infolog de alle Untereinträge dieses Eintrag anzeigen
|
||||
view other subs infolog de andere Untereinträge anzeigen
|
||||
|
@ -123,8 +123,10 @@ finish infolog en finish
|
||||
for which types should this field be used infolog en for which types should this field be used
|
||||
from infolog en From
|
||||
general infolog en General
|
||||
group owner for infolog en Group owner for
|
||||
high infolog en high
|
||||
id infolog en Id
|
||||
if a type has a group owner, all entries of that type will be owned by the given group and not the user who created it! infolog en If a type has a group owner, all entries of that type will be owned by the given group and NOT the user who created it!
|
||||
if not set, the line with search and filters is hidden for less entries then "max matches per page" (as defined in your common preferences). infolog en If not set, the line with search and filters is hidden for less entries then "max matches per page" (as defined in your common preferences).
|
||||
import infolog en Import
|
||||
import next set infolog en import next set
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="infolog.customfields.status" template="" lang="" group="0" version="1.2.001">
|
||||
<grid>
|
||||
<grid width="100%" border="0" spacing="0" padding="0">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
@ -81,7 +81,7 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="infolog.customfields" template="" lang="" group="0" version="1.3.001">
|
||||
<template id="infolog.customfields" template="" lang="" group="0" version="1.3.002">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
@ -114,6 +114,14 @@
|
||||
<row>
|
||||
<template content="fields" span="all" id="infolog.customfields.fields"/>
|
||||
</row>
|
||||
<row>
|
||||
<hbox options="0,0" span="all">
|
||||
<description class="header" value="Group owner for" id="type2"/>
|
||||
<menulist class="lpadding5">
|
||||
<menupopup type="select-account" options="None,groups" id="group_owner" statustext="If a type has a group owner, all entries of that type will be owned by the given group and NOT the user who created it!"/>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<hbox span="all">
|
||||
<button label="Save" id="button[save]" statustext="saves the changes made and leaves"/>
|
||||
|
@ -140,9 +140,12 @@
|
||||
</row>
|
||||
<row class="th" height="28">
|
||||
<description value="Type" options=",,,info_type"/>
|
||||
<menulist span="all">
|
||||
<menupopup id="info_type" onchange="1" statustext="Type of the log-entry: Note, Phonecall or ToDo" no_lang="1"/>
|
||||
</menulist>
|
||||
<hbox span="all" options="0,0">
|
||||
<menulist>
|
||||
<menupopup id="info_type" onchange="1" statustext="Type of the log-entry: Note, Phonecall or ToDo" no_lang="1"/>
|
||||
</menulist>
|
||||
<int id="info_number" class="infoId" readonly="true"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="row">
|
||||
<description value="Category" options=",,,info_cat"/>
|
||||
|
Loading…
Reference in New Issue
Block a user