Skip to content

Commit

Permalink
fix regression
Browse files Browse the repository at this point in the history
  • Loading branch information
dr3mro committed Dec 18, 2024
1 parent 4e8e024 commit 373945c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/entities/base/entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Entity : public Base
std::string columns = fmt::format("{}", fmt::join(keys_arr, ","));
std::string values = fmt::format("'{}'", fmt::join(values_arr, "','"));

query = fmt::format("INSERT INTO {} ({}) VALUES ({}) RETURNING id;", tablename, columns, values);
query = fmt::format("INSERT INTO {} ({}) VALUES ({}) RETURNING *;", tablename, columns, values);
}
catch (const std::exception &e)
{
Expand Down Expand Up @@ -101,7 +101,7 @@ class Entity : public Base
}
}

query = fmt::format("UPDATE {} set {} WHERE id={} returning id;", tablename, update_column_values, id.value());
query = fmt::format("UPDATE {} set {} WHERE id={} returning *;", tablename, update_column_values, id.value());
}
catch (const std::exception &e)
{
Expand Down
10 changes: 7 additions & 3 deletions src/gatekeeper/permissionmanager/permissionmanager_private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,15 @@ bool api::v2::PermissionManagerPrivate::preServiceCreateChecks(const Requester&
bool api::v2::PermissionManagerPrivate::isOwnerOrAdminOrHasPermission(
const Requester& requester, const std::optional<jsoncons::json>& permissions_j, const std::string& service_name, Http::Error& error)
{
if (!this->isOwnerOrAdmin(requester, permissions_j, service_name, error) ||
!this->hasPermission(requester, permissions_j, Permissions::PowerLevel::CAN_DELETE, service_name, error))
if (this->isOwnerOrAdmin(requester, permissions_j, service_name, error))
{
return true;
}

if (!this->hasPermission(requester, permissions_j, Permissions::PowerLevel::CAN_DELETE, service_name, error))
{
error.code = Http::Status::FORBIDDEN;
error.message = fmt::format("You don't have the permission to delete {} {}", service_name, error.message);
error.message = fmt::format("You don't have the permission to manage {} {}", service_name, error.message);
return false;
}
return true;
Expand Down

0 comments on commit 373945c

Please sign in to comment.