Skip to content

Commit a35646f

Browse files
fix(permissions): use forest collection name for check the permission (#616)
1 parent 780958b commit a35646f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/services/forest_liana/ability/permission.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ def is_crud_authorized?(action, user, collection)
1313

1414
user_data = get_user_data(user['id'])
1515
collections_data = get_collections_permissions_data
16+
collection_name = ForestLiana.name_for(collection)
1617

1718
begin
18-
is_allowed = collections_data[collection.name][action].include? user_data['roleId']
19+
is_allowed = collections_data[collection_name][action].include? user_data['roleId']
1920
# re-fetch if user permission is not allowed (may have been changed)
2021
unless is_allowed
2122
collections_data = get_collections_permissions_data(true)
22-
is_allowed = collections_data[collection.name][action].include? user_data['roleId']
23+
is_allowed = collections_data[collection_name][action].include? user_data['roleId']
2324
end
2425

2526
is_allowed

0 commit comments

Comments
 (0)