mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
WIP: AWS CS controller
This commit is contained in:
parent
5658b98f0b
commit
c11cd556ce
@ -1048,7 +1048,7 @@ class Wizard
|
|||||||
*/
|
*/
|
||||||
public static function printBigButtonsList($list_data)
|
public static function printBigButtonsList($list_data)
|
||||||
{
|
{
|
||||||
echo '<ul>';
|
echo '<ul class="bigbuttonlist">';
|
||||||
array_map('self::printBigButtonElement', $list_data);
|
array_map('self::printBigButtonElement', $list_data);
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
|
@ -72,41 +72,6 @@ function credentials_get_all(
|
|||||||
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($order)) {
|
|
||||||
$dir = 'asc';
|
|
||||||
if ($order == 'desc') {
|
|
||||||
$dir = 'desc';
|
|
||||||
};
|
|
||||||
|
|
||||||
if (in_array(
|
|
||||||
$sort_field,
|
|
||||||
[
|
|
||||||
'group',
|
|
||||||
'identifier',
|
|
||||||
'product',
|
|
||||||
'username',
|
|
||||||
'options',
|
|
||||||
]
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
$order_by = sprintf(
|
|
||||||
'ORDER BY `%s` %s',
|
|
||||||
$sort_field,
|
|
||||||
$dir
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($limit) && $limit > 0
|
|
||||||
&& isset($offset) && $offset >= 0
|
|
||||||
) {
|
|
||||||
$pagination = sprintf(
|
|
||||||
' LIMIT %d OFFSET %d ',
|
|
||||||
$limit,
|
|
||||||
$offset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
||||||
$sql_filters[] = vsprintf(
|
$sql_filters[] = vsprintf(
|
||||||
' AND (lower(cs.username) like lower("%%%s%%")
|
' AND (lower(cs.username) like lower("%%%s%%")
|
||||||
@ -146,6 +111,48 @@ function credentials_get_all(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($filter['group_list']) && is_array($filter['group_list'])) {
|
||||||
|
$sql_filters[] = sprintf(
|
||||||
|
' AND cs.id_group IN (%s) ',
|
||||||
|
join(',', $filter['group_list'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($order)) {
|
||||||
|
$dir = 'asc';
|
||||||
|
if ($order == 'desc') {
|
||||||
|
$dir = 'desc';
|
||||||
|
};
|
||||||
|
|
||||||
|
if (in_array(
|
||||||
|
$sort_field,
|
||||||
|
[
|
||||||
|
'group',
|
||||||
|
'identifier',
|
||||||
|
'product',
|
||||||
|
'username',
|
||||||
|
'options',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$order_by = sprintf(
|
||||||
|
'ORDER BY `%s` %s',
|
||||||
|
$sort_field,
|
||||||
|
$dir
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($limit) && $limit > 0
|
||||||
|
&& isset($offset) && $offset >= 0
|
||||||
|
) {
|
||||||
|
$pagination = sprintf(
|
||||||
|
' LIMIT %d OFFSET %d ',
|
||||||
|
$limit,
|
||||||
|
$offset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT %s
|
'SELECT %s
|
||||||
FROM tcredential_store cs
|
FROM tcredential_store cs
|
||||||
@ -372,3 +379,59 @@ function print_inputs($values=null)
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve all identifiers available for current user.
|
||||||
|
*
|
||||||
|
* @param string $product Target product.
|
||||||
|
*
|
||||||
|
* @return array Of account identifiers.
|
||||||
|
*/
|
||||||
|
function credentials_list_accounts($product)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
include_once $config['homedir'].'/include/functions_users.php';
|
||||||
|
|
||||||
|
static $user_groups;
|
||||||
|
|
||||||
|
if (!isset($user_groups)) {
|
||||||
|
$user_groups = users_get_groups(
|
||||||
|
$config['id_user'],
|
||||||
|
'AW'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Always add group 'ALL' because 'ALL' group credentials
|
||||||
|
// must be available for all users.
|
||||||
|
if (is_array($user_groups)) {
|
||||||
|
$user_groups = ([0] + array_keys($user_groups));
|
||||||
|
} else {
|
||||||
|
$user_groups = [0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$creds = credentials_get_all(
|
||||||
|
['identifier'],
|
||||||
|
[
|
||||||
|
'product' => $product,
|
||||||
|
'group_list' => $user_groups,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($creds === false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = array_reduce(
|
||||||
|
$creds,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['identifier']] = $item['identifier'];
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
* Discovery css global
|
* Discovery css global
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ul.bigbuttonlist {
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
li.discovery {
|
li.discovery {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
float: left;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user