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 array
|
||||||
*/
|
*/
|
||||||
var $customfields=array();
|
var $customfields=array();
|
||||||
|
/**
|
||||||
|
* Group owners for certain types read from the infolog config
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
var $group_owners=array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor Infolog BO
|
* Constructor Infolog BO
|
||||||
@ -145,8 +151,6 @@ class boinfolog
|
|||||||
'done' => 'done'
|
'done' => 'done'
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->so =& new soinfolog();
|
|
||||||
|
|
||||||
if (!is_object($GLOBALS['egw']->link) && $instanciate_link)
|
if (!is_object($GLOBALS['egw']->link) && $instanciate_link)
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->link =& CreateObject('phpgwapi.bolink');
|
$GLOBALS['egw']->link =& CreateObject('phpgwapi.bolink');
|
||||||
@ -185,6 +189,9 @@ class boinfolog
|
|||||||
if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key);
|
if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key);
|
||||||
}
|
}
|
||||||
natcasesort($this->enums['type']);
|
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 (isset($this->config->config_data['customfields']) && is_array($this->config->config_data['customfields']))
|
||||||
{
|
{
|
||||||
if (!($this->customfields = $this->config->config_data['customfields'])) $this->customfields = array();
|
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->tz_offset_s = 60*60*$this->tz_offset;
|
||||||
$this->user_time_now = time() + $this->tz_offset_s;
|
$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?
|
// are we called via xmlrpc?
|
||||||
$this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
|
$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']);
|
$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;
|
$values['info_owner'] = $this->so->user;
|
||||||
}
|
}
|
||||||
|
@ -73,22 +73,23 @@ class soinfolog // DB-Layer
|
|||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
var $tz_offset;
|
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 = clone($GLOBALS['egw']->db);
|
||||||
$this->db->set_app('infolog');
|
$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->user = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
|
|
||||||
$this->links =& new solink();
|
$this->links =& new solink();
|
||||||
|
|
||||||
$this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
|
$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
|
||||||
*/
|
*/
|
||||||
var $config;
|
var $config;
|
||||||
|
/**
|
||||||
|
* Group owners for certain types read from the infolog config
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
var $group_owners;
|
||||||
|
|
||||||
function uicustomfields( )
|
function uicustomfields( )
|
||||||
{
|
{
|
||||||
@ -58,6 +64,7 @@ class uicustomfields
|
|||||||
$this->status = &$this->bo->status;
|
$this->status = &$this->bo->status;
|
||||||
$this->config = &$this->bo->config;
|
$this->config = &$this->bo->config;
|
||||||
$this->fields = &$this->bo->customfields;
|
$this->fields = &$this->bo->customfields;
|
||||||
|
$this->group_owners =& $this->bo->group_owners;
|
||||||
|
|
||||||
$GLOBALS['egw']->translation->add_app('etemplate');
|
$GLOBALS['egw']->translation->add_app('etemplate');
|
||||||
foreach($this->cf_types as $name => $label) $this->cf_types[$name] = lang($label);
|
foreach($this->cf_types as $name => $label) $this->cf_types[$name] = lang($label);
|
||||||
@ -159,6 +166,8 @@ class uicustomfields
|
|||||||
}
|
}
|
||||||
$content['fields'][++$n] = array('type2'=>'','order' => 10 * $n); // new line for create
|
$content['fields'][++$n] = array('type2'=>'','order' => 10 * $n); // new line for create
|
||||||
$readonlys['fields']["delete[]"] = True;
|
$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 '<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";
|
//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
|
||||||
@ -316,7 +325,15 @@ class uicustomfields
|
|||||||
{
|
{
|
||||||
$this->update_status($content);
|
$this->update_status($content);
|
||||||
$this->update_fields($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
|
// save changes to repository
|
||||||
$this->save_repository();
|
$this->save_repository();
|
||||||
}
|
}
|
||||||
@ -371,6 +388,8 @@ class uicustomfields
|
|||||||
$this->config->value('status',$this->status);
|
$this->config->value('status',$this->status);
|
||||||
//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
|
//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('customfields',$this->fields);
|
||||||
|
|
||||||
|
$this->config->value('group_owners',$this->group_owners);
|
||||||
|
|
||||||
$this->config->save_repository();
|
$this->config->save_repository();
|
||||||
}
|
}
|
||||||
|
@ -941,6 +941,42 @@ class uiinfolog
|
|||||||
$content['info_type'] = 'note';
|
$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
|
// 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))
|
if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT) && $this->bo->is_responsible($content))
|
||||||
{
|
{
|
||||||
@ -984,7 +1020,8 @@ class uiinfolog
|
|||||||
!isset($GLOBALS['egw_info']['user']['apps']['admin']);
|
!isset($GLOBALS['egw_info']['user']['apps']['admin']);
|
||||||
|
|
||||||
$content['duration_format'] = $this->duration_format;
|
$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'];
|
$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;
|
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'));
|
$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);
|
//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(
|
$this->tmpl->exec('infolog.uiinfolog.edit',$content,array(
|
||||||
'info_type' => $this->bo->enums['type'],
|
'info_type' => $types,
|
||||||
'info_priority' => $this->bo->enums['priority'],
|
'info_priority' => $this->bo->enums['priority'],
|
||||||
'info_confirm' => $this->bo->enums['confirm'],
|
'info_confirm' => $this->bo->enums['confirm'],
|
||||||
'info_status' => $this->bo->status[$content['info_type']]
|
'info_status' => $this->bo->status[$content['info_type']]
|
||||||
@ -1016,6 +1053,8 @@ class uiinfolog
|
|||||||
'info_price' => $content['info_price'],
|
'info_price' => $content['info_price'],
|
||||||
'info_used_time' => $content['info_used_time'],
|
'info_used_time' => $content['info_used_time'],
|
||||||
'info_planned_time' => $content['info_planned_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);
|
),$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
|
for which types should this field be used infolog de für welche Typen soll dieses Feld benutzt werden
|
||||||
from infolog de Von
|
from infolog de Von
|
||||||
general infolog de Allgemein
|
general infolog de Allgemein
|
||||||
|
group owner for infolog de Gruppeneigentümer für
|
||||||
high infolog de hoch
|
high infolog de hoch
|
||||||
id infolog de Id
|
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).
|
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 infolog de Import
|
||||||
import next set infolog de Nächsten Satz importieren
|
import next set infolog de Nächsten Satz importieren
|
||||||
@ -292,6 +294,7 @@ urgent infolog de Dringend
|
|||||||
used time infolog de benötigte Zeit
|
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. \\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:\
|
||||||
|
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
|
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 all subs of this entry infolog de alle Untereinträge dieses Eintrag anzeigen
|
||||||
view other subs infolog de andere Untereinträge 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
|
for which types should this field be used infolog en for which types should this field be used
|
||||||
from infolog en From
|
from infolog en From
|
||||||
general infolog en General
|
general infolog en General
|
||||||
|
group owner for infolog en Group owner for
|
||||||
high infolog en high
|
high infolog en high
|
||||||
id infolog en Id
|
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).
|
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 infolog en Import
|
||||||
import next set infolog en import next set
|
import next set infolog en import next set
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<!-- $Id$ -->
|
<!-- $Id$ -->
|
||||||
<overlay>
|
<overlay>
|
||||||
<template id="infolog.customfields.status" template="" lang="" group="0" version="1.2.001">
|
<template id="infolog.customfields.status" template="" lang="" group="0" version="1.2.001">
|
||||||
<grid>
|
<grid width="100%" border="0" spacing="0" padding="0">
|
||||||
<columns>
|
<columns>
|
||||||
<column/>
|
<column/>
|
||||||
<column/>
|
<column/>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
</template>
|
</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>
|
<grid>
|
||||||
<columns>
|
<columns>
|
||||||
<column/>
|
<column/>
|
||||||
@ -114,6 +114,14 @@
|
|||||||
<row>
|
<row>
|
||||||
<template content="fields" span="all" id="infolog.customfields.fields"/>
|
<template content="fields" span="all" id="infolog.customfields.fields"/>
|
||||||
</row>
|
</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>
|
<row>
|
||||||
<hbox span="all">
|
<hbox span="all">
|
||||||
<button label="Save" id="button[save]" statustext="saves the changes made and leaves"/>
|
<button label="Save" id="button[save]" statustext="saves the changes made and leaves"/>
|
||||||
|
@ -140,9 +140,12 @@
|
|||||||
</row>
|
</row>
|
||||||
<row class="th" height="28">
|
<row class="th" height="28">
|
||||||
<description value="Type" options=",,,info_type"/>
|
<description value="Type" options=",,,info_type"/>
|
||||||
<menulist span="all">
|
<hbox span="all" options="0,0">
|
||||||
<menupopup id="info_type" onchange="1" statustext="Type of the log-entry: Note, Phonecall or ToDo" no_lang="1"/>
|
<menulist>
|
||||||
</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>
|
||||||
<row class="row">
|
<row class="row">
|
||||||
<description value="Category" options=",,,info_cat"/>
|
<description value="Category" options=",,,info_cat"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user