Sybren A. Stüvel
4e9182ef38
Missed BlenderID API change in unittest
2016-04-15 14:27:54 +02:00
Sybren A. Stüvel
36b31fee7c
Missed one BlenderID API change
2016-04-15 12:33:26 +02:00
Sybren A. Stüvel
0bdd3b0a31
Updated for changes in BlenderID validate_token URL and response.
...
See BlenderID change 432034f858fbfd695f3ce0a0b3724524de7a05bb
2016-04-15 12:19:43 +02:00
Sybren A. Stüvel
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
Sybren A. Stüvel
0f6eeef32b
Upgraded to gcloud-0.12.0
...
This removes the need to use a Git checkout, and allows us to use an
actual version number again, with a package from PyPi.
2016-04-13 10:50:49 +02:00
Sybren A. Stüvel
e898fe0315
Use Blender ID subclient-specific token to find the user.
...
TODO: also store expiry timestamp
TODO: allow multiple subclient-specific tokens per user
2016-04-12 16:53:27 +02:00
Sybren A. Stüvel
bd8e0e56a4
Security: don't log subclient token.
2016-04-12 16:05:37 +02:00
Sybren A. Stüvel
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
Sybren A. Stüvel
e0460f8518
Don't crash when Algolia is unavailable, when updating user.
2016-04-12 15:21:37 +02:00
Sybren A. Stüvel
3d9fe76271
Added subclient token verification & storage.
2016-04-08 18:45:35 +02:00
Sybren A. Stüvel
771b091626
Use config when running devserver
2016-04-05 17:38:11 +02:00
Sybren A. Stüvel
5e74120c3f
Use put_internal instead.
2016-04-05 12:32:05 +02:00
Sybren A. Stüvel
1120a59e30
Added management command for adding Attract node types to a project.
...
./manage.py setup_for_attract {project UUID} [--replace]
2016-04-05 12:25:41 +02:00
Sybren A. Stüvel
6f8afbbdc0
Replaced print statement with print function
2016-04-04 17:32:48 +02:00
Sybren A. Stüvel
e433e90dd8
Bugfix
2016-04-04 17:31:06 +02:00
Sybren A. Stüvel
669aea7436
Testing should have debug mode disabled.
2016-04-04 16:10:55 +02:00
Sybren A. Stüvel
7a171f471c
Renamed package 'manage' to 'manage_extra'
...
There already is a Flask-default 'manage.py', and with a subdir 'manage'
in the same directory, 'import manage' is ambiguous.
2016-04-04 15:40:46 +02:00
Sybren A. Stüvel
04d846fd96
Set our specific CDN_SERVICE_DOMAIN to be configured locally.
...
Just set it in your config_local.py file.
2016-04-04 15:14:30 +02:00
Sybren A. Stüvel
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
Sybren A. Stüvel
a1930c63d0
Manage command to expire all links, to test with slow responses.
2016-04-04 13:20:52 +02:00
Sybren A. Stüvel
72d05dea7b
Some nicer logging
2016-04-04 13:20:52 +02:00
Francesco Siddi
077064b7d9
Skip not found attachments
2016-04-01 14:41:58 +02:00
Sybren A. Stüvel
73bb125e7b
Added --quiet option to refresh_project_links mgmt command
2016-04-01 13:29:22 +02:00
Sybren A. Stüvel
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
Sybren A. Stüvel
c13fca4f30
Use the same expire time in database and current_user dict
2016-03-31 11:17:21 +02:00
Sybren A. Stüvel
655a5b53d1
More debug logging of the auth flow.
2016-03-31 11:16:45 +02:00
Sybren A. Stüvel
91d6175472
When BlenderID is unreachable, log an error and handle as not logged in.
2016-03-31 11:16:27 +02:00
Sybren A. Stüvel
6e04fa072b
Always set g.current_user (to None when not logged in).
...
This allows us to use g.current_user, instead of
g.get('current_user', None), which in turn simply causes an AttributeError
exception when the token validation wasn't performed when it should have.
2016-03-31 11:15:55 +02:00
Sybren A. Stüvel
56bf30c722
Validate authentication token on every request.
2016-03-31 11:10:01 +02:00
Francesco Siddi
9bdba2bc15
Fix for attachment processing
2016-03-25 21:05:33 +01:00
Sybren A. Stüvel
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
Sybren A. Stüvel
7c04e01cde
Some security fixes and other fixes for file storage.
...
Also added unittests for creating files.
2016-03-25 18:23:01 +01:00
Sybren A. Stüvel
fd5bcaec52
Some code simplifications & logging for Zencoder notifications.
2016-03-25 17:21:18 +01:00
Sybren A. Stüvel
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
Sybren A. Stüvel
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
Sybren A. Stüvel
cb4b0f1e4d
Check link expiry when GETting files.
...
Without this, the client would be allowed to keep using cached copies
when the Google Cloud Storage links were already expired.
2016-03-25 15:43:47 +01:00
Sybren A. Stüvel
26b081ccd8
Oops.
2016-03-25 12:40:51 +01:00
Sybren A. Stüvel
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
Sybren A. Stüvel
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
Sybren A. Stüvel
1769f20620
Moved some file-specific code from app/__init__ to file_storage module.
2016-03-25 11:46:01 +01:00
Francesco Siddi
84723eb8d3
Tweaks fo manage.py to allow default project creation
2016-03-24 16:05:39 +01:00
Francesco Siddi
a33e4421a8
Introducing Project creation
...
Authorised users can now create projects. The before and after insert
projects hooks take care of stripping unwanted urls and attaching
default node_type and permissions, as well as initialising a storage
bucket per project. We are temporarily switching to the development
version of the gcloud library, since it allows the creation of EU-based
buckets.
2016-03-24 15:16:37 +01:00
Francesco Siddi
90693595a6
Restored from modules.file_storage imports
...
A previous commit was causing functions not to be imported correctly
and would crash on runtime. For example file_storage.generate_link
would not be found.
2016-03-24 15:13:48 +01:00
Francesco Siddi
caaa376a7d
PEP8 formatting
2016-03-24 15:12:06 +01:00
Francesco Siddi
0e01c925bd
New node_type page
...
Mostly to be used to create static pages (about, ToS, etc).
2016-03-24 15:11:55 +01:00
Francesco Siddi
79918c26b6
PEP8 formatting
2016-03-24 15:04:27 +01:00
Francesco Siddi
618f02564f
Remove unused testing file
2016-03-24 15:03:43 +01:00
Sybren A. Stüvel
34202166e8
Added missing import
2016-03-22 18:00:10 +01:00
Sybren A. Stüvel
fc11502916
Sorted imports.
...
Personally I don't care much about this, but after certain refactor
operations PyCharm sorts the imports anyway, making the actual
refactoring harder to spot.
2016-03-21 15:18:41 +01:00
Sybren A. Stüvel
37037f3c2c
Store generated links in MongoDB, along with expiry datetime.
...
Links are only regenerated after they have expired. For backward
compatibility the links are also generated when there is no expiry
or link. Every file has only one expiry timestamp for all its links.
In the future we might want to inspect the used projection, to see
whether the client needs those links at all (prevents unnecessary
regeneration), and to force inclusion of the expiry timestamp when
links are requested.
2016-03-21 15:17:09 +01:00