CCI-MOC / hil

Hardware Isolation Layer, formerly Hardware as a Service
Apache License 2.0
24 stars 54 forks source link

Clean up redundant auth check pattern. #902

Closed zenhack closed 6 years ago

zenhack commented 6 years ago

This generalizes the interface for {require,have}_project_access, so that passing None is valid, and equivalent to {require,have}_admin. This lets us simplify a whole bunch of stuff like this:

if project is None:
    require_admin()
else:
    require_project_access(project)

This also fixes #623, as there is already a check requiring the argument to be an instance of Project.

I seem to recall someone pointing out the redundency recently, but I can't remember who.

naved001 commented 6 years ago

I seem to recall someone pointing out the redundency recently, but I can't remember who.

This comment by @vsemp With this and #886 we can close #536

zenhack commented 6 years ago

Quoting Naved Ansari (2017-10-22 03:21:15)

This comment by @vsemp

Aha.

naved001 commented 6 years ago

@SahilTikale, @izhmash

It's a small pr, any of you want to review this?

naved001 commented 6 years ago

@Izhmash thanks for the late night review haha!

ianballou commented 6 years ago

No prob! although the build is erroring out, hmm.

naved001 commented 6 years ago

hmm, looks like it can't find a keystone commit that we install. unrelated to this PR; will look into it tomorrow morning. In the meanwhile I restarted the build (just to be sure)

jeremyfreudberg commented 6 years ago

@naved001 stable/newton branch is/was EOL and very recently pruned from keystone. (the name stable/newton is no longer a valid git reference, although obviously you can still checkout any specific hash you want)