Commit Graph

407 Commits

Author SHA1 Message Date
Sofia Papagiannaki dc9ec7dc91
Auth: Allow expiration of API keys (#17678)
* Modify backend to allow expiration of API Keys

* Add middleware test for expired api keys

* Modify frontend to enable expiration of API Keys

* Fix frontend tests

* Fix migration and add index for `expires` field

* Add api key tests for database access

* Substitude time.Now() by a mock for test usage

* Front-end modifications

* Change input label to `Time to live`
* Change input behavior to comply with the other similar
* Add tooltip

* Modify AddApiKey api call response

Expiration should be *time.Time instead of string

* Present expiration date in the selected timezone

* Use kbn for transforming intervals to seconds

* Use `assert` library for tests

* Frontend fixes

Add checks for empty/undefined/null values

* Change expires column from datetime to integer

* Restrict api key duration input

It should be interval not number

* AddApiKey must complain if SecondsToLive is negative

* Declare ErrInvalidApiKeyExpiration

* Move configuration to auth section

* Update docs

* Eliminate alias for models in modified files

* Omit expiration from api response if empty

* Eliminate Goconvey from test file

* Fix test

Do not sleep, use mocked timeNow() instead

* Remove index for expires from api_key table

The index should be anyway on both org_id and expires fields.
However this commit eliminates completely the index for now
since not many rows are expected to be in this table.

* Use getTimeZone function

* Minor change in api key listing

The frontend should display a message instead of empty string
if the key does not expire.
2019-06-26 09:47:03 +03:00
Alexander Zobnin a3a7916597
Auth: Logout disabled user (#17166)
* Feature: revoke user token when disabled

* Chore: fix linter error
2019-05-23 15:54:47 +03:00
Oleg Gaidarenko 9b7f9dd9be
LDAP: consistently name the LDAP entities (#17203) 2019-05-22 15:30:03 +03:00
Alexander Zobnin 2d03815770
Users: Disable users removed from LDAP (#16820)
* Users: add is_disabled column

* Users: disable users removed from LDAP

* Auth: return ErrInvalidCredentials for failed LDAP auth

* User: return isDisabled flag in user search api

* User: mark disabled users at the server admin page

* Chore: refactor according to review

* Auth: prevent disabled user from login

* Auth: re-enable user when it found in ldap

* User: add api endpoint for disabling user

* User: use separate endpoints to disable/enable user

* User: disallow disabling external users

* User: able do disable users from admin UI

* Chore: refactor based on review

* Chore: use more clear error check when disabling user

* Fix login tests

* Tests for disabling user during the LDAP login

* Tests for disable user API

* Tests for login with disabled user

* Remove disable user UI stub

* Sync with latest LDAP refactoring
2019-05-21 14:52:49 +03:00
Samuel 846b9327a5 LDAP: Added reload endpoint for LDAP config (#15470)
* 4843 - Added reload endpoint for LDAP config

closes #4843

* Refactor to make the reload work after master drifted
2019-05-03 14:53:07 +02:00
Ryan McKinley 013f1b8d19
App Plugins: support react pages and tabs (#16586) 2019-05-02 10:15:39 -07:00
Andrej Ocenas eb82a75668
Provisioning: Show file path of provisioning file in save/delete dialogs (#16706)
* Add file path to metadata and show it in dialogs

* Make path relative to config directory

* Fix tests

* Add test for the relative path

* Refactor to use path relative to provisioner path

* Change return types

* Rename attribute

* Small fixes from review
2019-04-30 13:32:18 +02:00
Andrej Ocenas 42b745a098
Provisioning: Add API endpoint to reload provisioning configs (#16579)
* Add api to reaload provisioning

* Refactor and simplify the polling code

* Add test for the provisioning service

* Fix provider initialization and move some code to file reader

* Simplify the code and move initialization

* Remove unused code

* Update comment

* Add comment

* Change error messages

* Add DashboardProvisionerFactory type

* Update imports

* Use new assert lib

* Use mutext for synchronizing the reloading

* Fix typo

Co-Authored-By: aocenas <mr.ocenas@gmail.com>

* Add docs about the new api
2019-04-25 09:06:44 +02:00
Torkel Ödegaard 8b0dd4244b
Search: Fixes search limits and adds a page parameter (#16458)
* Search: Fixes search limits and adds a page parameter

This adds a page parameter to search api without adding
any major breaking change.

It does at an api validation error when trying to use
a limit beyond 5000. This is a breaking change. We could
remove this and have it only in the docs and describe that this
is a limit that grafana will apply silently.

Fixes #16049

* Fix: Corrected wrong array slice change

* Docs: minor docs fix

* Search: fixed folder tests

* Fixed: Moved limit to correct inner query

* Search: moving limit check and page check

* Search: limit in handler is no longer needed
2019-04-17 13:07:50 +02:00
Andrej Ocenas 2d7fc55df7
Provisioning: Do not allow deletion of provisioned dashboards (#16211)
* Unprovision dashboard in case of DisableDeletion = true

* Rename command struct

* Handle removed provision files

* Allow html in confirm-modal

* Do not show confirm button without onConfirm

* Show dialog on deleting provisioned dashboard

* Changed DeleteDashboard to DeleteProvisionedDashboard

* Remove unreachable return

* Add provisioned checks to API

* Remove filter func

* Fix and add tests for deleting dashboards

* Change delete confirm text

* Added and used pkg/errors for error wrapping
2019-04-10 13:29:10 +02:00
Marcus Efraimsson 2ae63e70c0
Alerting: Notification channel http api enhancements (#16219)
Now returns uid in response to get notification channel by id.
Adds GET/PUT/DELETE support for notification channel by uid, 
  /api/alert-notifications/uid/:uid.
Break apart alerting and alert notification http api docs in two 
  pages and update documentation to make it up to date
  with current implementation.

Fixes #16012
2019-03-26 18:37:02 +07:00
Leonard Gram adf0390b2c teams: local access to bus, moving away from dep on global. 2019-03-19 14:01:20 +01:00
Leonard Gram 6589a4e55f teams: better names for api permissions. 2019-03-19 14:01:20 +01:00
Hugo Häggmark b60e71c28b teams: moved logic for searchteams to backend 2019-03-19 14:01:15 +01:00
Hugo Häggmark 782b5b6a3a teams: viewers and editors can view teams 2019-03-19 14:01:14 +01:00
Leonard Gram 21d3d27452 teams: editors can't remove the last admin from a team. 2019-03-19 14:01:13 +01:00
Hugo Häggmark a90b3e331e config: updated feature toggle name 2019-03-19 13:59:39 +01:00
Leonard Gram 23231e6d51 teams: added delete team guard 2019-03-19 13:57:29 +01:00
Leonard Gram 8e7a8282c1 teams: removed feature toggle as it is already in middleware 2019-03-19 13:57:28 +01:00
Leonard Gram 2a88052c14 teams: can update team members permission. 2019-03-19 13:57:23 +01:00
Leonard Gram af4994ba16 teams: editor added as admin for created teams. 2019-03-19 13:57:22 +01:00
Leonard Gram 22e098b830 teams: editors can work with teams. 2019-03-19 13:57:22 +01:00
Leonard Gram c8c004095c permissions: broken out func for making creator admin. 2019-03-19 13:57:21 +01:00
Marcus Efraimsson 0cd5a6772d
feat(api): support list/revoke auth token in admin/current user api 2019-03-08 15:15:38 +01:00
Johannes Schill a81d5486b0 Viewers with viewers_can_edit should be able to access /explore (#15787)
* fix: Viewers with viewers_can_edit should be able to access /explore #15773

* refactoring initial PR a bit to simplify function and reduce duplication
2019-03-05 12:41:01 +01:00
Marcus Efraimsson 5638c67be8
org admins should only be able to access org admin pages 2019-03-04 15:51:18 +01:00
Marcus Efraimsson a29b99b96b
only editor/admin should have access to alert list/notifications pages 2019-03-04 15:48:07 +01:00
bergquist e163aadfe4 use authtoken for session quota restrictions
closes #15360
2019-02-12 15:10:55 +01:00
SamuelToh a7a964ec19 Added PATCH verb end point for annotation op
Added new PATCH verb annotation endpoint

Removed unwanted fmt

Added test cases for PATCH verb annotation endpoint

Fixed formatting issue

Check arr len before proceeding

Updated doc to include PATCH verb annotation endpt
2019-02-05 09:43:17 +10:00
Marcus Efraimsson cfd8eb5167
now /api/login/ping returns Response 2019-02-04 17:37:07 +01:00
Marcus Efraimsson 8764fb5aa6
inject login/logout hooks 2019-01-15 15:16:20 +01:00
supercharlesliu fb5c59c611 Add GET /api/users/:id/teams for orgAdmin 2018-11-19 17:08:10 +08:00
Marcus Efraimsson f560c3297e
Merge pull request #14034 from grafana/12550_team_preferences
Team preferences support
2018-11-15 07:35:10 -08:00
Torkel Ödegaard 480da34279 filter out alpha plugins in api call, fixes #14030 2018-11-15 11:10:47 +01:00
Marcus Efraimsson 5f9fecd254
feat: team preferences 2018-11-12 20:01:53 +01:00
Torkel Ödegaard dddbe62d6c Merge branch 'master' into react-panels-step1 2018-10-19 09:15:37 +02:00
Peter Holmberg ee0cc9bd77 Merge branch 'master' into data-source-instance-to-react 2018-10-16 12:14:11 +02:00
Torkel Ödegaard 8ba865bf57 Merge branch 'master' into react-panels-step1 2018-10-12 13:31:20 +02:00
Torkel Ödegaard 8c9939df72 Adds backend hooks service so extensions can modify index data 2018-10-12 11:26:42 +02:00
Torkel Ödegaard abef94b0da made it possible to have frontend code in symlinked folders that can add routes 2018-10-11 12:36:04 +02:00
Torkel Ödegaard 565edc1ed3 added setting top hide plugins in alpha state 2018-10-09 17:47:43 +02:00
Torkel Ödegaard b3c78f1265 wip: data source permissions hooks 2018-10-01 15:38:55 +02:00
Torkel Ödegaard 0e9a6dcedc Use datasource cache for backend tsdb/query endpoint (#13266)
fix: use datasource cache for backend datasources
2018-09-14 09:30:32 +02:00
Marcus Efraimsson beddfdd86b
add api route for retrieving teams of signed in user 2018-08-08 10:26:05 +02:00
David Kaltschmidt c6e9ffb168 Use url params for explore state
- putting state in the path components led to 400 on reload
- use `/explore?state=JSON` instead
2018-07-17 12:56:05 +02:00
Torkel Ödegaard 6286c31d4b refactoring: making api wrap public 2018-07-02 14:13:18 +02:00
Torkel Ödegaard 10e86eda69
fix: #12461 introduced issues with route registration ordering, adding plugin static routes before plugins package had been initiated (#12474) 2018-07-01 23:35:50 -07:00
Carl Bergquist 861af4cb97 Improve extensions build. (#12461)
* enable ee build on pr/master

* step1: of including group sync

* disable commit pinning for now

* fixes broken build

* enable team to ldap group sync

* avoid returning error for missing external handler

* services: allow routes to be added before http server start

* services: allows services to add their own migrations

* moves db migrations to ee code base

* build using master branch in ee

* disable enterprise build in .bra.toml

[skip ci]

* removes team sync extensions

* removes commented line
2018-07-01 07:01:43 -07:00
bergquist dbfafa1cb5 routing: allows routes to be added to existing groups
this enables services to add routing to ex /api
without causing conflicts.
2018-06-25 16:50:27 +02:00
David Kaltschmidt 0c45ee63a9 Guard /explore by editor role on the backend 2018-05-31 11:26:24 +02:00