144 Commits

Author SHA1 Message Date
9362f9b539 Remove links from returned file docs when user is not subscriber/demo/admin.
For unauthenticated/non-subscriber users, image file documents retain
their variations. All other documents have ther variations stripped.
Also the links + expiry info to the original file are removed for all
file types.
2016-05-10 12:35:21 +02:00
0dcb972e76 Project: Don't revert the is_private field.
This also reverts the changes of override_is_private_field().
2016-05-10 10:47:26 +02:00
a90f13486a Fixed typo call to check_permissions()
Also added unit test to cover the function containing the typo.
2016-05-09 12:52:44 +02:00
899497b3b1 Implemented merging of permissions.
Permissions are now merged between project, node type and node, instead
of having the lower-level permissions override the higher-level
permissions.
2016-05-06 18:15:50 +02:00
1bb2979428 Slight improvement to project group mgmnt tests 2016-05-06 12:43:45 +02:00
a2ce18196a Simplified permissions for projects.
Instead of the additional 'is_private' field, we now just use
the permission system and set/remove world GET permissions.

'is_private' is still kept for backward compatibility and possibly
easy querying for public projects, and is always set based on
world GET permissions.
2016-05-06 12:42:16 +02:00
2580466469 User management for projects
Support for retrieving user of a project.
2016-05-06 10:30:05 +02:00
0b1664a83c Add project_manage_users endpoint
Manage users of a project. In this initial implementation, we handle
addition and removal of a user to the admin group of a project. No
changes are done on the project itself.
2016-05-04 17:04:10 +02:00
d0d8b7d11d Added missing unit test for content type overrides. 2016-05-03 11:23:26 +02:00
0389b05b14 Save temporary files in STORAGE_DIR
This makes it trivial to save uploaded files to STORAGE_DIR, as the
temporary files Flask saves them in are already there.
2016-05-03 11:22:54 +02:00
3e8494e3bf Use soft-delete for nodes 2016-05-02 17:06:59 +02:00
53aa0dae3b Deducting asset node content type from file content type. 2016-05-02 12:30:52 +02:00
681754eade Removed some obsolete unit tests. 2016-05-02 11:13:19 +02:00
401bfeea98 File streaming to Google Cloud Storage
Also simplifies some code since we're only going to support GCS.
2016-05-02 11:13:19 +02:00
cf203b04f8 Be less secretive about users; allow limited anonymous /users/id access.
Anonymous users can now obtain full_name and email fields from any
user. Authenticated users can also obtain those fields from other
users, and all info about themselves.
2016-04-26 17:27:56 +02:00
d5c2df371a Small test change: do as little as possible in an app test context. 2016-04-26 12:38:44 +02:00
e600d87592 Secure write access to /users endpoint
- Admins can PUT everything
- Users can only PUT themselves
- The 'auth' field is always taken from the original, and never overwritten
  by the PUT. It can be missing from the request, so you can GET and then
  PUT the same data.
- Nobody can POST or DELETE users
2016-04-26 12:38:44 +02:00
5c04cdbd6e Secure read access to /users endpoint.
- auth field is never returned
- unauthenticated access is rejected
- non-admin users can only access themselves
2016-04-26 12:38:44 +02:00
2a2d35827c Added local accounts 2016-04-26 12:34:16 +02:00
aa47c2b4a6 Allow overriding Eve settings from env in test
Environment variables for Eve settings are now used in unit tests.
2016-04-26 12:34:16 +02:00
c83f64d36f Allow deletion of projects by members of its admin group. 2016-04-25 16:41:57 +02:00
31e802619e Support soft-deleting projects.
See http://python-eve.org/features.html#soft-delete for more info.
2016-04-25 16:14:05 +02:00
5116b74d1d Updated Eve to 0.6.3
This also updates Cerberus to 0.9.2 and simplejson to 3.8.2.

I've also changed the way we get to the application object, by replacing
   from application import app
with
   from flask import current_app
