Commit Graph

8 Commits

Author SHA1 Message Date
Cristian A Sanchez
6b26ecaf75 Change references of tenant to project
Refernces from tenant to project were made in several
places, including DB, HTTP Headers, configuration items,
json in responses and devstack integration. Additionally,
a migration script using Alembic was included.

Implements: blueprint tenant-to-project-ref
Change-Id: I4b21182f555ccd412a4ca4e0ce753f07edcd07f8
2014-04-17 11:16:09 -03:00
Sylvain Bauza
eb0c81f95a Port to Pecan/WSME for API v2
Routing either V1 or V2 using a Facade. By default, V1 is enabled
but can be deactivated by a confflag.

Pecan controller for Lease created using WSME i/o validation

Implements blueprint: pecan-wsme

Change-Id: I9047abece78632daa13fdebfea9fb8aaa3c60981
2014-03-31 13:45:48 +02:00
Sylvain Bauza
e141b08a1e Change API v1 path to explicit module
In order to prepare API v2, we need to isolate API v1 code into a
separate module called climate.api.v1

Implements blueprint: pecan-wsme

Change-Id: I9e968370ba9ac8d21f5c099f1b09587d9f6b821e
2014-03-12 17:40:05 +01:00
Yuriy Taraday
573fb0cc1f Remove explicit access to is_admin in context
is_admin should not be exlicitely accessed from code. Policies should be
used to check if it's set and context.elevated() to run something in
admin context.

Change-Id: I27754a378073844c3e24d94038a5d24f9a3c6dc3
2014-02-19 17:05:41 +04:00
Nikolaj Starodubtsev
19cc43f79a Add utils to work with OpenStack components
Add utils to do basic actions with nova and keystone.
We decide to store in utils/openstack/%service_name.py service
specific clients in classes named like Climate%service_name%Client.
In this classes we define service client with specific variables.
Also, we redefine __getattr__ like this:

   def __getattr__(self, name):
       fn = getattr(self.%service_name, name)
       return fn

Change-Id: I47e0d8689f1d8ca8aba0372eb5e7a4a80f2f9be5
2014-01-22 20:42:18 +04:00
sbauza
9fc6b17f87 Filter DB queries per project_id
Currently, DB queries don't filter on project_id, so any user can
request all DB entries.

The proposal here is to filter if the table does support tenant_id
in it and if the user is not admin (based on Nova/Cinder/Oslo)

In order to automatically provide the correct is_admin flag, now
when creating the context we check if policy defines the user as
admin.

Closes-Bug: #1256117

Change-Id: I85c404f5a3365c6a9c575af52f1a116f8350f426
2014-01-21 17:20:38 +01:00
Yuriy Taraday
ea0c144b13 Refactor context module to make it more flexible
- context data is stored in a dictionary now, so any key is allowed;
- list of allowed key for certain context is stored in special class
  variable;
- methods "current" and "elevated" of ClimateContext class are
  accessible from module level;
- moved to usage of threading.local instead of emulating one in code (as
  long as we use eventlet's monkey-patching, it's specific local() will
  be used).

Change-Id: I3c79c9cd0d16dfb5c61208f2aa71b5c59f3f40f3
2013-11-25 14:10:23 +04:00
Nikolaj Starodubtsev
671eb6a515 Add unit tests to api functionality
Change-Id: Iae5d8a69d9fb0fa272aa0535f84c0ceeba6dd4d9
2013-11-20 11:40:14 +04:00