Skip to content
Snippets Groups Projects
Verified Commit e37d4327 authored by Vivek Das Mohapatra's avatar Vivek Das Mohapatra Committed by Andrej Shadura
Browse files

Invalidate the rails cache for project meta xml in show_project_meta

The project model code path for this invalidates the cache before
returning.

Users now have different views of project meta config (references to
inaccessible projects, which were not permitted at all before, are now
elided to "HIDDEN" for users with insufficient access): This means
that the code path which provides the meta config to osc must also
invalidate the cache.

It's not clear that this particular config should be cached at all.
Possibly it should include the user context in the cache key instead
but in any case this is the least invasive way to make sure osc
returns the correct information for now.

Gbp-Pq: Topic collabora
Gbp-Pq: Name Invalidate-the-rails-cache-for-project-meta-xml-in-show_p.patch
parent d6e7a0b2
No related branches found
No related tags found
No related merge requests found
...@@ -432,6 +432,13 @@ class SourceController < ApplicationController ...@@ -432,6 +432,13 @@ class SourceController < ApplicationController
else else
# access check # access check
prj = Project.get_by_name params[:project] prj = Project.get_by_name params[:project]
# since users may now see different versions of the
# project XML depending on their access permissions
# to linked projects, and the cache is global, we must
# invalidate the cache before reconstructing the xml.
if prj.id
Rails.cache.delete("xml_project_#{prj.id}")
end
render xml: prj.to_axml render xml: prj.to_axml
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment