mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-21 02:18:28 +02:00
Attempt to set permissions for automatically created categories.
This commit is contained in:
parent
2787d8d843
commit
951f2b1a08
@ -240,6 +240,9 @@ class bo_acl
|
|||||||
|
|
||||||
function set_rights($cat_id,$read,$write,$calread,$calbook,$admin)
|
function set_rights($cat_id,$read,$write,$calread,$calbook,$admin)
|
||||||
{
|
{
|
||||||
|
// Clear cache
|
||||||
|
unset(self::$permissions[$cat_id]);
|
||||||
|
|
||||||
$readcat = $read ? $read : array();
|
$readcat = $read ? $read : array();
|
||||||
$writecat = $write ? $write : array();
|
$writecat = $write ? $write : array();
|
||||||
$calreadcat = $calread ? $calread : array();
|
$calreadcat = $calread ? $calread : array();
|
||||||
|
@ -112,6 +112,9 @@ class resources_import_csv implements importexport_iface_import_plugin {
|
|||||||
// fetch the resource bo
|
// fetch the resource bo
|
||||||
$this->bo = new resources_bo();
|
$this->bo = new resources_bo();
|
||||||
|
|
||||||
|
// For adding ACLs
|
||||||
|
$this->acl_bo = CreateObject('resources.bo_acl',True);
|
||||||
|
|
||||||
// set FieldMapping.
|
// set FieldMapping.
|
||||||
$import_csv->mapping = $_definition->plugin_options['field_mapping'];
|
$import_csv->mapping = $_definition->plugin_options['field_mapping'];
|
||||||
|
|
||||||
@ -136,7 +139,8 @@ class resources_import_csv implements importexport_iface_import_plugin {
|
|||||||
$types = importexport_export_csv::$types;
|
$types = importexport_export_csv::$types;
|
||||||
$types['select-bool'] = array('bookable');
|
$types['select-bool'] = array('bookable');
|
||||||
$lookups = array();
|
$lookups = array();
|
||||||
|
$start_time = time();
|
||||||
|
|
||||||
while ( $record = $import_csv->get_record() ) {
|
while ( $record = $import_csv->get_record() ) {
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
@ -146,6 +150,22 @@ class resources_import_csv implements importexport_iface_import_plugin {
|
|||||||
// Automatically handle human friendly values
|
// Automatically handle human friendly values
|
||||||
importexport_import_csv::convert($record, $types, 'resources', $lookups);
|
importexport_import_csv::convert($record, $types, 'resources', $lookups);
|
||||||
|
|
||||||
|
// Check for a new category, it needs permissions set
|
||||||
|
$category = $GLOBALS['egw']->categories->read($record['cat_id']);
|
||||||
|
|
||||||
|
if($category['last_mod'] >= $start_time) {
|
||||||
|
// New category. Give read & write permissions to the current user's default group
|
||||||
|
$this->acl_bo->set_rights($record['cat_id'],
|
||||||
|
array($GLOBALS['egw_info']['user']['account_primary_group']),
|
||||||
|
array($GLOBALS['egw_info']['user']['account_primary_group']),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
// Refresh ACL
|
||||||
|
//$GLOBALS['egw']->acl->read_repository();
|
||||||
|
}
|
||||||
|
|
||||||
if ( $_definition->plugin_options['conditions'] ) {
|
if ( $_definition->plugin_options['conditions'] ) {
|
||||||
foreach ( $_definition->plugin_options['conditions'] as $condition ) {
|
foreach ( $_definition->plugin_options['conditions'] as $condition ) {
|
||||||
$results = array();
|
$results = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user