Skip to content

Commit

Permalink
fixed root perm check for granrable
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
  • Loading branch information
MBoldyrev committed Aug 28, 2019
1 parent 94a6fb4 commit 355d420
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions irohad/ametsuchi/impl/postgres_command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,10 @@ namespace {
const shared_model::interface::types::AccountIdType &account_id) {
return (boost::format(R"(WITH
has_role_perm AS (%s),
has_root_perm AS (%s),
has_grantable_perm AS (%s)
SELECT CASE
WHEN (SELECT * FROM has_root_perm) THEN true
WHEN (SELECT * FROM has_grantable_perm) THEN true
WHEN (%s = %s) THEN
CASE
Expand All @@ -334,6 +336,7 @@ namespace {
ELSE false END
)")
% checkAccountRolePermission(role, creator_id)
% checkAccountRolePermission(Role::kRoot, creator_id)
% checkAccountGrantablePermission(grantable, creator_id, account_id)
% creator_id % account_id)
.str();
Expand Down

0 comments on commit 355d420

Please sign in to comment.