2016-04-25 16:14:05 +02:00
a6258f5193 Limit project editing for subscribers.
Certain fields are limited for subscribers. Also, subscribers are checked
against the project permissions.

Users with the 'admin' role can edit all fields, on any project.
2016-04-25 16:14:05 +02:00
4edb8cfd39 Ensure that the returned project contains the correct etag.
The etag of the post_internal response was used, which is NOT the
same as the etag of the project document itself.
2016-04-25 16:14:05 +02:00
5c590c4dc4 Put Eve in debug mode when unittesting.
This gives us much more concrete information when a test fails.
Note that this info is generally put into the HTTP response data,
and not logged to any logger.
2016-04-25 16:14:05 +02:00
9a400d5414 Use the new /p/create function from manage.py too. 2016-04-19 16:50:51 +02:00
4b9dd29ad5 Added /p/create entry point to create new projects.
This requires the user to be logged in. The project will be owned by that
user.
2016-04-19 16:50:46 +02:00
d808b76d65 Store is_subclient_token bool in token collection. 2016-04-15 16:27:24 +02:00
4e9182ef38 Missed BlenderID API change in unittest 2016-04-15 14:27:54 +02:00
0bdd3b0a31 Updated for changes in BlenderID validate_token URL and response.
See BlenderID change 432034f858fbfd695f3ce0a0b3724524de7a05bb
2016-04-15 12:19:43 +02:00
66eeb25529 Unify tokens and subclient tokens
SCST tokens are now stored in the 'tokens' table.
This unifies old token handling and new subclient-specific tokens.
Also ensures the BlenderID expiry of the token is taken into account.

Removes use of httpretty, in favour of responses.
2016-04-13 15:33:54 +02:00
bd8e0e56a4 Security: don't log subclient token. 2016-04-12 16:05:37 +02:00
aeee165ad8 subclient tokens: bugfix & return proper data.
Also introduces responses, as an alternative to httpretty (it works
better).
2016-04-12 15:24:50 +02:00
669aea7436 Testing should have debug mode disabled. 2016-04-04 16:10:55 +02:00
465b145609 More flexible, less error-prone configuration system.
WARNING: make a backup copy of your local config.py before pulling
this change, as Git will overwrite it without warning.

The configuration defaults to deployment settings, allowing overrides.
Overrides are read from config_local.py and from the file pointed to
by the PILLAR_CONFIG env var.
2016-04-04 14:59:11 +02:00
ce242e1de3 Added manage.py command to refresh (almost) expired links.
manage.py refresh_project_links  5672beecc0261b2005ed1a33 -c 4

This refreshes the oldest 4 links of that project.
2016-04-01 13:03:27 +02:00
8b4e0c4578 Fixed imports for py.test
For some reason the 'from application import utils' worked fine when
running unittests from PyCharm, but breaks in py.test. Strange.
2016-03-25 18:27:27 +01:00
7c04e01cde Some security fixes and other fixes for file storage.
Also added unittests for creating files.
2016-03-25 18:23:01 +01:00
fd5bcaec52 Some code simplifications & logging for Zencoder notifications. 2016-03-25 17:21:18 +01:00
d7ee2121d9 Renamed some test_xxx files to common_test_xxx.py
Those files contain stuff for tests, but don't contain tests themselves.
2016-03-25 16:05:36 +01:00
adb4f5b39e Added unittests for caching of file links.
Also converted test_auth.py to use the new AbstractPillarTest class.
This class ensures that we test against the testing database, which
is dropped at every setUp()/tearDown().
2016-03-25 15:57:17 +01:00
d4ed335273 Overriding app.config in unittest.
We may need something better structured in the future to handle
test configuration, but at least this gets the one test we have
running.
2016-03-25 12:22:31 +01:00
ebcb6bc5f8 Added setup.py to allow automated testing.
Also moved the tests directory to top-level, as they shouldn't be part
of the pillar directory.
2016-03-25 11:46:01 +01:00