manila/manila/db/sqlalchemy
Mohammed Naser cf4963c591 share_networks: enable project_only API only
At the moment, the share_network database API which the web
API layer interacts with directly does not have any checking
for project_id which means that a user has the ability to run
operations against any other share_network if they have the ID.

This patch implements the usage of project_only in the database
query which ensures that administrators still have the behaviour
of getting any share network they want, but users can only pull
up those which are part of their context/authenticated project.

This patch also adjusts a few other tests due to the fact that
the existing tests would run a lot of inserts with a different
project_id than the context, which is not allowed in this new
API behaviour.  Therefore, the instances that involved projects
different than the context were converted to elevated ones.

There was also an instance where they were being created with a
project_id that did not match the fake context, therefore the
context was adjusted accordingly as well.

Closes-Bug: #1861485
Change-Id: Id67a939a475c4ac06d546b7e095bd10f1a6d2619
(cherry picked from commit 947315f090)
(cherry picked from commit 496e6e1d2a)
(cherry picked from commit 17b29e2b50)
(cherry picked from commit d16b5f0ea4)
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-03-10 18:33:42 -07:00
..
__init__.py Address H104 File contains nothing but comments 2014-07-14 10:19:15 +02:00
api.py share_networks: enable project_only API only 2020-03-10 18:33:42 -07:00
models.py Remove confusing DB deprecation messages 2018-06-16 12:54:16 +00:00
query.py Use soft_delete() methods in DB api 2015-07-13 15:28:47 +03:00