mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Etemplate: Fix taglist-account would reject most values
This commit is contained in:
parent
a05c66f32c
commit
121d5f82ef
@ -515,6 +515,22 @@ class Select extends Etemplate\Widget
|
||||
//error_log(__METHOD__."('$name', TRUE) options=".array2string($options).' --> values='.array2string($values));
|
||||
$options = $values;
|
||||
}
|
||||
else if (end($options) && is_array(end($options)) && isset(end($options)['value']))
|
||||
{
|
||||
$values = array();
|
||||
foreach($options as $index => $option)
|
||||
{
|
||||
if(is_array($option) && isset($option['value']))
|
||||
{
|
||||
$values[$option['value']] = $option['label'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[$index] = $option;
|
||||
}
|
||||
}
|
||||
$options = $values;
|
||||
}
|
||||
//error_log(__METHOD__."('$name') returning ".array2string($options));
|
||||
return $options;
|
||||
}
|
||||
|
@ -144,6 +144,28 @@ class Taglist extends Etemplate\Widget
|
||||
|
||||
foreach((array) $value as $key => $val)
|
||||
{
|
||||
if($this->type == 'taglist-account')
|
||||
{
|
||||
// If in allowed options, skip account check to support app-specific options
|
||||
if(count($allowed) > 0 && in_array($val, $allowed)) continue;
|
||||
// validate accounts independent of options know to server
|
||||
$account_type = $this->attrs['account_type'] ? $this->attrs['account_type'] : 'accounts';
|
||||
$type = $GLOBALS['egw']->accounts->exists($val);
|
||||
//error_log(__METHOD__."($cname,...) form_name=$form_name, widget_type=$widget_type, account_type=$account_type, type=$type");
|
||||
if (!$type || $type == 1 && in_array($account_type, array('groups', 'owngroups', 'memberships')) ||
|
||||
$type == 2 && $account_type == 'users' ||
|
||||
in_array($account_type, array('owngroups', 'memberships')) &&
|
||||
!in_array($val, $GLOBALS['egw']->accounts->memberships(
|
||||
$GLOBALS['egw_info']['user']['account_id'], true))
|
||||
)
|
||||
{
|
||||
self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val,
|
||||
!$type?'not found' : ($type == 1 ? 'user' : 'group')),'');
|
||||
$value = '';
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(count($allowed) && !$this->attrs['allowFreeEntries'] && !array_key_exists($val,$allowed))
|
||||
{
|
||||
self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($allowed))),'');
|
||||
|
Loading…
Reference in New Issue
Block a user