Commit Graph

40 Commits

Author SHA1 Message Date
Christine Chambers
8c0551ed46 [SIP-5] Open a new /api/v1/query endpoint that takes query_obj (#6220)
* [SIP-5] Open a new /api/v1/query endpoint that takes query_obj

- Introduce a new handle_superset_exception decorator to avoid repeating the logic for catching SupersetExceptions
- Create a query_obj_backfill method that takes form_data and constructs a query_obj that will be constructed in the client in the future. Use the backfill in explore_json.
- Create a new /api/v1/query endpoint that takes query_obj only and returns the payload data. Note the query_obj is constructed in the client. The endpoint currently only handles query_obj for table view viz (we'll be adding support to new viz types as we go).
- Unit test to verify the new endpoint for table view

* fix tests and lint errors

* - Move the new query endpoint into its own api.py view.
- Create QueryObject and QueryContext class to encapsulate query_object to be built from the client and additional info (e.g. datasource) needed to get the data payload for a given query
- Remove the query_obj_backfill as we'll start building the first query_object on the client so it no longer makes sense to have a short-lived backfill for the matter of days.

* Fixing lint and test errors

* Fixing additional lint error from the previous rebase.

* fixing additional lint error

* addressing additional pr comments

* Make /query accept a list of queries in the query_context object.

* fixing a lint error

* - Move time_shift based calculation and since, until check into util
- Add typing info for get_since_until
- Add new unit tests to verify time_shift calculation and the since until check
2018-11-07 17:23:52 -08:00
Junda Yang
a0479d57b2 fix sql lab permission issue (#6194) 2018-10-25 16:35:43 -07:00
timifasubaa
46c86672c8 remove utf8 declaration (#6096) 2018-10-15 11:53:24 -07:00
timifasubaa
dd9eeda03e remove future (#6065) 2018-10-13 09:39:04 -07:00
Joshua Carp
9dcf8e101a Upgrade flask-appbuilder to latest. (#6030)
* Upgrade flask-appbuilder to latest.

* Skip constraint deletes if not exist.

* Document breaking change in flask-login.
2018-10-08 12:40:52 -04:00
Junda Yang
4c62494dff fix sqllab querysearch typeahead permission error (#5906) 2018-09-21 13:48:41 -07:00
Junda Yang
b6d7d57c40 Add schema level access control on csv upload (#5787)
* Add schema level access control on csv upload

* add db migrate merge point

* fix flake 8

* fix test

* remove unnecessary db migration

* fix flake

* nit

* fix test for test_schemas_access_for_csv_upload_endpoint

* fix test_csv_import test

* use security_manager to check whether schema is allowed to be accessed

* bring security manager to the party

* flake8 & repush to retrigger test

* address comments

* remove trailing comma
2018-09-20 11:21:11 -07:00
John Bodley
89927558e8 [security] Moving set/merge perm to security manager (#5684) 2018-08-22 11:15:22 -07:00
timifasubaa
4bf69a7260 fix superset error message flow (#5540) 2018-08-01 15:36:58 -07:00
timifasubaa
3b6cafc82f allow security manager provide error message (#5500) 2018-07-27 14:39:25 -07:00
John Bodley
d533ce0967 [pylint] prepping for enabling pylint for non-errors (#4884) 2018-04-28 20:08:09 -07:00
Maxime Beauchemin
9ee78d16d4 Add missing perms to sql_lab role (#4714)
The SQL Lab related role that is created programmatically is missing
permissions that make SQL Lab functional.
2018-03-29 14:24:11 -07:00
timifasubaa
8dd052de4b [security] Refactor security code into SupersetSecurityManager (#4565)
* move access permissions methods to security manager

* consolidate all security methods into SupersetSecurityManager

* update security method calls

* update calls from tests

* move get_or_create_main_db to utils

* raise if supersetsecuritymanager is not extended

* rename sm to security_manager
2018-03-27 16:46:02 -07:00
John Bodley
d57a37e341 [flake8] Adding flake8-coding (#4477) 2018-02-25 15:06:11 -08:00
Maxime Beauchemin
a616bf4082 [cli] permission cleanup on 'superset init' (#4241)
* [cli] permission cleanup on 'superset init'

FAB sometimes creates NULL/None permissions in the database,
presumably a race condition when multiple gunicorn workers start at the
same time, and those create issues raising "AttributeError: 'NoneType'
object has no attribute 'name'"

* Linting
2018-02-03 20:12:45 -08:00
John Bodley
22bdd9e324 [security] Adding all derived FAB UserModelView views to admin only (#4180) 2018-01-09 13:05:37 -08:00
timifasubaa
9364fb5b79 Allow alpha role import csv (#4164)
* allow alphas upload csv

* nits
2018-01-08 13:36:30 -08:00
John Bodley
ac57780607 [flake8] Resolving Q??? errors (#3847) 2017-11-13 21:06:51 -08:00
John Bodley
690de862e8 [flake8] Resolve E1?? errors (#3805) 2017-11-10 12:06:22 -08:00
John Bodley
17623f71d4 [flake8] Resolving C??? errors (#3787) 2017-11-07 21:32:45 -08:00
John Bodley
e822fb50d8 [flake8] Resolving W??? errors (#3784) 2017-11-07 20:25:10 -08:00
John Bodley
e2bca47421 [flake8] Resolve I??? errors (#3797) 2017-11-07 20:23:40 -08:00
timifasubaa
ede1432936 Improve code quality (#3480)
* add lanscape?

* add code climate badges

* pylint first pass

* Try out yapf

* merge

* merge

* lint

* more yapf

* removed unnecessary corrections
2017-09-18 20:40:27 -07:00
Maxime Beauchemin
c34df3eea4 [bugfix] SQLA instance has been deleted (#3159)
Related Msg:
sqlalchemy.orm.exc.ObjectDeletedError: Instance '<PermissionView at
0x7f10306b0e90>' has been deleted, or its row is otherwise not present.
2017-07-19 01:35:00 -07:00
Maxime Beauchemin
d7e419127c [bugfix] fails on None view_menu (#3155)
* [bugfix]  fails on None view_menu

* Update coveralls token
2017-07-18 19:42:20 -07:00
Maxime Beauchemin
a626f994bf [CLI] Improve the missing perm creation logic (#3118)
I don't think this worked as intended
2017-07-13 15:53:20 -07:00
Maxime Beauchemin
f374345860 Adding a .pylintrc file and a bit of linting (#2507) 2017-03-28 20:15:54 -07:00
Maxime Beauchemin
5574cfef59 Fixing out-of-sync security (#2493) 2017-03-27 21:51:55 -07:00
Maxime Beauchemin
2969cc9993 Refactoring Druid & SQLa into a proper "Connector" interface (#2362)
* Formalizing the Connector interface

* Checkpoint

* Fixing views

* Fixing tests

* Adding migrtion

* Tests

* Final

* Addressing comments
2017-03-10 09:11:51 -08:00
Benedict Jin
1f58e18b6f Some code refactoring (#2139) 2017-02-08 11:52:58 -08:00
Jun Jiang
9750e49df8 Add the missing argument (#1969) 2017-01-13 08:38:08 -08:00
Bogdan
9c6a5793b9 Fix none view_menues. (#1950) 2017-01-11 14:03:10 -08:00
Bogdan
92aa1a6124 Permissions refactoring, optimizations and unit testing. (#1798)
* Refactor and speed up superset init

* Add unit tests.

* Test fixes.

* More test updates.

* Fix read only perms

* Address comments.
2016-12-15 08:38:34 -05:00
Bogdan
09d597f3ad Prevent duplicated view_menu perms (#1751) 2016-12-02 17:48:46 -05:00
Bogdan
e822d5a1b7 Make edit / add / delete perms available to all users. (#1722)
* Make edit / add / delete perms available to all users.

* Add tests and restrict from editing the datasources.
2016-11-30 17:05:09 -05:00
Bogdan
fcb870728d Add per schema permissions. (#1698)
* Add per schema permissions.

* Address comments.

* Add schema_access perms to the alpha and admin

* Create permissions on addition databases and datasources.

* Remove hybrid_property. Linter complains.
2016-11-29 14:16:55 -05:00
Nicolas Noé
e3a9b393c2 Missing merge_perm function. Fixes 1691. (#1692) 2016-11-28 08:27:41 -08:00
Bogdan
c90dd4902f Programatically sync the role with user list. (#1619) 2016-11-21 13:06:43 -05:00
Bogdan
7a98f84890 Admin / Alpha permission cleanup and fixes. (#1645) 2016-11-18 19:53:19 -05:00
Maxime Beauchemin
bce02e3f51 [security] improving the security scheme (#1587)
* [security] improving the security scheme

* Addressing comments

* improving docs

* Creating security module to organize things

* Moving CLI to its own module

* perms

* Materializung perms

* progrss

* Addressing comments, linting
2016-11-17 11:58:33 -08:00