Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c1f060759 | |||
| aad46ec80a | |||
| f5e9f0610d | |||
| 14a5250cd7 | |||
| 6e6edef57d | |||
| d3810db965 | |||
| 187a012284 | |||
| b3d2662fd2 | |||
| 1189aecae9 | |||
| 024d6d2d7a | |||
| f2d5377347 | |||
| af11bd8199 | |||
| 0e6a43a2c2 | |||
| 94eeaaaa51 | |||
| 4a246bec5f | |||
| 46b2b60718 | |||
| 9616d956cb |
@@ -1 +1 @@
|
|||||||
8.0.6
|
8.2.1
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ source .env.deploy;
|
|||||||
cd -;
|
cd -;
|
||||||
set +o allexport;
|
set +o allexport;
|
||||||
|
|
||||||
|
echo "[START]";
|
||||||
# gitea
|
# gitea
|
||||||
if [ ! -z "${GITEA_USER}" ] && [ ! -z "${GITEA_TOKEN}" ]; then
|
if [ ! -z "${GITEA_USER}" ] && [ ! -z "${GITEA_TOKEN}" ]; then
|
||||||
curl -LJO \
|
curl -LJO \
|
||||||
@@ -56,5 +57,7 @@ if [ ! -z "${GITLAB_DEPLOY_TOKEN}" ]; then
|
|||||||
else
|
else
|
||||||
echo "Missing GITLAB_DEPLOY_TOKEN environment variable";
|
echo "Missing GITLAB_DEPLOY_TOKEN environment variable";
|
||||||
fi;
|
fi;
|
||||||
|
echo "";
|
||||||
|
echo "[DONE]";
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ declare(strict_types=1);
|
|||||||
namespace CoreLibs\ACL;
|
namespace CoreLibs\ACL;
|
||||||
|
|
||||||
use CoreLibs\Check\Password;
|
use CoreLibs\Check\Password;
|
||||||
|
use CoreLibs\Convert\Json;
|
||||||
|
|
||||||
class Login
|
class Login
|
||||||
{
|
{
|
||||||
@@ -428,7 +429,7 @@ class Login
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set options
|
* Set options
|
||||||
* Current allowed
|
* Current allowed:
|
||||||
* target <string>: site target
|
* target <string>: site target
|
||||||
* debug <bool>
|
* debug <bool>
|
||||||
* auto_login <bool>: self start login process
|
* auto_login <bool>: self start login process
|
||||||
@@ -753,7 +754,10 @@ class Login
|
|||||||
// we have to get the themes in here too
|
// we have to get the themes in here too
|
||||||
$q = "SELECT eu.edit_user_id, eu.username, eu.password, "
|
$q = "SELECT eu.edit_user_id, eu.username, eu.password, "
|
||||||
. "eu.edit_group_id, "
|
. "eu.edit_group_id, "
|
||||||
. "eg.name AS edit_group_name, admin, "
|
. "eg.name AS edit_group_name, eu.admin, "
|
||||||
|
// additinal acl lists
|
||||||
|
. "eu.additional_acl AS user_additional_acl, "
|
||||||
|
. "eg.additional_acl AS group_additional_acl, "
|
||||||
// login error + locked
|
// login error + locked
|
||||||
. "eu.login_error_count, eu.login_error_date_last, "
|
. "eu.login_error_count, eu.login_error_date_last, "
|
||||||
. "eu.login_error_date_first, eu.strict, eu.locked, "
|
. "eu.login_error_date_first, eu.strict, eu.locked, "
|
||||||
@@ -901,8 +905,10 @@ class Login
|
|||||||
$_SESSION['GROUP_NAME'] = $res['edit_group_name'];
|
$_SESSION['GROUP_NAME'] = $res['edit_group_name'];
|
||||||
$_SESSION['USER_ACL_LEVEL'] = $res['user_level'];
|
$_SESSION['USER_ACL_LEVEL'] = $res['user_level'];
|
||||||
$_SESSION['USER_ACL_TYPE'] = $res['user_type'];
|
$_SESSION['USER_ACL_TYPE'] = $res['user_type'];
|
||||||
|
$_SESSION['USER_ADDITIONAL_ACL'] = Json::jsonConvertToArray($res['user_additional_acl']);
|
||||||
$_SESSION['GROUP_ACL_LEVEL'] = $res['group_level'];
|
$_SESSION['GROUP_ACL_LEVEL'] = $res['group_level'];
|
||||||
$_SESSION['GROUP_ACL_TYPE'] = $res['group_type'];
|
$_SESSION['GROUP_ACL_TYPE'] = $res['group_type'];
|
||||||
|
$_SESSION['GROUP_ADDITIONAL_ACL'] = Json::jsonConvertToArray($res['group_additional_acl']);
|
||||||
// deprecated TEMPLATE setting
|
// deprecated TEMPLATE setting
|
||||||
$_SESSION['TEMPLATE'] = $res['template'] ? $res['template'] : '';
|
$_SESSION['TEMPLATE'] = $res['template'] ? $res['template'] : '';
|
||||||
$_SESSION['HEADER_COLOR'] = !empty($res['second_header_color']) ?
|
$_SESSION['HEADER_COLOR'] = !empty($res['second_header_color']) ?
|
||||||
@@ -1021,7 +1027,8 @@ class Login
|
|||||||
$_SESSION['PAGES'] = $pages;
|
$_SESSION['PAGES'] = $pages;
|
||||||
$_SESSION['PAGES_ACL_LEVEL'] = $pages_acl;
|
$_SESSION['PAGES_ACL_LEVEL'] = $pages_acl;
|
||||||
// load the edit_access user rights
|
// load the edit_access user rights
|
||||||
$q = "SELECT ea.edit_access_id, level, type, ea.name, ea.color, ea.uid, edit_default "
|
$q = "SELECT ea.edit_access_id, level, type, ea.name, "
|
||||||
|
. "ea.color, ea.uid, edit_default, ea.additional_acl "
|
||||||
. "FROM edit_access_user eau, edit_access_right ear, edit_access ea "
|
. "FROM edit_access_user eau, edit_access_right ear, edit_access ea "
|
||||||
. "WHERE eau.edit_access_id = ea.edit_access_id "
|
. "WHERE eau.edit_access_id = ea.edit_access_id "
|
||||||
. "AND eau.edit_access_right_id = ear.edit_access_right_id "
|
. "AND eau.edit_access_right_id = ear.edit_access_right_id "
|
||||||
@@ -1048,6 +1055,7 @@ class Login
|
|||||||
'uid' => $res['uid'],
|
'uid' => $res['uid'],
|
||||||
'color' => $res['color'],
|
'color' => $res['color'],
|
||||||
'default' => $res['edit_default'],
|
'default' => $res['edit_default'],
|
||||||
|
'additional_acl' => Json::jsonConvertToArray($res['additional_acl']),
|
||||||
'data' => $ea_data
|
'data' => $ea_data
|
||||||
];
|
];
|
||||||
// set the default unit
|
// set the default unit
|
||||||
@@ -1122,6 +1130,11 @@ class Login
|
|||||||
// username (login), group name
|
// username (login), group name
|
||||||
$this->acl['user_name'] = $_SESSION['USER_NAME'];
|
$this->acl['user_name'] = $_SESSION['USER_NAME'];
|
||||||
$this->acl['group_name'] = $_SESSION['GROUP_NAME'];
|
$this->acl['group_name'] = $_SESSION['GROUP_NAME'];
|
||||||
|
// set additional acl
|
||||||
|
$this->acl['additional_acl'] = [
|
||||||
|
'user' => $_SESSION['USER_ADDITIONAL_ACL'],
|
||||||
|
'group' => $_SESSION['GROUP_ADDITIONAL_ACL'],
|
||||||
|
];
|
||||||
// we start with the default acl
|
// we start with the default acl
|
||||||
$this->acl['base'] = $this->default_acl_level;
|
$this->acl['base'] = $this->default_acl_level;
|
||||||
|
|
||||||
@@ -1184,7 +1197,8 @@ class Login
|
|||||||
'uid' => $unit['uid'],
|
'uid' => $unit['uid'],
|
||||||
'level' => $this->default_acl_list[$this->acl['unit'][$ea_id]]['name'] ?? -1,
|
'level' => $this->default_acl_list[$this->acl['unit'][$ea_id]]['name'] ?? -1,
|
||||||
'default' => $unit['default'],
|
'default' => $unit['default'],
|
||||||
'data' => $unit['data']
|
'data' => $unit['data'],
|
||||||
|
'additional_acl' => $unit['additional_acl']
|
||||||
];
|
];
|
||||||
// set default
|
// set default
|
||||||
if (!empty($unit['default'])) {
|
if (!empty($unit['default'])) {
|
||||||
|
|||||||
596
src/DB/IO.php
596
src/DB/IO.php
File diff suppressed because it is too large
Load Diff
@@ -42,6 +42,15 @@ interface SqlFunctions
|
|||||||
*/
|
*/
|
||||||
public function __dbSendQuery(string $query): bool;
|
public function __dbSendQuery(string $query): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param string $query
|
||||||
|
* @param array<mixed> $params
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function __dbSendQueryParams(string $query, array $params): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -74,6 +83,24 @@ interface SqlFunctions
|
|||||||
*/
|
*/
|
||||||
public function __dbExecute(string $name, array $data): \PgSql\Result|false;
|
public function __dbExecute(string $name, array $data): \PgSql\Result|false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $query
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function __dbSendPrepare(string $name, string $query): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param array<mixed> $params
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function __dbSendExecute(string $name, array $params): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -99,6 +126,15 @@ interface SqlFunctions
|
|||||||
*/
|
*/
|
||||||
public function __dbFieldName(\PgSql\Result|false $cursor, int $i): string|false;
|
public function __dbFieldName(\PgSql\Result|false $cursor, int $i): string|false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param \PgSql\Result|false $cursor
|
||||||
|
* @param int $i
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
public function __dbFieldType(\PgSql\Result|false $cursor, int $i): string|false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -33,7 +33,11 @@
|
|||||||
* pg_affected_rows (*)
|
* pg_affected_rows (*)
|
||||||
* pg_fetch_array
|
* pg_fetch_array
|
||||||
* pg_query
|
* pg_query
|
||||||
|
* pg_query_params
|
||||||
* pg_send_query
|
* pg_send_query
|
||||||
|
* pg_send_query_params
|
||||||
|
* pg_send_prepare
|
||||||
|
* pg_send_execute
|
||||||
* pg_get_result
|
* pg_get_result
|
||||||
* pg_connection_busy
|
* pg_connection_busy
|
||||||
* pg_close
|
* pg_close
|
||||||
@@ -50,6 +54,7 @@ namespace CoreLibs\DB\SQL;
|
|||||||
// below no ignore is needed if we want to use PgSql interface checks with PHP 8.0
|
// below no ignore is needed if we want to use PgSql interface checks with PHP 8.0
|
||||||
// as main system. Currently all @var sets are written as object
|
// as main system. Currently all @var sets are written as object
|
||||||
/** @#phan-file-suppress PhanUndeclaredTypeProperty,PhanUndeclaredTypeParameter,PhanUndeclaredTypeReturnType */
|
/** @#phan-file-suppress PhanUndeclaredTypeProperty,PhanUndeclaredTypeParameter,PhanUndeclaredTypeReturnType */
|
||||||
|
/** @phan-file-suppress PhanTypeMismatchArgumentInternal, PhanTypeMismatchReturn */
|
||||||
|
|
||||||
class PgSQL implements Interface\SqlFunctions
|
class PgSQL implements Interface\SqlFunctions
|
||||||
{
|
{
|
||||||
@@ -93,8 +98,7 @@ class PgSQL implements Interface\SqlFunctions
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proposed
|
* wrapper for pg_query_params for queries in the style of
|
||||||
* wrapperf or pg_query_params for queries in the style of
|
|
||||||
* SELECT foo FROM bar WHERE foobar = $1
|
* SELECT foo FROM bar WHERE foobar = $1
|
||||||
*
|
*
|
||||||
* @param string $query Query string with placeholders $1, ..
|
* @param string $query Query string with placeholders $1, ..
|
||||||
@@ -132,6 +136,22 @@ class PgSQL implements Interface\SqlFunctions
|
|||||||
return $result ? true : false;
|
return $result ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sends an async query to the server with params
|
||||||
|
*
|
||||||
|
* @param string $query Query string with placeholders $1, ..
|
||||||
|
* @param array<mixed> $params Matching parameters for each placerhold
|
||||||
|
* @return bool true/false Query sent successful status
|
||||||
|
*/
|
||||||
|
public function __dbSendQueryParams(string $query, array $params): bool
|
||||||
|
{
|
||||||
|
if (is_bool($this->dbh)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$result = pg_send_query_params($this->dbh, $query, $params);
|
||||||
|
return $result ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wrapper for pg_get_result
|
* wrapper for pg_get_result
|
||||||
*
|
*
|
||||||
@@ -208,6 +228,38 @@ class PgSQL implements Interface\SqlFunctions
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asnyc send for a prepared statement
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $query
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function __dbSendPrepare(string $name, string $query): bool
|
||||||
|
{
|
||||||
|
if (is_bool($this->dbh)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$result = pg_send_prepare($this->dbh, $name, $query);
|
||||||
|
return $result ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asnyc ssend for a prepared statement execution
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param array<mixed> $params
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function __dbSendExecute(string $name, array $params): bool
|
||||||
|
{
|
||||||
|
if (is_bool($this->dbh)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$result = pg_send_execute($this->dbh, $name, $params);
|
||||||
|
return $result ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wrapper for pg_num_rows
|
* wrapper for pg_num_rows
|
||||||
*
|
*
|
||||||
@@ -251,6 +303,21 @@ class PgSQL implements Interface\SqlFunctions
|
|||||||
return pg_field_name($cursor, $i);
|
return pg_field_name($cursor, $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wrapper for pg_field_name
|
||||||
|
*
|
||||||
|
* @param \PgSql\Result|false $cursor cursor
|
||||||
|
* @param int $i field position
|
||||||
|
* @return string|false field type name or false
|
||||||
|
*/
|
||||||
|
public function __dbFieldType(\PgSql\Result|false $cursor, int $i): string|false
|
||||||
|
{
|
||||||
|
if (is_bool($cursor)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return pg_field_type($cursor, $i);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wrapper for pg_fetch_array
|
* wrapper for pg_fetch_array
|
||||||
* if through/true false, use __dbResultType(true)
|
* if through/true false, use __dbResultType(true)
|
||||||
|
|||||||
@@ -267,6 +267,8 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
'GROUP_ACL_LEVEL' => -1,
|
'GROUP_ACL_LEVEL' => -1,
|
||||||
'PAGES_ACL_LEVEL' => [],
|
'PAGES_ACL_LEVEL' => [],
|
||||||
'USER_ACL_LEVEL' => -1,
|
'USER_ACL_LEVEL' => -1,
|
||||||
|
'USER_ADDITIONAL_ACL' => [],
|
||||||
|
'GROUP_ADDITIONAL_ACL' => [],
|
||||||
'UNIT_UID' => [
|
'UNIT_UID' => [
|
||||||
'AdminAccess' => 1,
|
'AdminAccess' => 1,
|
||||||
],
|
],
|
||||||
@@ -280,6 +282,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
'data' => [
|
'data' => [
|
||||||
'test' => 'value',
|
'test' => 'value',
|
||||||
],
|
],
|
||||||
|
'additional_acl' => []
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
// 'UNIT_DEFAULT' => '',
|
// 'UNIT_DEFAULT' => '',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user