Skip to content

Fix permissions check in repository api [SCI-12136] #8661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: features/user-groups
Choose a base branch
from

Conversation

aignatov-bio
Copy link
Contributor

@aignatov-bio aignatov-bio commented Jul 15, 2025

Jira ticket: SCI-12136

What was done

Fix permissions check in repository api

@@ -61,7 +62,7 @@ def update
end

def destroy
@inventory_item = @task.repository_rows.find(params.require(:id))
@inventory_item = @repository_rows.find_by(id: params.require(:id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it was changed to find_by?

@@ -79,6 +80,10 @@ def load_my_module_repository_row
.find_by(my_module: @task)
end

def load_repository_rows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change it to load_repository_row and load a single row here

@aignatov-bio aignatov-bio force-pushed the ai-sci-12136-add-permission-checks-for-my-module-repository-rows branch 2 times, most recently from 9e3659f to 9931131 Compare July 17, 2025 09:04
@aignatov-bio aignatov-bio force-pushed the ai-sci-12136-add-permission-checks-for-my-module-repository-rows branch from 9931131 to db24ebd Compare July 17, 2025 13:41
raise PermissionError.new(Repository, :read) unless @inventory_item && can_read_repository?(@inventory_item.repository)

@task.my_module_repository_rows.find_by(repository_row: @inventory_item).destroy!
@task.my_module_repository_rows.find_by(repository_row: @repository_row).destroy!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to .find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants