Sharing updates

- admin can set / change share password, encrypted using system
- admin can change share owner
- now recording last modified date / user when changing share
- change encrypted password column name
- new share column for encrypted type
This commit is contained in:
nathan 2023-08-21 14:23:21 -06:00
parent 8a1869dcdc
commit e4ef392d11
7 changed files with 45 additions and 4 deletions

View File

@ -11,7 +11,7 @@
/* Basic information about this app */
$setup_info['api']['name'] = 'api';
$setup_info['api']['title'] = 'EGroupware API';
$setup_info['api']['version'] = '23.1.003';
$setup_info['api']['version'] = '23.1.004';
$setup_info['api']['versions']['current_header'] = '1.29';
// maintenance release in sync with changelog in doc/rpm-build/debian.changes
$setup_info['api']['versions']['maintenance_release'] = '23.1.20230728';

View File

@ -397,8 +397,12 @@ $phpgw_baseline = array(
'share_writable' => array('type' => 'int','precision' => '1','nullable' => False,'default' => '0','comment' => '0=readable, 1=writable'),
'share_with' => array('type' => 'varchar','precision' => '4096','comment' => 'email addresses, comma seperated'),
'share_passwd' => array('type' => 'varchar','precision' => '128','comment' => 'optional password-hash'),
'share_password' => array('type' => 'varchar', 'precision' => '128',
'share_pw_reversable' => array('type' => 'varchar', 'precision' => '128',
'comment' => 'optional reversible password'),
'share_encryption' => array('type' => 'int', 'nullable' => true,
'comment' => 'Type of encryption, user or system (See Credentials)'),
'share_modified' => array('type' => 'timestamp', 'precision' => '8', 'nullable' => False),
'share_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4'),
'share_created' => array('type' => 'timestamp','nullable' => False,'comment' => 'creation date'),
'share_last_accessed' => array('type' => 'timestamp','comment' => 'last access of share')
),

View File

@ -913,4 +913,23 @@ function api_upgrade23_1_002()
));
return $GLOBALS['setup_info']['api']['currentver'] = '23.1.003';
}
function api_upgrade23_1_003()
{
$GLOBALS['egw_setup']->oProc->RenameColumn('egw_sharing', 'share_password', 'share_pw_reversable');
$GLOBALS['egw_setup']->oProc->AddColumn('egw_sharing', 'share_encryption',
array(
'type' => 'int', 'nullable' => true,
'comment' => 'Type of encryption, user or system (See Credentials)'
)
);
$GLOBALS['egw_setup']->oProc->AddColumn('egw_sharing', 'share_modified',
array('type' => 'timestamp', 'precision' => '8', 'nullable' => False),
);
$GLOBALS['egw_setup']->oProc->AddColumn('egw_sharing', 'share_modifier',
array('type' => 'int', 'meta' => 'user', 'precision' => '4')
);
return $GLOBALS['setup_info']['api']['currentver'] = '23.1.004';
}

View File

@ -650,6 +650,8 @@ class Sharing
'share_token' => self::token(),
'share_path' => $path,
'share_owner' => Vfs::$user,
'share_modified' => (new DateTime('now', DateTime::$server_timezone))->format('ts'),
'share_modifier' => Vfs::$user,
'share_with' => implode(',', (array)$recipients),
'share_created' => time(),
)+$extra, false, __LINE__, __FILE__, Db::API_APPNAME);

View File

@ -101,6 +101,10 @@ class filemanager_hooks
'Quota' => Egw::link('/index.php', 'menuaction=filemanager.filemanager_admin.quota&ajax=true'),
'VFS mounts and versioning' => Egw::link('/index.php', 'menuaction=filemanager.filemanager_admin.index&ajax=true'),
);
if($GLOBALS['egw_info']['user']['apps']['stylite'])
{
$file['Sharing'] = Egw::link('/index.php', 'menuaction=filemanager.filemanager_shares.index&admin=true&ajax=true');
}
if ($location == 'admin')
{
display_section(self::$appname,$file);

View File

@ -91,7 +91,10 @@ class filemanager_shares extends filemanager_ui
}
unset($query['col_filter']['share_passwd']);
$query['col_filter']['share_owner'] = $GLOBALS['egw_info']['user']['account_id'];
if(!$query['admin'] || !isset($GLOBALS['egw_info']['apps']['admin']))
{
$query['col_filter']['share_owner'] = $GLOBALS['egw_info']['user']['account_id'];
}
$readonlys = null;
$total = Sharing::so()->get_rows($query, $rows, $readonlys);
@ -142,7 +145,7 @@ class filemanager_shares extends filemanager_ui
'group' => 1,
'icon' => 'edit',
'allowOnMultiple' => false,
'popup' => '500x200',
'popup' => '600x200',
'url' => 'menuaction=stylite.stylite_filemanager.edit_share&share_id=$id',
'disableIfNoEPL' => true
),
@ -204,6 +207,11 @@ class filemanager_shares extends filemanager_ui
unset($content['nm']['id']);
}
$content['is_setup'] = self::$is_setup;
$content['nm']['admin'] = $content['nm']['admin'] || !empty($GLOBALS['egw_info']['user']['apps']['admin']) && $_GET['admin'];
if($content['nm']['admin'])
{
$content['nm']['columnselection_pref'] = "filemanager.shares.rows-admin";
}
$sel_options = array(
'type' => Sharing::$modes,
@ -215,6 +223,7 @@ class filemanager_shares extends filemanager_ui
unset($sel_options['type'][Sharing::ATTACH]);
$tpl = new Etemplate('filemanager.shares');
$tpl->set_dom_id($tpl->name . ($content['nm']['admin'] ? '-admin' : ''));
$tpl->exec('filemanager.filemanager_shares.index', $content, $sel_options, null, $content);
}
}

View File

@ -4,6 +4,7 @@
<template id="filemanager.shares.rows" template="" lang="" group="0" version="14.2.001">
<grid width="100%">
<columns>
<column width="10%" disabled="!@admin"/>
<column width="30%"/>
<column width="100"/>
<column width="30%"/>
@ -14,6 +15,7 @@
</columns>
<rows>
<row class="th">
<et2-nextmatch-header-account id="share_owner" emptyLabel="Shared from"/>
<nextmatch-sortheader label="Path" id="share_path"/>
<et2-nextmatch-header-filter id="type" emptyLabel="All types"/>
<nextmatch-header label="Shared with" id="shared_with"/>
@ -23,6 +25,7 @@
<nextmatch-sortheader label="Last accessed" id="share_last_accessed"/>
</row>
<row>
<et2-select-account_ro id="${row}[share_owner]"/>
<vfs id="${row}[share_path]"/>
<et2-select id="${row}[type]" readonly="true"></et2-select>
<et2-description id="${row}[share_with]"></et2-description>