Commit Graph

36 Commits

Author SHA1 Message Date
566a23d3b6 Unified user representation for web and API calls
Both approaches now use a pillar.auth.UserClass instance. g.current_user
is now always set to that instance, even for web entry points.

This UserClass instance can still be keyed like the old dict, but this is
for temporary compatibility and shouldn't be relied on in new or touched
code.
2017-08-18 13:19:34 +02:00
d920d9e9fe Also mock .s() and .si() celery signature functions. 2017-06-06 17:35:56 +02:00
27ad3459c1 Testing: make Celery tasks execute immediately when called. 2017-06-02 16:15:46 +02:00
6f16e20bf6 Flask Request.json() is deprecated, use get_json() instead.
See http://flask.pocoo.org/docs/0.12/api/#flask.Request.json
2017-06-02 16:03:45 +02:00
3e67db50f0 Tests: added some code to easily enter the Flask app context
This can't be trivially enabled globally, since it seems to leak certain
things like authentication info between calls.
2017-06-02 16:02:18 +02:00
d0c30cfeca Mock Celery while testing, to prevent actual background task creation. 2017-06-02 10:44:37 +02:00
2b36b4c514 PEP8 formatting 2017-06-02 10:44:37 +02:00
5f2153ae5a Sorted imports 2017-06-02 10:44:37 +02:00
a806f294b2 Some extensions to make Flamenco tests possible 2017-05-31 17:13:57 +02:00
59a95450e5 Updated Eve, Flask, and Werkzeug. Adjusted code to make Pillar work again.
Eve     : 0.6.3   → 0.7.3
Flask   : 0.10.1  → 0.12.2
Werkzeug: 0.11.10 → 0.11.15

Also updated some secondary requirements.
2017-05-18 15:46:02 +02:00
e4f221ab13 Take default crappy secret key from config.py
This forces anyone installing Pillar to actually generate a proper secret.
2017-05-18 15:46:02 +02:00
71403e6f28 Tests: Allow specification of user's email address 2017-05-12 14:48:36 +02:00
ad9a981cda Added p.a.users.add_user_to_group() function 2017-05-12 13:55:55 +02:00
fdaf4af31a Modernised some unit tests 2017-05-05 14:40:37 +02:00
69d7c5c5ce Allow service accounts to be email-less
This removes the ability of updating service accounts through the CLI
(something we never used anyway), now that service accounts cannot be
uniquely identified by their email address.
2017-05-05 14:34:18 +02:00
1a54b723aa Reworked subscription/demo role management from web to API level.
In the old situation, users had to be able to change their own roles. This
is inherently insecure.
2017-05-04 17:49:18 +02:00
d0557445cd Fix privilege escalation leak
A PUT request on /api/user/{user-id} by the user themselves would allow
too much, and would allow self-granting of roles (including admin),
group membership (so join any arbitrary project) and pretend to be
service accounts.
2017-05-04 12:48:30 +02:00
cce388049d Big refactoring of file storage handling
- Moved pillar.api.utils.{gcs,storage} to pillar.api.file_storage_backends
- Implemented GCS and local storage using abstract Bucket and Blob classes
- Removed file processing from the Blob class, and kept it in the
  file_storage/__init__.py class. That way storage and processing are
  kept separate.
2017-03-22 15:49:56 +01:00
2e41c074b5 Python 3.6 compatibility: bytes vs strings stuff
These changes mostly revolve around the change in ObjectId constructor
when running on Python 3.6. Where on 2.7 the constructor would accept
12- and 24-byte strings, now only 12-byte bytes and 24-character strings
are accepted. Good thing, but required some changes in our code.

Other changes include hashing of strings, which isn't supported, so they
are converted to bytes first, and sometimes converted back afterwards.
2017-03-22 15:49:51 +01:00
663627358f Ran 2to3 on pillar + some manual fixups
The 'manual fixups' are:

- incorrect use of dict.items() where dict.iteritems() was meant; this
  results in list(dict.items()), which I changed to dict.items().
- removal of 'from __future__ import' lines, which 2to3 changes into
  empty lines; I removed the empty lines.
2017-03-22 15:49:51 +01:00
a38e053c1a Added CLI command to create blogs. 2016-11-01 16:47:55 +01:00
f72890cc59 Define standard set of node types 2016-11-01 16:47:55 +01:00
0929a80f2b New data structure for attachments. 2016-11-01 16:47:55 +01:00
8d3c4745aa Remove unnecessary form_schema fields. 2016-10-20 13:05:43 +02:00
3afeeaccd0 Removed permission keys from node type definitions.
This prevents replace_pillar_node_type_schemas() from overwriting existing
permissions.
2016-10-20 13:05:43 +02:00
dd58d4ad04 Created AbstractPillarTest.create_project_admin() function. 2016-09-30 12:54:21 +02:00
40896fc70b Better logging when bad extension class is given.
This was necessary to debug an issue with different unit tests influencing
each other in Attract.
2016-09-20 15:59:39 +02:00
68666f0650 Updated unittest code so that we can create 100% valid projects.
This means also creating a user and groups so that the references are
valid.
2016-09-08 12:03:17 +02:00
a0cc76259e Renamed TestPillarServer to PillarTestServer
TestXXX classes are seen as unit tests by py.test, so anything that's not
a unit test should not be called TestXXX.
2016-08-31 11:29:16 +02:00
2c5dc34ea2 Introducing Pillar Framework
Refactor of pillar-server and pillar-web into a single python package. This
simplifies the overall architecture of pillar applications.

Special thanks @sybren and @venomgfx
2016-08-19 09:19:06 +02: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
93439be9ac Moved unit test to its proper spot, and added @httpretty.activate 2016-03-04 18:46:53 +01:00
da601747bb Added mocking of Blender ID with HTTPretty 2016-03-04 18:46:53 +01:00
172e8a8ba0 Fixed bug in validate_token(), it now returns the validation status.
Also separated on-the-fly creation of user in our database into its
own function.
2016-03-04 18:46:53 +01:00
7ca22691eb Added a few unit tests for user authentication.
Far from complete, and we need a way to mock the Blender ID server, so
that we can auth against a well-known, fake set of users.
2016-03-04 18:46:53 +01:00
1e141492a3 Added unit testing support + moved make_unique_username() to module level
Also cleaned up make_unique_username() code to no longer be recursive,
and to correctly handle numerical suffixes ≥ 10.
2016-03-04 18:46:53 +01:00