Commit Graph

29 Commits

Author SHA1 Message Date
Joan López de la Franca Beltran
ef631582ba
Users: Improve conflict error handling (#26958)
* API: Improve error handling (#26934)

* New ErrUserAlreadyExists error has been introduced

* Create user endpoint returns 412 Precondition Failed on ErrUserAlreadyExists errors

* Make ErrUserAlreadyExists error message clearer

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* Use errors.Is instead of equality comparator on AdminCreateUser handler

* Improve sqlstore/user test definition

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Improve sqlstore/user tests for ErrUserAlreadyExists cases

* Remove no needed string fmt and err declaration on sqlstore/user tests

* Code improvements for sqlstore/user tests

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Use err.Error() instead of sentinel error value on AdminCreateUser

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Add ErrUserAlreadyExists handling for signup & org invite use cases

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-13 14:38:54 +02:00
Agnès Toulet
7a5464fe10
Chore: use Wrap for all admin API (#26673)
* Chore: use Wrap for all admin API

* API: fix admin tests
2020-07-29 18:00:14 +02:00
Émile Fugulin
d721dd13cd
Allow API to assign new user to a specific organization (#21775)
* Allow API to assign new user to a specific organization

* Add defer block to test

* Add API tests and return 400 instead of 500 for bad orgId

* Minor test improvements
2020-04-15 12:11:45 +03:00
Pavlos Daoglou
53007e07e3 ApiUser: Fix response when enabling, disabling or deleting a nonexistent user (#21391)
* ApiUser: Fix response when enabling, disabling or deleting a nonexistent user
2020-01-10 11:43:44 +01:00
Arve Knudsen
35e0e078b7
pkg/util: Check errors (#19832)
* pkg/util: Check errors
* pkg/services: DRY up code
2019-10-23 10:40:12 +02:00
Oleg Gaidarenko
75fa1f0207 Metrics: use consistent naming for exported variables (#18134)
* Metrics: remove unused metrics

Metric `M_Grafana_Version` is not used anywhere, nor the mentioned
`M_Grafana_Build_Version`. Seems to be an artefact?

* Metrics: make the naming consistent

* Metrics: add comments to exported vars

* Metrics: use proper naming

Fixes #18110
2019-07-16 16:58:46 +02: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
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
Carl Bergquist
9660356638
Auth: Enable retries and transaction for some db calls for auth tokens (#16785)
the WithSession wrapper handles retries and connection
management so the caller dont have to worry about it.
2019-04-30 14:42:01 +02:00
Marcus Efraimsson
0cd5a6772d
feat(api): support list/revoke auth token in admin/current user api 2019-03-08 15:15:38 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
danielbh
d1b8f13c66
feat: #11067 prevent removing last grafana admin permissions 2018-12-03 20:05:52 -05:00
Julian Kornberger
7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
Dan Cech
c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech
338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
bergquist
2de94d6548 convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
utkarshcmu
f5db9950f8 fixed gofmt tests 2015-11-16 07:28:38 -08:00
utkarshcmu
9485e8cfee /api/admin/users returns user ID 2015-11-16 06:55:02 -08:00
Torkel Ödegaard
a8aab0cb2b Worked on user administration page, a grafana server admin can now add and edit organization roles for any user, #2014 2015-05-19 11:47:14 +02:00
Torkel Ödegaard
fbc6bb2112 More refactoring of user http api, trying to reuse handlers for sign in user and admin operations 2015-05-18 19:06:19 +02:00
Torkel Ödegaard
d987532262 Added server metrics 2015-03-22 15:14:00 -04:00
Torkel Ödegaard
04ca85fe89 Moved dashboard theme option from the dashboard to a persisted user setting, #1458 2015-02-28 14:30:08 +01:00
Torkel Ödegaard
7c241fd617 Added permissions section to admin > edit user view, an admin can now make another user admin, Closes #1517 2015-02-26 15:43:48 +01:00
Torkel Ödegaard
138e720695 Increased max user list to 1000 for user admin page, need to paging, but will have to wait a few days 2015-02-23 11:30:58 +01:00
Torkel Ödegaard
1a106e5c38 Added change password ability to admin > edit user view, #1446 2015-02-23 11:24:22 +01:00
Torkel Ödegaard
71f09ddd94 Added delete user action to user admin api, and made it work in UI, Closes #1466, #1446 2015-02-11 16:47:22 +01:00
Torkel Ödegaard
e165e2af95 Worked on user admin features, can now create and edit users as a grafana admin user, #1446 2015-02-10 15:36:51 +01:00
Torkel Ödegaard
10820f31c2 Changed go package path 2015-02-05 10:37:13 +01:00
Torkel Ödegaard
90925273a0 User / Account model split, User and account now seperate entities, collaborators are now AccountUsers 2015-01-19 18:01:04 +01:00