B #6022: Fix lock override and --all flag (#2427)

* This commit syncs oned and API specification for the ALL flag. The internal defines were not consistent with the API specification.
This commit is contained in:
Pavel Czerný authored and GitHub committed 2023-01-04 15:53:50 +01:00
1 parent 9959ceac06
commit 82d2191dfd
6 files changed
+52 -14

No files matched your search

+10 -1
View File
@@ -587,13 +587,22 @@ bool PoolObjectSQL::name_is_valid(const string& obj_name,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int PoolObjectSQL::lock_db(const int owner, const int req_id, const int level)
int PoolObjectSQL::lock_db(const int owner,
const int req_id,
const int level,
const bool is_admin)
{
if ( level < ST_NONE || level > ST_ADMIN )
{
return -1;
}
if (locked != ST_NONE && lock_owner != owner && !is_admin)
{
// Only admin can override lock
return -1;
}
locked = static_cast<LockStates>(level);
lock_time = time(0);
lock_owner = owner;