Commit Graph

490 Commits

Author SHA1 Message Date
Levko Kravets
11507c5e5e Show active and pending users separately (for admins) (#3400) 2019-02-07 20:30:55 +02:00
Jannis Leidel
69e34f048a Add archived queries section to queries list. (#2888)
* Add archived queries section to queries list.

* Refactor route building for list based controllers.

This also fixes the dashboard empty state page.
2019-02-03 14:35:25 +02:00
Omer Lachish
371b319e92
Server-side parameter validation (#3315)
* stop testing `collect_query_parameters`, it's an implementation detail

* add tests for `missing_query_params`

* rename SQLQuery -> ParameterizedSqlQuery

* rename sql_query.py to parameterized_query.py

* split to parameterized queries and parameterized SQL queries, where
parameterized queries only do templating and parameterized SQL queries
add tree validation on top of it

* move missing parameter detection to ParameterizedQuery

* get rid of some old code

* fix tests

* set syntax to `custom`

* revert the max-age-related refactoring

* 👋 tree validations 😢

* BaseQueryRunner is no longer a factory for ParameterizedQuery, for now

* add an endpoint for running a query by its id and (optional) parameters
without having to provide the query text

* adds parameter schema to ParameterizedQuery

* adds parameter schema validation (currently for strings)

* validate number parameters

* validate date parameters

* validate parameters on POST /api/queries/<id>/results

* validate enum parameters

* validate date range parameters

* validate query-based dropdowns by preprocessing them at the handler
level and converting them to a populated enum

* change _is_date_range to be a tad more succinct

* a single assignment with a `map` is sufficiently explanatory

* Update redash/utils/parameterized_query.py

Co-Authored-By: rauchy <omer@rauchy.net>

* Update redash/utils/parameterized_query.py

Co-Authored-By: rauchy <omer@rauchy.net>

* Update redash/utils/parameterized_query.py

Co-Authored-By: rauchy <omer@rauchy.net>

* Update redash/utils/parameterized_query.py

Co-Authored-By: rauchy <omer@rauchy.net>

* Update redash/handlers/query_results.py

Co-Authored-By: rauchy <omer@rauchy.net>

* Update redash/utils/parameterized_query.py

Co-Authored-By: rauchy <omer@rauchy.net>

* build error message inside the error

* support all types of numbers as number parameters

* check for permissions when populating query-based dropdowns

* check for access to query before running it

* check for empty rows when populating query-based enums

* don't bother loading query results if user doesn't have access

* 💥 on unexpected parameter types

* parameter schema default is a list, not a dictionary

* remove redundant null guards
2019-01-29 09:18:07 +02:00
Omer Lachish
a9c514aaf7
Textless query result endpoint (#3311)
* add an endpoint for running a query by its id and (optional) parameters
without having to provide the query text

* check for access to query before running it
2019-01-23 11:10:04 +02:00
YOSHIDA Katsuhiko
b3643ffbb7 Add regenerate function of user's API key (#3224)
* Add regenerate function of user's API Key

* Update client/app/pages/users/show.js

Co-Authored-By: kyoshidajp <claddvd@gmail.com>

* Remove unused error message

* Refactoring: Inline temp

* Update client/app/pages/users/show.js

Co-Authored-By: kyoshidajp <claddvd@gmail.com>

* Change action event of regenerate user API key
2019-01-20 13:38:20 +02:00
Arik Fraimovich
e8120c5f79
Use None as "not scheduled" default value of a query (#3277)
* Use null as the default scheduled value.

* Don't serialize None to json, so we can use SQL is not null predicate.

* Fix warning about unicode in tests

* Handling empty query.schedule in UI (#3283)

* Add migration to convert empty schedules to null and drop the not null contraint.
2019-01-18 11:30:45 +02:00
Omer Lachish
7847cf7d63
Fix invitation pending for older invitations (#3298)
* explicitly look for a False under details['is_invitation_pending'] and
not any falsey result, to avoid locking out invitations which were
created before the Pending Invitation feature was introduced. Solves https://github.com/getredash/redash/issues/3297

* test that old invites (that do not have any is_invitation_pending flag set in their details object) are still acceptable
2019-01-17 11:56:16 +02:00
Omer Lachish
121a44ef15 Remove tree validations and introduce ParameterizedQuery (#3230) 2019-01-17 10:26:00 +02:00
koooge
4c9326a9da handlers: Fix post users (#3273) 2019-01-13 15:52:56 +02:00
Ilya Ruzakov
0b6f1fc21b [Data Sources] Implement Apache Drill (#3188)
* Added support for Apache Drill datasource

* Improvements in `Drill` query runner and minor refactoring

1. Drill query runner now inherits from `BaseHTTPQueryRunner`, because they both have a lot of common code.
2. `BaseHTTPQueryRunner.get_response` method now accepts `http_method` argument (original implementation was only capable of sending `GET` HTTP requests).
3. Added `order` to `BaseHTTPRequestRunner` configuration schema to fix order of UI elements based on the schema.
4. Eliminated duplicate method `_guess_type` in `GoogleSpreadsheet`, `Results` and `Drill` query runners, moved `guess_type` to `redash.query_runner`.
5. Removed tests for `_guess_type` in `GoogleSpreadsheet`, `Results` and `Drill` query runners, merged them into single test case and moved to `tests.query_runner.test_utils`.
6. Various minor changes (code style, imports, etc).
2019-01-10 09:12:35 +02:00
Omer Lachish
445f8e5c36
Fix invitation pending for existing users (#3261)
* default `is_invitation_pending` to false and actively set it to true
when inviting users, so that existing users won't show "Invitation
Pending"

* fix tests that broke due to default is_invitation_pending value

* update Flask-OAuthLib
2019-01-09 13:48:47 +02:00
Arik Fraimovich
08953cc919
Redis based implementation of user active_at timestamp update (#3256)
* Switch to simpler implementation
* Fix active_at update code
* Fix sync test
2019-01-08 14:03:49 +02:00
Omer Lachish
823f172a9f
Invitation Pending changes (#3229)
* determine invitation_pending according to empty password. This commit will be reverted, I'm just deferring the implementation

* show '(Invitation Pending)' to users who haven't accepted their invitation yet

* allow resending invitations

* allow deletion of pending users from user list

* set invitation as not pending when following invite link

* prevent deleting activated users

* test that users who follow invitation links are set as non-pending invitations

* prevent re-using invitations

* invitees who use SSO will now also be marked as "non-pending"

* lint
2019-01-08 08:52:48 +02:00
Jannis Leidel
44dff83046 Add "Active at" column to user list. (#3026)
* add last_active_at to users page

* Use our JSON encoder as the SQLAlchemy JSON serializer.

* Fixed some inconsistencies in the user query class methods.

* Minor cosmetic fixes.

* Add some make tasks for easier development.

* Add user detail sync system based on Redis backend.

There is a periodic Celery task that updates a new “details” JSONB column in the “user” table with the data from Redis.

Currently this is only used for tracking the date of last activity of a user but can be extended with other user information later.

Updates a few dependencies.

* Normalize a few Flask extension API names.

* Reduce implementation complexity of JSONEncoder.

* Use request_started signal to make sure we have a request context.

Otherwise loading the user based on the request won’t work.

* Fix test that checks if disabled users can login.

This correctly uses a URL path that includes the current organization and checks for the error message.

The previous test seems to have been a red herring.

* Minor cosmetic fixes.

* Remove needs_sync in favor of just deleting things.

* Misc review fixes.

* Ignore line length.

* Split redash.models import several modules.

* Move walrus UTC DateTimeField into redash.models.types.

* Restore distinctly loading dashboards.

* Simplify default values for user details.

* Define __repr__ methods generically.

* Consistently have underscore methods at the top of model methods.

* Fix tests.

* Split redash.models import several modules.

* Update to latest walrus and redis-py.

* Update kombu to 4.2.2 for redis-py 3.x compatibility.

* Remove redis-cli container after running Make task.

* Move buffer condition after datetime/time conditions.

* Update walrus to 0.7.1.

* Refactor some query APIs.

This uses the flask-sqlalchemy helpers consistently and makes more use of mixins.

* Post rebase fixes.

* Use correct kombu version

* Fix migration down revision
2019-01-07 10:30:42 +02:00
Marina Samuel
cdd2259d08 Closes #2396: Add finer-grained scheduling. (#2426)
* Closes #187: Add finer-grained scheduling - backend.

* Closes #2396 - Add finer-grained scheduling - frontend.

* Fix linting issues

* Rename ScheduleDialgo to .jsx
2019-01-06 10:59:50 +02:00
Omer Lachish
d7edaa3ba2 Tests for find_missing_params (#3225)
* stop testing `collect_query_parameters`, it's an implementation detail

* add tests for `missing_query_params`
2018-12-31 12:34:57 +02:00
Arik Fraimovich
f62d0e1300
Use lower cased names for groups: (#3221)
Otherwise sorting depends on the Postgres collation and causes tests
to fail on different envoirnments.
2018-12-26 17:16:13 +02:00
Takuya Arita
8ed872756c Add test case for redash.utils.generate_token (#3211) 2018-12-23 15:13:00 +02:00
Arik Fraimovich
83ea472d37
Merge pull request #3093 from getredash/backend-parameter-templating
Remove Mustache templating from frontend
2018-12-20 22:24:11 +02:00
Omer Lachish
479247b60c Merge branch 'master' into backend-parameter-templating 2018-12-16 10:22:29 +02:00
Omer Lachish
94905a287a tests for legacy session user identifiers 2018-12-12 13:03:50 +02:00
Omer Lachish
2312db46f2 test that other sessions are invalidated when changing an e-mail. I had
to resort to comments in code in order to explain this. I'm a failure
today. 😭
2018-12-11 15:14:43 +02:00
Omer Lachish
b3495b8c00 test that user does not get logged out when changing email or password 2018-12-11 12:25:51 +02:00
Omer Lachish
dec790a9f3 Merge branch 'master' into invalidate-sessions-after-email-or-password-change 2018-12-11 10:41:27 +02:00
Omer Lachish
944bee6101 update identity only after succesfully updating user information 2018-12-10 14:25:04 +02:00
Omer Lachish
38ed046c9f Fix disable error message (#3175)
* display correct error message when attempting to disable yourself
* 403 (Forbidden) feels like a better status code than 400 (Bad Request)
* fix broken test
* remove redundant error title
2018-12-10 14:02:50 +02:00
Omer Lachish
c426c826f7 fix tests that rely on sessions 2018-12-10 12:27:39 +02:00
Omer Lachish
76321937d7 Remove API permissions for users who have been disabled (#3162) 2018-12-05 12:21:18 +02:00
Arik Fraimovich
c9ca2b99f6
Fix: Alert.evaluate failing when the column is missing. (#3167) 2018-12-05 11:28:05 +02:00
Omer Lachish
d769afab6f
Merge branch 'master' into backend-parameter-templating 2018-12-03 13:22:44 +02:00
Omer Lachish
cf86509a0b remove leftovers of SQLQuery from utils 2018-12-03 13:17:40 +02:00
Arik Fraimovich
9c12b04578
json_dumps: add support for serializing buffer objects. (#3156) 2018-12-03 10:57:36 +02:00
Omer Lachish
0a62bee3a1 Merge branch 'master' into backend-parameter-templating 2018-12-03 09:44:52 +02:00
Omer Lachish
9579f12a83 Protect against SQL injections by using tree comparisons (#3109)
* add SQLQuery class with tests for safe queries and non-safe tautology attacks

* add test for union query injections

* split .apply calls to newline

* add tests for comment attacks

* remove double underscore

* extract complex children check to variable

* inherit from object because I'm not a lamer

Co-Authored-By: rauchy <omer@rauchy.net>

* simplify cognitive complexity

* check that additional columns are not injected

* detect appended queries

* inline .apply calls

* move SQLQuery to it's own module

* move SQLQuery tests to their own module

* serialize SQLQuery instances

* raise an exception when attempting to serialize an unsafe query

* queries without parameters are safe

* remove redundant parentheses

* use cached properties

* rename SQLInjectionException to SQLInjectionError

* support multiple word params and param negations

* refactor out methods that don't involve any state

* don't cache text()

* reduce cognitive complexity
2018-12-02 21:51:06 +02:00
Jannis Leidel
a16170e701 Fix tag counts for dashboards and queries. (#3120)
* Fix tag counts for dashboards to be distinct.

This also makes use of the Dashboard.all base query.

Fix #3108.

* Use Query.all_queries as the base query for Query.all_tags.

* Add test case for Dashboard.all_tags.
2018-11-28 14:06:15 +02:00
Arik Fraimovich
bd20ce12ac
Don't allow updating user's email to blacklisted domain. (#3127) 2018-11-26 21:22:14 +02:00
Udomomo
8257d9d037 Add permissions to the result of "manage.py groups list" command (#3007)
* Add permissions to the result of "groups list" command

* added permissions to test case

* removed setting for debug
2018-11-25 13:47:25 +02:00
Omer Lachish
ef8839aafa add tests for comment attacks 2018-11-21 13:52:08 +02:00
Omer Lachish
14860f6a8b split .apply calls to newline 2018-11-21 13:51:19 +02:00
Omer Lachish
a52c783857 add test for union query injections 2018-11-21 13:45:52 +02:00
Omer Lachish
5e7c785891 add SQLQuery class with tests for safe queries and non-safe tautology attacks 2018-11-21 13:45:29 +02:00
Omer Lachish
b242cefaa0 Merge branch 'master' into backend-parameter-templating 2018-11-21 10:51:44 +02:00
Omer Lachish
c66f63d7a5 Prevent Query's updated_at from changing when it is linked to new query results (#3082)
* avoid Query's updated_at from changing when it is linked to new query results

* move comment to previous line

* move QueryResult tests to their own module

* add test which verifies that updated_at is not changed on query data
updates

* tests were false positives - they compared HH:MM:SS, but that never
changed because the original time was 1 week behind.

* remove redundant constructor

* remove hack and use a proper event to prevent updated_at from changing

* use self.assertEqual instead of assert
2018-11-20 12:22:15 +02:00
Omer Lachish
bc65b62776 remove Mustache templating from frontend and send all parameters to the
API (in the POST body)
2018-11-19 10:50:00 +02:00
GitSumito
bf6a09c5aa CLI sort (#3041) 2018-11-06 16:45:39 +01:00
Takuya Arita
0784a0c6f5 Add some tests for Query Results (#3031) 2018-10-31 11:05:17 +02:00
GitSumito
2e6883c527 Add "Users" users are belong to into groups list (#2991) 2018-10-21 11:40:07 +03:00
GitSumito
45f4d46245 Add "Groups" users are belong to into users list (#2967) 2018-10-18 17:32:21 +03:00
YOSHIDA Katsuhiko
869841b2ac Preventing open redirection (#2906)
* Prevent open redirection attack

* Add redirection url after logging in test

* Sanitize url just before redirecting it

* Consider when next parameter is None
2018-10-17 21:55:58 +03:00
Arik Fraimovich
c71f722552
Query Results query runner improvements: (#2969)
- Show meaningful error when failing to create table.
- Quote column names to allow more characters types.
2018-10-16 15:23:00 +03:00
GitSumito
a4b9c2da12 fixed https://github.com/getredash/redash/issues/2950 (#2951)
* fixed https://github.com/getredash/redash/issues/2950

* fixed test code

* Effective -> Active. thank you @kravets-levko
2018-10-15 15:57:51 +03:00
Niko Eckerskorn
6ea03e58b4 Address edgecase when retrieving Glue schemas for Athena query runner. (#2868)
Fixes getredash/redash#2858
2018-10-10 19:13:48 +03:00
Jannis Leidel
c2429e92d2
Consistently use simplejson to loading and dumping JSON. (#2817)
* Consistently use simplejson to loading and dumping JSON.

This introduces the new functions redash.utils.json_dumps and redash.utils.json_loads and simplifies the custom encoder setup.

UUIDs are now handled by the default encoder, too.

Fixes #2807.

Use string comparison in parse_boolean instead of the (simple)json module.
2018-10-09 15:38:06 +02:00
cclauss
da6d456f6f CircleCI: Flake8 tests passing on Legacy Python and Python 3 (#2881) 2018-10-05 13:48:01 +03:00
Allen Short
d07c4f969b Support authentication for the URL query runner.
Adds a new BaseHTTPQueryRunner class and tests.
2018-09-28 21:31:49 +02:00
Alison
d8ced1401f add test for using saved parameters in scheduled queries (#2802) 2018-09-16 10:45:25 +03:00
Jannis Leidel
b1f5d60460 Minor code smell cleanup. (#2820)
* Remove unused parse_db_url function.

* Fix tests to not show command line warnings anymore.

* Minor code smell cleanup.

Removing unneeded imports fixing PEP8 issues.
2018-09-16 09:43:44 +03:00
Alison
341a68c7d4 Propagate query execution errors from Celery tasks properly (#2713)
Refs https://github.com/mozilla/redash/issues/458
2018-08-23 20:33:43 +02:00
Arik Fraimovich
f6aab04a4b Fix: support unicode in users search 2018-08-07 17:51:46 +03:00
Arik Fraimovich
e4dba1ca8e Switch more strings to unicode. 2018-08-05 17:58:29 +03:00
Arik Fraimovich
f96a0f338d Use unicode strings. 2018-08-05 16:34:43 +03:00
Arik Fraimovich
226dd65d53 Update users handlers tests. 2018-08-05 16:14:24 +03:00
Arik Fraimovich
a014df36d8
Merge pull request #2686 from jezdez/serverside
Implement server side pagination and sorting for queries lists
2018-08-01 16:55:40 +03:00
Arik Fraimovich
f89d64e467
Merge pull request #2663 from ariarijp/improve-spreadsheets
Set column name implicitly when column name is blank
2018-07-29 14:50:12 +03:00
Arik Fraimovich
3c7dd064ef Block users with temporary domains 2018-07-25 13:06:26 +03:00
Arik Fraimovich
2e9ef66cbc Fix: Google Spreadsheets tests 2018-07-25 12:42:36 +03:00
Arik Fraimovich
25de0b9dab
Merge pull request #2514 from atharvai/gsheets_parse_fix_2504
Update value parsing for google spreadsheets source
2018-07-19 12:02:36 +03:00
Jannis Leidel
2af926703a
Implement server side sorting and new search.
- Redirect the old search API handler.
- Sort by specific database columns or relationships.
- Allow showing “my” queries per tag as well.
2018-07-18 22:55:19 +02:00
Arik Fraimovich
a9cb08d0d6
Merge branch 'master' into discovery 2018-07-17 15:33:58 +03:00
Arik Fraimovich
f78ab06369
Merge pull request #2647 from ariarijp/improve-script
Improve Script Query Runner
2018-07-12 23:37:23 +03:00
Arik Fraimovich
df25bbfa90 Merge with latest master 2018-07-11 17:53:53 +03:00
Arik Fraimovich
5e35156d22 Handle duplicate favorite calls. 2018-07-11 16:35:48 +03:00
ariarijp
53c20e2250 Set column name implicitly when column name is blank 2018-07-03 16:02:41 +09:00
ariarijp
c5f27253b0 Change message for empty output 2018-07-02 21:36:15 +09:00
ariarijp
389c6cb3c5 Improve Script Query Runner 2018-06-29 00:03:17 +09:00
ariarijp
bad7e92cce Add tests for SpreadSheets 2018-06-28 18:57:41 +09:00
ariarijp
8a4eab1c93 Add tests for Query Results 2018-06-28 15:37:11 +09:00
Arik Fraimovich
2eefdc1da3 Updated queries screen (& unified API). 2018-06-26 21:50:16 +03:00
Arik Fraimovich
b0de1be815 Better dashboards GET api (pagination, filter by tags, search by name) 2018-06-25 23:22:28 +03:00
ariarijp
9d2a3133f0 Improve Script Query Runner 2018-06-21 14:45:12 +09:00
ariarijp
5757b24ea3 Improve Google Spreadsheets Query Runner 2018-06-19 22:29:46 +09:00
Arik Fraimovich
93dffa0c8a Merge with upstream 2018-06-06 15:28:15 +03:00
Arik Fraimovich
aa756b2be6 Almost complete implementation of favorties backend 2018-06-06 14:41:13 +03:00
Arik Fraimovich
64f70cfbe8 Query favorites: API stub. 2018-06-06 14:37:52 +03:00
Levko Kravets
ac6d6fc68a getredash/redash#2375 More tests + fix bug 2018-05-28 14:04:08 +03:00
Levko Kravets
2c84a383f3 getredash/redash#2375 Tests 2018-05-28 14:04:08 +03:00
Arik Fraimovich
7553eef024 Remove dashboards recents tests 2018-05-14 11:02:25 +03:00
Arik Fraimovich
66737f0dc0 Almost complete implementation of favorties backend 2018-05-09 21:42:50 +03:00
Arik Fraimovich
e32da8dbe3 Query favorites: API stub. 2018-05-09 12:57:30 +03:00
atharva.inamdar
a0d039066d fix tests for google spreadsheets 2018-05-04 11:21:55 +01:00
Arik Fraimovich
9d4fd75ea8 Fix: update tests. 2018-04-30 11:16:27 +03:00
Arik Fraimovich
c054731794 Change: close metadata database connection early in the execute query
Celery task. This to prevent the task holding an idle connection for
a long period of time, while waiting for the query to finish.
2018-03-08 11:06:15 +02:00
Arik Fraimovich
025af41616
Merge pull request #2260 from Top20Talent/master
Extend the Prometheus query runner to support the range query
2018-03-04 10:57:30 +02:00
Arik Fraimovich
9ddf3745b8 Configuration for Google Apps. 2018-02-27 23:10:10 +02:00
Arik Fraimovich
09af43c4a7 remove unnecessary test. 2018-02-26 20:57:21 +02:00
ariarijp
f5d4ca85d8 Upgrade sqlparse to 0.2.4
Add test case for /api/queries/format
2018-02-23 01:24:34 +09:00
Arik Fraimovich
94295788ec
Merge pull request #2248 from sjakthol/multiorg-header-login
feat: make trusted header authentication compatible with multiorg mode
2018-02-11 15:41:46 +02:00
Arik Fraimovich
5ad893a266 Close #1199: support for nested fields in MongoDB results 2018-02-10 21:55:06 +02:00
Arik Fraimovich
722678f6d1
Merge pull request #2278 from getredash/dashboards_migrations
Move widget position logic migration to the backend and remove some unused code.
2018-02-06 08:44:31 +02:00
Sami Jaktholm
4a719fcb39 followup: coding style fixes to tests 2018-02-02 20:17:53 +02:00
Sami Jaktholm
a96b0b6e4c feat: make trusted header authentication compatible with multiorg mode
The previous implementation of remote header login did not
support the multiorg mode of Re:Dash. These changes modify
the trusted header authentication to expose a per-organization
login endpoint that logs users in the specified organization.

The feature itself is not that interesting as multiorg is pretty
much impossible to use in a standalone Re:Dash installation. What's
more interesting is that all tests are executed in multiorg mode. It's
not possible to write tests for the trusted header authentication if
the method does not support multiorg mode.

To make benefits of these changes more concrete, some tests were
written to test the basic functionality of trusted header
authentication.
2018-02-02 20:17:53 +02:00
Arik Fraimovich
33b4c7c4c3 Move widget position logic migration to the backend and remove some unused code.
Closes #2218.
2018-02-01 14:40:40 +02:00
jubel
8a2676701b extend the prometheus query runner to support the range query 2018-01-26 13:16:28 +08:00
Sami Jaktholm
fe2772e9db fix: commit saml user group assignment to the database
Relevant tests were also modified to reload the user
object from the database before asserting that the
user belongs to correct groups.

Fixes #1668.
2018-01-20 15:19:03 +02:00
Jannis Leidel
9f6b4fbdf2
Add full text search for queries based on the Postgres tsvector type. 2018-01-08 22:46:53 +01:00
Arik Fraimovich
153c0139cd Dynamic organization settings support. 2018-01-02 10:48:22 +02:00
Hao Jiang
6e2e2e2060 Fix: unicode handling at query result 2017-12-16 09:55:15 +09:00
ariarijp
93aa28cdf7 Handling whitespace characters in Query Results data source 2017-11-23 21:46:10 +09:00
Arik Fraimovich
9de3e975eb
Merge pull request #1985 from miketheman/miketheman/user-email-case-insensitive
Ensure email is case-insensitive
2017-11-22 18:11:07 +02:00
Arik Fraimovich
1cbf09cbbe Add: data source to run queries on top of query results. 2017-11-01 16:10:04 +02:00
Arik Fraimovich
4e4a3e13ab Fix #1824: allow only user API key to be used with query refresh API. 2017-11-01 15:05:55 +02:00
Arik Fraimovich
2bc3885977 Fix: require full access to the data source to fork a query.
Ref #1825.
2017-11-01 14:46:29 +02:00
Arik Fraimovich
97217f56c1 Remove unused variables 2017-11-01 13:52:41 +02:00
Arik Fraimovich
ba36f7395d Fix #1979: API key of one query could be used to get results of another one 2017-11-01 13:51:09 +02:00
Mike Fiedler
be232543d6
Use a custom EmailType/CaseInsensitiveComparator
sqlalchemy doesn't appear to have a case sensitive column, so we craft a
type that can have the semantics of case insensitive comparison.

Ref http://docs.sqlalchemy.org/en/rel_1_1/orm/extensions/hybrid.html#building-custom-comparators

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
2017-10-10 18:32:00 -04:00
Mike Fiedler
9076715d84
Ensure email is case-insensitive
While RFC 5321 alows for the username/mailbox art of the address to be
case-sensitive, it is hightly discouraged.

    The local-part of a mailbox MUST BE treated as case
    sensitive. Therefore, SMTP implementations MUST take care to
    preserve the case of mailbox local-parts. In particular, for
    some hosts, the user "smith" is different from the user
    "Smith". However, exploiting the case sensitivity of mailbox
    local-parts impedes interoperability and is discouraged.
    Mailbox domains follow normal DNS rules and are hence not
    case sensitive.
    -- https://tools.ietf.org/rfc/rfc5321.txt

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
2017-10-10 17:49:50 -04:00
Mehmet Emin INAC
6d2337b332
Revoke permission should respect to given grantee and access type.
The issue is, if you try to revoke the permission of a user from an
object, all the permissions on this object get removed. The fix is
assigning filtered query object to it's own reference.

According to SQLAlchemy documentation, `filter` method applies to
the **copy** of the query object which means calling filter doesn't
affect the object receiving filter call. For more information;
http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.filter
2017-10-06 12:52:35 +02:00
Arik Fraimovich
3cadd6731c Fix: tests entering endless loop, due to bad input. 2017-10-01 14:26:04 +03:00
Arik Fraimovich
47fc6612bf Allow collaborators to create, delete and edit visualizations. 2017-09-03 14:28:34 +03:00
Arik Fraimovich
42116abcb3 Fix: when setting rearm on a new alert, it wasn't persisted. 2017-06-28 16:34:50 +03:00
Arik Fraimovich
24ba110965 Fix: alert destination details were not updating.
Closes #1842.
2017-06-28 16:01:54 +03:00
Arik Fraimovich
1d749a83e1 Fix: /api/session API call wasn't working when multi tenancy enabled 2017-06-14 12:06:18 +03:00
Arik Fraimovich
6f72d456d2 Remove unused code 2017-06-14 12:05:49 +03:00
Arik Fraimovich
a8246471f4 Fix: clear null values from options dictionary 2017-06-13 09:42:20 +03:00
Arik Fraimovich
1fad874dee Change: redirect to / when org not found 2017-06-12 09:47:08 +03:00
Arik Fraimovich
fbd3b92ba0 Fix: delete data source doesn't work when query results referenced by queries. 2017-06-02 18:11:34 +03:00
Arik Fraimovich
beb29c66c2 Scheduled queries improvements:
* Schedule queries with parameters using the default value.
* Keep track of last execution (including failed ones) for scheduling purposes.
2017-05-18 15:10:19 +03:00
Arik Fraimovich
3807510bfe Split refresh schemas into separate tasks and add a timeout. 2017-05-18 13:39:34 +03:00
Arik Fraimovich
75f90c190b Update test for new path 2017-05-04 11:49:10 +03:00
Arik Fraimovich
903463972b Fix: handle the case when a scheduled query wasn't run before 2017-04-02 15:20:45 +03:00
Arik Fraimovich
d8a0885953 Fix: tests were using old method signature 2017-03-06 21:22:29 +02:00
Arik Fraimovich
83e6b6f50c Tests use the same session as the tested code, and we can't use the same
objects after the tested code calls commit() without disabling expire
on commit.

It seems like a safe thing in our case.
2017-03-06 13:49:29 +02:00
Allen Short
2407b115e4 Exponential backoff for failing queries 2017-02-22 10:29:08 -06:00
Allen Short
ca3e125da8 Refactor outdated_queries/refresh_queries tests 2017-02-22 10:28:35 -06:00
Arik Fraimovich
907b33b5a0 Fix: tests failling because they run on different app contextes 2017-02-22 14:06:47 +02:00
Arik Fraimovich
3e23143910 Fix: alert subscriptions were not triggered 2017-02-18 12:30:02 +02:00
Arik Fraimovich
ad18128794 Fix test 2017-02-02 10:39:21 +02:00
Arik Fraimovich
6cf1c1cb70 Disable query version check in test (#1550) 2017-01-26 22:25:12 +02:00
Arik Fraimovich
7e43e54b9d Revise Query.by_user method 2017-01-25 18:08:29 +02:00
Arik Fraimovich
febe908e65 Revise drafts flow for queries:
* Draft queries are now called "Unpublished" -- felt like it better convey the feature.
* Unpublished queries won't be shown in "All Queries" for non owners, but will appear in
  search.
* You can't add unpublished queries to dashboards or alerts.
2017-01-25 16:55:39 +02:00
Arik Fraimovich
98757db3e3 Merge pull request #1508 from stefanseifert/feature/jql-custom-fields
[Jira JQL] Add: support custom JIRA fields and enhance value mapping
2017-01-24 12:32:21 +02:00
Arik Fraimovich
7cc97fafdb Add tests entry point to docker 2017-01-22 13:28:46 +02:00
sseifert
187b557eee adapt to new field mapping syntax and add unit tests 2017-01-09 14:40:27 +01:00
Arik Fraimovich
c900e83bd9 Fix #1499: queries search should be case insensitive 2017-01-02 11:28:23 +02:00
Arik Fraimovich
f5e8fc816c Fix: data source delete was broken 2016-12-27 14:02:59 +02:00
Arik Fraimovich
894da612f4 Improve data sources create test 2016-12-25 12:57:10 +02:00
Arik Fraimovich
d631171e81 Fix Query.recent tests 2016-12-11 15:54:13 +02:00
Arik Fraimovich
1978e07748 Use group ids instead of groups in Queries.search/recent 2016-12-11 15:11:30 +02:00
Arik Fraimovich
1d18109964 Fix tests that used Query.all_queries 2016-12-08 16:07:25 +02:00
Arik Fraimovich
c380596930 Fix cases where we used User.groups instead of User.group_ids 2016-12-08 16:02:51 +02:00