3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00
Commit Graph

105 Commits

Author SHA1 Message Date
Kristin Laemmert
299c142f6a
QuotaService: refactor to use ReplDB for Get queries ()
* Feature (quota service): Use ReplDB for quota service Gets

This adds the replDB to the quota service, as well as some more test helper functions to simplify updating tests. My intent is that the helper functions can be removed when this is fully rolled out (or not) and we're consistently using the ReplDB interface (or not!)

* test updates
2024-08-08 13:41:33 -04:00
Ryan McKinley
ec6c6bd6c3
Identity: Add read-only identity apiserver () 2024-07-26 17:09:08 +03:00
Ryan McKinley
9db3bc926e
Identity: Rename "namespace" to "type" in the requester interface () 2024-07-25 12:52:14 +03:00
Karl Persson
f18da6f4dc
User+team: remove startup migration for uid ()
* Remove migration that is performed on startup
2024-07-03 09:11:52 +02:00
Kristin Laemmert
9a3477dd11
Chore: removing (more) redundant transactions ()
* remove redundant transactions from single-statement sql methods
2024-06-25 09:19:49 -04:00
Rajguru
1b2f110664
Users: Add config option to control how often last_seen is updated ()
Users: Add config option to control how often last_seen is updated

Co-authored-by: Karl Persson <kalle.persson92@gmail.com>
2024-06-24 16:54:56 +02:00
Ryan McKinley
99d8025829
Chore: Move identity and errutil to apimachinery module () 2024-06-13 07:11:35 +03:00
Eric Leijonmarck
c85d10d6c3
Auth: Removal of conflicting users check upon creation ()
fix: removal of check for conflicting users
2024-06-12 09:19:06 +02:00
Karl Persson
d3b06f09ae
Users: remove unused store function () 2024-06-06 11:43:51 +02:00
Carl Bergquist
6c79f63c04
Auth: Pass ctx when updating last seen ()
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2024-05-30 14:25:54 +02:00
Kristin Laemmert
876ed9bf0b
chore: decrease frequency of updating last_seen () 2024-05-30 08:09:22 -04:00
Carl Bergquist
0e6464fc96
Don't use transaction for updating last seen for an user. ()
dont use transaction for updating last seen

Signed-off-by: bergquist <carl.bergquist@gmail.com>
2024-05-29 18:13:04 +03:00
Kristin Laemmert
16b1e285ea
Chore: Use cache for all signed in user lookups ()
* GetSignedInUser unexported (renamed to getSignedInUser)
* GetSignedInUserWithCacheCtx renamed to GetSignedInUser
* added a check for a nil cacheservice (as defensive programming / test convenience)
2024-05-22 08:58:16 -04:00
Karl Persson
be5ced4287
Identity: Use typed version of namespace id ()
* Remove different constructors and only use NewNamespaceID

* AdminUser: check typed namespace id

* Identity: Add convinient function to parse valid user id when type is either user or service account

* Annotations: Use typed namespace id instead
2024-05-08 14:03:53 +02:00
Karl Persson
a2cba3d0b5
User: Add tracing ()
* Inject tracer in tests

* Annotate with traces

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-04-30 13:15:56 +02:00
Misi
1cb3f332a1
Chore: Remove extra sql select from the Insert function of userimpl.store ()
Remove getAnyUserType
2024-04-30 08:54:20 +02:00
Eric Leijonmarck
8a1f43a65d
User: Remove the lowercasing in the query for login conflict ()
* refactor: remove the lowercasing in the query for login conflict

* refactor: move function into the closure gs
2024-04-29 12:24:14 +01:00
Karl Persson
c4cfee8d96
User: support setting org and help flags though update function ()
* User: Support setting active org through update function

* User: add support to update help flags through update function
2024-04-29 08:53:05 +02:00
Eric Leijonmarck
e394e16073
Auth: Force lowercase login/email for users ()
* [WIP]: Force lowercase login/email for user CRUD

* warn and remove use of userCaseInsensitiveLogin check

* remove log warning

* reimplementation of the caseinsensitive

