Add All users permission option

This commit is contained in:
Nathan Gray 2012-06-05 21:50:34 +00:00
parent fc3c054025
commit f3f0406471
4 changed files with 17 additions and 9 deletions

View File

@ -47,7 +47,7 @@ class importexport_definitions_bo {
$this_membership = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true);
$this_membership[] = $GLOBALS['egw_info']['user']['account_id'];
$sql .= ' (';
$read = array();
$read = array('all');
foreach($this_membership as $id)
{
$read[] = 'allowed_users '.
@ -65,10 +65,10 @@ class importexport_definitions_bo {
// Strip off leading + trailing ,
$row['allowed_users'] = substr($row['allowed_users'],1,-1);
$readonlys["edit[{$row['definition_id']}]"] = $readonlys["delete[{$row['definition_id']}]"] =
$readonlys["edit[{$row['definition_id']}]"] = $readonlys["delete[{$row['definition_id']}]"] =
($row['owner'] != $GLOBALS['egw_info']['user']['account_id']) &&
!$GLOBALS['egw_info']['user']['apps']['admin'];
if($readonlys["edit[{$row['definition_id']}]"])
if($readonlys["edit[{$row['definition_id']}]"])
{
$row['class'] .= 'rowNoEdit';
$ro_count++;
@ -139,6 +139,7 @@ class importexport_definitions_bo {
$this_user_id = $GLOBALS['egw_info']['user']['account_id'];
$this_membership = $GLOBALS['egw']->accounts->memberships($this_user_id, true);
$this_membership[] = $this_user_id;
$this_membership[] = 'all';
$alluser = array_intersect($allowed_user,$this_membership);
return ($this_user_id == $_definition['owner'] || count($alluser) > 0);
}
@ -220,6 +221,8 @@ class importexport_definitions_bo {
{
// convert allowed_user
$definition_data['allowed_users'] = importexport_helper_functions::account_name2id( $definition_data['allowed_users'] );
if($definition_data['all_users'] && !$definition_data['allowed_users']) $definition_data['allowed_users'] = 'all';
$definition_data['owner'] = importexport_helper_functions::account_name2id( $definition_data['owner'] );
$definition = new importexport_definition( $definition_data['name'] );

View File

@ -171,7 +171,7 @@ class importexport_definitions_ui
'import' => lang('import'),
'export' => lang('export'),
),
'allowed_users' => array(null => lang('Private'))
'allowed_users' => array(null => lang('Private'), 'all' => lang('all'))
);
foreach ($this->plugins as $appname => $options)
{
@ -813,7 +813,7 @@ class importexport_definitions_ui
$content['owner'] = $content['just_me'] || !$GLOBALS['egw']->acl->check('share_definitions', EGW_ACL_READ,'importexport') ?
($content['owner'] ? $content['owner'] : $GLOBALS['egw_info']['user']['account_id']) :
null;
$content['allowed_users'] = $content['just_me'] ? '' : implode(',',$content['allowed_users']);
$content['allowed_users'] = $content['just_me'] ? '' : ($content['all_users'] ? 'all' : implode(',',$content['allowed_users']));
unset($content['just_me']);
}
@ -843,6 +843,7 @@ class importexport_definitions_ui
$content['allowed_users'] = array();
$readonlys['allowed_users'] = true;
$readonlys['just_me'] = true;
$readonlys['all_users'] = true;
$content['just_me'] = true;
}
@ -851,6 +852,10 @@ class importexport_definitions_ui
{
$content['no_just_me'] = true;
}
if($readonlys['all_users'] || !$this->can_edit($content))
{
$content['no_all_users'] = true;
}
unset ($preserv['button']);
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][next]');");
if(is_object($this->response)) {

File diff suppressed because one or more lines are too long

View File

@ -74,7 +74,7 @@
<description value="Change owner" class="promptheader"/>
<description value="Select owner"/>
<menulist class="action_popup-content">
<menupopup type="select-account" id="owner" options="None,users"/>
<menupopup type="select-account" id="owner" options="None,accounts"/>
</menulist>
<hbox>
<button label="Save" onclick="nm_submit_popup(this); return false;"/>