Skip to content

Commit

Permalink
change project attachment permissions to include bot uploaders (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHuynh333 authored Sep 13, 2024
1 parent b4a071e commit a7011a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/models/member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,20 @@ def can_view_attachments?(user, object_namespace, include_group_links = true) #
end

def can_create_attachment?(user, object_namespace, include_group_links = true) # rubocop:disable Style/OptionalBooleanParameter
effective_access_level = effective_access_level(object_namespace, user, include_group_links)
return true if (effective_access_level == Member::AccessLevel::UPLOADER) && Current.token&.active?

Member::AccessLevel.manageable.include?(
effective_access_level(object_namespace, user, include_group_links)
effective_access_level
)
end

def can_destroy_attachment?(user, object_namespace, include_group_links = true) # rubocop:disable Style/OptionalBooleanParameter
effective_access_level = effective_access_level(object_namespace, user, include_group_links)
return true if (effective_access_level == Member::AccessLevel::UPLOADER) && Current.token&.active?

Member::AccessLevel.manageable.include?(
effective_access_level(object_namespace, user, include_group_links)
effective_access_level
)
end

Expand Down

0 comments on commit a7011a8

Please sign in to comment.