Change Stack timestamps to save correct info

Stack.updated_time is currently being treated as modification time of
the object in the database.  Since it's not a very useful thing to have
and the CFN API treats this value as "the last time an update call was
issued", it makes sense to have the same behavior here as well.

This changes the current real-time retrieval of created_time and
updated_time in favor of the attributes already present in the stack and
changes the information stored in these two fields to be the time the
stack was created and the time the stack was last updated by the user,
respectively.

Co-Authored-By: Anderson Mesquita <andersonvom@gmail.com>
Closes-Bug: #1193269
Change-Id: I1fd6586b827b3f2babb5af5c85f9de25da74fbb6
Change Resource timestamps to save correct info

Resource.updated_time is currently being treated as modification time
of the object in the database.  Since it's not a very useful thing to
have and the CFN API treats this value as "the last time an update
call was issued", it makes sense to have the same behavior here as
well.

This changes the current real-time retrieval of created_time and
updated_time in favor of the attributes already present in the
resource and changes the information stored in these two fields to be
the time the resource was created and the time the resource was last
updated by the user, respectively.

Co-Authored-By: Richard Lee <rblee88@gmail.com>
Closes-Bug: #1193269
Change-Id: Iad689b97d237fa63856b878827a1fcb1676c991c
Fix stack_get_all call on stack watcher

The patch Ifdcfc44a3483a089ae803cfd044151262957674a missed this line
when updating the stack_get_all signature and behavior.  This reverts
the Engine.start() behavior to what it was before.

Co-Authored-By: Richard Lee <rblee88@gmail.com>
Implements: blueprint management-api (partial)
Change-Id: I47891c41fd345fe614675aeb9f82ff5d74d50a76
Alter stack_count_all_by_tenant to stack_count_all

Preparing the database for the unscoped list stacks, this removes
stack_count_all_by_tenant in favor of a single function that is tenant
aware.  This way, you can call stack_count_all(tenant_safe=False) and
count all stacks, regardless of the tenants.

tenant_safe defaults to True.

Co-Authored-By: Anderson Mesquita <andersonvom@gmail.com>
Implements: blueprint management-api (partial)
Change-Id: Ic44b884120290b6ceaf4936e015ef6661aaf6694
Unscoped List Stacks

This allows non tenant-scoped list of stacks for the management api
blueprint. A user allowed by the policy stacks:global_index will be
able to make a call to "/:tenant_id/stacks?global_tenant=true" and get
all stacks in Heat, and not just the ones owned by the user,
effectively bypassing tenant scoping.

If the user is not authorized by the policy and they pass the
global_tenant param, the request will get denied by the policy enforcer
and 403 Forbidden is returned.

Co-Authored-By: Richard Lee <rblee88@gmail.com>
Implements: blueprint management-api
Change-Id: I973a7ad2726eb6d9c972d08abe15e241aa120ec3
Add project to unscoped stack list response

For an unscoped stack list, stacks will possibly belong to several
different projects.  As a user who can see all stacks, it is useful to
be able to distinguish which stacks belong to which projects.

Co-Authored-By: Anderson Mesquita <andersonvom@gmail.com>
Change-Id: I4148a298ef7a41b815b477c49ff4aaf331845129
Implements: blueprint management-api