* need to decide if we want the conflict check or not

* remvoved the tests for conflict user by getEmail, getLogin

* added tests for user lowercase migration

* wip: emails next

* tests for email lowercasing

* review comments

* optimized login and email lookup before migrating
2024-04-25 17:31:17 +01:00
Serge Zaitsev
522a98c126
Chore: Make Cfg field private in SQLStore ()
* make cfg private in sqlstore

* fix db init in tests

* fix case

* fix folder test init

* fix imports

* make another Cfg private

* remove another Cfg

* remove unused variable

* use store cfg, it has side-effects

* fix mutated cfg in tests
2024-04-24 10:38:40 +02:00
Karl Persson
0fa983ad8e
AuthN: Use typed namespace id inside authn package ()
* authn: Use typed namespace id inside package
2024-04-24 09:57:34 +02:00
Karl Persson
1a6777cb93
User: use update function for password updates ()
* Update password through Update function instead

* Remove duplicated to lower

* Refactor password code
2024-04-17 15:24:36 +02:00
Eric Leijonmarck
9c1ef8b16e
Auth: Remove caseinsensitive check on update user ()
* Removal: case insensitive check on update

* refactor and removal of test for duplicate user

* refactor to still shadow user variable
2024-04-16 17:47:17 +01:00
Karl Persson
0f06120b56
User: Clean up update functions ()
* User: remove unused function

* User: Remove UpdatePermissions and support IsGrafanaAdmin flag in Update function instead

* User: Remove Disable function and use Update instead
2024-04-16 16:33:50 +02:00
Karl Persson
8520892923
User: Fix GetByID ()
* Auth: Remove unused lookup param

* Remove case sensitive lookup for GetByID
2024-04-16 15:24:34 +02:00
Karl Persson
ba41954854
Email: trigger email verification flow ()
* Add email and email_verified to id token if identity is a user

* Add endpoint to trigger email verification for user

* Add function to clear stored id tokens and use it when email verification is completed
2024-04-05 12:05:46 +02:00
Karl Persson
73e426b081
User: email verification completion ()
* TempUser: Include InvitedById in TempUserDTO

* Extract email verfication completion flow to service
2024-03-28 16:05:33 +01:00
Eric Leijonmarck
2f7fd729ef
Auth: Enable case insensitive logins/emails by default ()
* wip

* wip

* wip

* wip postgres tests
2024-03-22 16:45:18 +01:00
Karl Persson
8d9521fb6d
Refactor: Email verification ()
* Update template names

* Add verifier that we can use to start verify process

* Use userVerifier when verifying email on update

* Add tests
---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-03-14 13:25:28 +01:00
linoman
ac84069071
Password policy ()
* add password service interface

* add password service implementation

* add tests for password service

* add password service wiring

* add feature toggle

* Rework from service interface to static function

* Replace previous password validations

* Add codeowners to password service

* add error logs

* update config files


---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2024-02-16 04:58:05 -06:00
Karl Persson
1315c67c8b
Team/User: UID migrations ()
* Add user uid migration to run on every startup to protect against empty values in a upgrade downgrade scenario

* Add team uid migration to run on every startup to protect against empty values in a upgrade downgrade scenario

* Run team uid migration
2024-02-12 14:48:29 +01:00
Dan Cech
790e1feb93
Chore: Update test database initialization ()
* streamline initialization of test databases, support on-disk sqlite test db

* clean up test databases

* introduce testsuite helper

* use testsuite everywhere we use a test db

* update documentation

* improve error handling

* disable entity integration test until we can figure out locking error
2024-02-09 09:35:39 -05:00
Ryan McKinley
9c9e5e68c8
User: Add uid colum to user table () 2024-02-01 18:14:10 -08:00
Dan Cech
318f51eaee
Chore: Remove unused CacheService dependency from sqlstore ()
remove unused CacheService dependency from sqlstore
2023-12-04 10:00:45 -05:00
Jo
259ecb1793
AuthZ: Improve team ID fetching for signedInUser ()
* improve team ID fetching for signedInUser

* remove inner join

* rename func

* nit: remove extra params

* nit: spacing and wrapping
2023-11-20 16:23:13 +01:00
Ieva
2c73f15839
Revert "Revert "RBAC: remove dashboard ACL logic from dash store, service " ()
Revert "Revert "RBAC: remove dashboard ACL logic from dash store, service  ()"

This reverts commit 8057b9298d.
2023-11-15 16:45:49 +00:00
Eric Leijonmarck
8057b9298d
Revert "RBAC: remove dashboard ACL logic from dash store, service ()
Revert "RBAC: remove dashboard ACL logic from dash store and service ()"

This reverts commit dd54931147.
2023-11-15 15:33:38 +02:00
Ieva
dd54931147
RBAC: remove dashboard ACL logic from dash store and service ()
remove dashboard ACL logic from dash store and service
2023-11-15 08:25:51 +00:00
Karl Persson
87eba34745
User: remove empty email / username check from update in service ()
User: remove empty email / username check from update in service
2023-10-30 10:44:26 +01:00
Karl Persson
1528d6f5c4
Authn: Prevent empty username and email during sync ()
* Move errors to error file

* Move check for both empty username and email to user service

* Move check for empty email and username to user service Update

* Wrap inner error

* Set username in test
2023-10-11 14:27:43 +02:00
Gabriel MABILLE
96cbe70b14
User: Support sort query param for user and org user, search endpoints ()
* User: Add sort option to user search

* Switch to an approach that uses the dashboard search options

* Cable user sort on the org endpoint

* Alias user table with u in org store

* Add test and cover orgs/:orgID/users/search endpoint

* Add test to userimpl store

* Simplify the store_test with sortopts.ParseSortQueryParam

* Account for PR feedback

* Positive check

* Update docs

* Update docs

* Switch to ErrOrFallback

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2023-09-28 10:16:18 +02:00
Ryan McKinley
025b2f3011
Chore: use any rather than interface{} () 2023-08-30 18:46:47 +03:00
Ieva
6885b3d577
Chore: remove checks for whether RBAC is disabled ()
* remove checks for whether access control is disabled, as it is always enabled now

* linting
2023-08-25 14:19:58 +01:00
linoman
2e050f25bf
Auth: Allow to auto-assign empty role ()
Allow to auto-assign empty role
2023-08-17 18:32:58 +02:00
linoman
1c7f89c41b
Auth: Add empty role usage metrics for service and user accounts ()
* Add tests for service accounts metrics usage

* Add service account store implementation

* Add service account service implementation

* Add tests for org metrics usage

* Add org implementation

* Add service implementation
2023-08-16 10:56:47 +02:00
Ryan McKinley
7431c0ddb1
UserSync: Avoid UpdateLastSeenAt with invalid user ids ()
* avoid user zero

* more errors

* more tests

* split
2023-08-03 08:26:02 +02:00
Jo
7d347cd428
Auth: remove org count from signedInUser ()
* tweaks

* remove org count from signedinUser

* remove org count from signedinUser store

* fix broken tests

* restore frontend interface
2023-08-01 14:04:37 +02:00
Jo
ed780ce0e9
Auth: Fix Last Seen being updated on every request ()
* make sure LastSeen hook has information to decide if update is necessary

* make user service check if it should update the user's last seen

* do not run last seen hook if is a login request

* make service return error when last seen is up to date

* fix err

* Update pkg/services/contexthandler/contexthandler.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* fix golint

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2023-07-24 16:37:35 +02:00
Jo
5ec0f82baa
Separate authn flow from analytics ()
* separate authn flow from analytics

* lint fix
2023-05-15 18:38:54 +02:00
Jo
8df54a6daa
Users: Enable case insensitive login by default ()
* enable case insensitive by default

* fix missing case-insensitive query

* fix missing case insensitive query

* fix missing case insensitive query in temp_user

* skip integration testing in mysql

* skip integration testing in mysql

* use t.cleanup

* lowercase only once

* aligned to only using sql as that is what we do in other parts

---------

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
2023-04-28 16:38:58 +01:00