Commit Graph

142 Commits

Author SHA1 Message Date
Sean Harvey
b1523f82c8
satellite/admin: add owner full name on /api/apikeys/{apikey} endpoint
Updates storj/gateway-mt#321

Change-Id: I6759ec5dbba49261bb183e42d8cb333c326cb9e8
2023-06-28 16:01:15 +12:00
Sean Harvey
ad9b0dfc40 satellite/admin: fix paid tier field on /api/apikeys/{apikey} endpoint
the field was not being set, so it would always show false in the
response whether the user was paid tier or not.

Updates storj/gateway-mt#321

Change-Id: I00ae751ac9118fc05b3c22bc6d2cb9600d0faaaf
2023-06-22 11:12:56 +00:00
Vitalii
eb636f5b57 satellite/admin: add UI functionality to update user's or project's user agent
Implemented UI functionality to allow prod owner to update user's or project's user agent.

Issue:
https://github.com/storj/storj-private/issues/297

Change-Id: Ibe47e735f3c7a9fdf05b70735ebcecbac5c94ce8
2023-06-16 20:14:01 +00:00
Vitalii
1eee2fad69 satellite/{db, admin}: added endpoints to update user's and project's user_agent
Added backend (for now) implementation for updating user's and projects's user_agent using admin API.
Updating both user and project also updates bucket_metainfo and value_attribution tables.

Issue:
https://github.com/storj/storj-private/issues/297

Change-Id: I40244bbaa08b46834c1b1d0720e7d84d0c2a0330
2023-06-16 19:41:05 +00:00
Márton Elek
2ea6ca9c18
satellite/console: fill default placement of project based on user info
https://github.com/storj/storj/issues/5879

Change-Id: I5aacbe57a7aab65e11915dd8bf0c68f89da32fb4
2023-06-08 12:47:49 +02:00
Márton Elek
52598d1545 satellite/admin: introduce new placement rule
Change-Id: I582d38febd6187e06a46f14fd0f37531a2139c99
2023-06-05 13:34:26 +00:00
Stefan Benten
11324111e3 satellite/admin: secure accidental user email change
It currently is possible to create a violation with regards to
the uniqueness of the user account emails that is used for the
login.
When an update via the admin API is made, it currently is possible
to set the accounts email to an already occupied email address.
This will result in very flacky login behaviour, as well as creating
a lot of other related issues.

This small change adds a check to ensure the email is not attached to
any account.

Change-Id: I167be673082d59ef32cafe41047fce9f5ae534d0
2023-06-05 12:17:31 +00:00
Sean Harvey
403f5eff81
satellite/admin: add /api/apikeys/{apikey} GET endpoint
This allows scripted automation to get more details of the
API key such as project ID, and paid tier status.

Updates https://github.com/storj/gateway-mt/issues/321

Change-Id: I8a835752d4fd67382aca804b8c93e63de6c9a846
2023-05-26 17:18:05 +12:00
Vitalii
4d998970d4 satellite/admin: rework update user limits functionality
Fixed nil pointer dereference panic.
Updated naming conventions so that PUT request and GET response bodies are the same (bandwidth, storage and segment).
Allowed usage of notations like 150GB, 2TB for storage and bandwidth limits.
Updated tests.

Issue:
https://github.com/storj/storj/issues/5674

Change-Id: I7ac27c00721a9b4bf507afa34cb05c4475a809ad
2023-04-25 13:38:59 +00:00
Egon Elbre
41931970fd satellite/*: changes to stop using storj.ListDirection
Currently this duplicates the constants, because we cannot yet bump
common nor uplink.

Change-Id: I81818df8a9092e0b358eb946c31f2a42ac9dbf0a
2023-04-19 15:30:42 +03:00
Jeremy Wharton
b3b619efc5 satellite/admin: use system-given port in OAuth test to fix flakiness
The test for the admin API's OAuth authorization behaviour has been
modified to use a random available port given by the system rather than
a hardcoded one. This prevents the test from accidentally using a port
that is already in use.

Change-Id: Iae017b2f397ae53f1a006bae1d0578d2ddfd0875
2023-04-14 13:14:19 -05:00
Wilfred Asomani
4ee22e0ed8 satellite/admin: add tests to admin auth
This change tests authorization of the admin api.

Issue: https://github.com/storj/storj/issues/5699

Change-Id: Iecfe4c27a70ab1b48aeb5ed3251b51a3406140e8
2023-04-14 11:13:14 +00:00
Egon Elbre
eecb055dfd satellite/buckets: move Bucket definition
Move Bucket struct definition.

Updates https://github.com/storj/storj/issues/5291

Change-Id: I6bfc5ce287793ea479f2cb8b17878ba3cf6b63e0
2023-04-13 17:55:40 -04:00
Michal Niewrzal
8a50a3baa3 satellite/payments: rename 'stripecoinpayments' package to 'stripe'
Automatic rename. May require some more cleanups later.

Change-Id: I18220a4278056d25c41fb137832bb81f2b876ac1
2023-04-06 16:51:43 +00:00
Ivan Fraixedes
d17b41d027
satellite/admin: Fix response code for Get bucket
Get bucket was returning a "bad request" HTTP status code when the
bucket doesn't exists.

We have to return HTTP "Not found" status code.

Change-Id: If717d99276b02a1e59a9b71ebc909bd6d8d9390b
2023-04-03 10:22:22 +02:00
Lizzy Thomson
63533c628b Satellite/console: Reduce free account limits
Update free account limits to segments(10k), storage(25gb), and
bandwidth(25gb)

Issue: https://github.com/storj/storj-private/issues/182

Change-Id: I59250fc9f1eebc812bc85ecfbc2924f8c4369064
2023-03-29 15:24:24 +00:00
Cameron
4e94e6188c satellite/admin: restrict api access based on user groups
This change reworks the allowedAuthorization function to check what
groups the user is a part of to determine if authorization should be
granted. By wrapping each handler with withAuth, we can specify the
allowed groups for each api method individually.

github issue: https://github.com/storj/storj/issues/5565

Change-Id: I1804dda04d5b16d19e93bd7199fb3fc89fca1294
2023-03-10 16:16:04 -05:00
Cameron
b24ce98944 satellite/admin: add Groups to config
add new config to the satellite admin: --admin.groups.limit-update.
This can be used as an alternate means of authentication if the request
is coming from the oauth proxy.

Change-Id: Ic2de13862e6414244b060c66a0f2bed72097cbad
2023-02-27 16:07:20 +00:00
Ivan Fraixedes
16d3fcde70 satellite/admin/ui/lib: Fix bug in API
The update user API function was defining a parameter that the API
calling function doesn't receive, so all the values were shifted by
1 after this extra parameter and the calling function was sending these
  values to the next one updating the fields that the user was not
  expecting.

  The API server doesn't allow to update this removed parameter, so it
  was likely a bug caused by copy-pasta.

Change-Id: I52a2b66abc1f6e5cb0070dc6fd230c30d1133dcf
2023-02-23 10:59:18 +00:00
Lizzy Thomson
1b22994631 satellite/admin: update user's limits and project limits from admin api
Create an endpoint in the Admin Api to be able to update a user’s limits
for all existing and new projects. Also added a GET endpoint to return
user's limits.

Fixes: https://github.com/storj/storj/issues/5395

Change-Id: I2c093dc08ebf79a4318391e63a37da4d2b403547
2023-02-15 11:38:57 +00:00
Cameron
de44c6ab58 satellite/admin: update README
add descriptions for freeze and unfreeze user endpoints and regenerate
table of contents. This additionally added the oauth endpoints and one project limits POST parameter to the ToC

Change-Id: I05025f1f3a11c3775a4f59b01569ccb419d72858
2023-02-02 14:40:24 +00:00
Wilfred Asomani
3a714cefcf satellite: remove rewards package
Affected packages admin,attribution,console,metainfo,satellitedb,web,payments
This change removes the satellite/rewards package and its related usages.
It removes references to APIKeyInfo/PartnerID, Project/PartnerID
 and User/PartnerID.

Issue: https://github.com/storj/storj/issues/5432

Change-Id: Ieaa352ee848db45e94f85556febdbcf1444d8c3e
2023-01-31 11:46:50 +00:00
Cameron
01932bda42 satellite/admin: add endpoint to freeze/unfreeze user
Allow the admin to manually freeze/unfreeze users.

github issue: https://github.com/storj/storj/issues/5397

Change-Id: I402ad1bf2e13effb0a5a8ff35bb128d1fcf18448
2022-12-19 18:11:05 +00:00
Lizzy Thomson
0afd3938c7 sat/console update the updateProject to set user specified limits
update the updateProject function to set user specified bandwidth and storage limits

fixes https://github.com/storj/storj/issues/5185

Change-Id: Ib4132487f6b7ea0afa7c57acfc358857b3e852d1
2022-12-13 16:44:41 +00:00
Wilfred Asomani
c1ed5c06e8 satellite/{admin,ui}: implement changes for oauth2 proxy
We want to put the OAuth2 proxy, https://github.com/oauth2-proxy/oauth2-proxy, in front of the satellite admin ui.
This change implements the changes required/necessary for this to work.

Issue: https://github.com/storj/storj/issues/5072

Change-Id: I6da0df090cc6f0c18f1bf41e48ae082493f53f20
2022-12-06 09:44:04 +00:00
Egon Elbre
ff22fc7ddd all: fix deprecated ioutil commands
Change-Id: I59db35116ec7215a1b8e2ae7dbd319fa099adfac
2022-10-11 15:27:29 +00:00
Egon Elbre
2b2b6d2288 satellite/admin/ui: use a valid go.mod stub
Some tools check all the go.mod files and fail when it's incorrect.

Change-Id: I1be5bd1b502e15c90b2f69caedbf5545d366a87d
2022-09-28 12:41:30 +00:00
Cameron
c82424c21d satellite/admin: add Burst field to Update Project Limits params
Since 6 fields were sent, but only 5 fields were used as input (no burst),
the Segments UI input field was being set to the burst field in the
object, leaving segments empty.

Change-Id: I4e58ed8a36e2022d1d0844e9f9001562db3dcbb8
2022-08-17 10:40:28 -04:00
Márton Elek
96b88e286e build: fix conditional run of web builds
Jenkins doesn't do a very good job with identifying what has been changed.

While it has a syntax to defined patterns, it compares the current build with the previous build (in case of git-verify it can be a totally different branch) instead of checking the HEAD commit.

This patch introduces shell scripts to do this better:
 * It doesn't depend on Jenkins any more
 * It can be executed locally
 * It can detect web changes properly (see the relation change as an example).

Change-Id: I9d37775e3818c08c4aa96ffb78f84d57f28a2c95
2022-08-11 14:34:44 +00:00
Cameron
4815cfc09b satellite/{console,satellitedb}: add PublicID to Project, db method GetByPublicID
github issue: https://github.com/storj/storj/issues/4861

Change-Id: Ia83635c0de751a77cd5a49d641da19ed76132c46
2022-07-21 19:49:26 +00:00
Egon Elbre
15dc797efd web/{multinode,satellite,storagenode}: revert go.mod
Adding go.mod into node_modules is not sufficient, because npm install
wipes them quite often out. Similarly, when running npm install locally
it will remove it, causing the git state to be dirty.

Rather than having them committed, add them after running npm install.

Change-Id: Iaf21a9c6e198dc31fe50345ec5dee85b44617176
2022-07-08 19:51:51 +03:00
Egon Elbre
97e6e5a6a3 build: improve npm build
Add go.mod to node_modules folder, that way Go compiler doesn't
need to scan the node_module directories for any Go code.

Change-Id: I747909416490c847d6b4bfa3438fea66660fcd53
2022-07-01 10:51:53 +00:00
Vitalii
0dba785798 satellite/admin: return only owned projects for get user endpoint
Returns only user's own projects when we hit GET user endpoint.

Fix for this issue
https://github.com/storj/storj/issues/4820

Change-Id: I546268fa3e5983a72f11f998803da5455c0035b4
2022-06-22 13:09:36 +03:00
Cameron
240b70b828 satellite/console: use new type UpdateUserRequest as arg to db users.Update
The users.Update method in the satellitedb package takes a console.User
as an argument. It reads some of the fields on this struct and assigns
the value to dbx.User_Update_Fields. However, you cannot optionally
update only some of the fields. They all will always be updated. This means
that if you only want to update FullName, you still need to read the
user info from the DB to avoid updating the rest of the fields to zero.
This is not good because concurrent updates can overwrite each other.

This change introduces a new struct type, UpdateUserRequest, which
contains pointers for all the fields that are updated by satellite db
users.Update. Now the update method will check if a field is nil before
assigning the value to be updated in the db, so you only need to set the
field you want updated. For nullable columns, the respective field is a
double pointer. This allows us to update a column to NULL if the outer
pointer is not nil, but the inner pointer is.

Change-Id: I27f842d283c2711e24d51dcab622e57eeb9157f1
2022-06-14 09:28:03 -04:00
dlamarmorgan
270204f352 satellite/{payments/storjscan,satellitedb}: Add wallet implementation
Add storjscan wallets implementation to the satellite. The wallets interface allows you to add and claim new wallets as called by the API. The storjscan specific implementation of this interface uses a wallets DB to associate the user to a wallet address, as well as a storjscan client to request and associate new wallets to the satellite.

Change-Id: I54081edb5545d4e3ee07cf1cce3d3e87cc00c4a1
2022-06-03 11:45:47 +00:00
Ivan Fraixedes
261a6edf4f
satellite/admin/ui: Update NPM dependencies
Update all the NPM dependencies used by the Admin UI.

The dev dependencies correspond to the ones that are currently used by
an svelte app generated with the last svelte-kit version. They
deprecated some configuration options and changed some svelte
directives.

The only non-dev dependency is also updated to the last published.

Change-Id: I5f2192cab41e00efc3239237f8dc8f3d07816b63
2022-06-02 13:24:15 +02:00
Ivan Fraixedes
2438c92d56
satellite/admin/ui: Add disable MFA endpoint
Add the admin API endpoint for disabling an user's multifacdtor
authentication to the satellite admin UI.

Remove a couple of commented code lines too.

Change-Id: Iaee7efe7a3d4d38bdd6541311447a9726806f0f1
2022-05-30 15:23:35 +02:00
Stefan Benten
25b45c47ee
satellite/admin: allow disabling of MFA
We have a couple of support tickets so far that require us to
disable the mfa on accounts. Since we currently had no other
way than doing a SQL War Crime, it makes sense to add it to the
admin API.

Change-Id: Ib16735c1961380b04345a3495d4eebee5fa0bc41
2022-05-30 13:56:11 +02:00
Stefan Benten
62a64bae3b
satellite/admin: allow deletion of paid tier user projects when invoiced
Currently we have a bug in which we would require that a project of
a paid tier user needs to be two months unused before we can delete it.
This change fixes it and reduces it back to the normal next billing cycle.

Change-Id: I28610b6c45c68943fd4f2621233bccc06cab28a0
2022-05-30 13:54:51 +02:00
Stefan Benten
8673583582 satellite/admin: fix console config handling
An older change plummed the full console config as subconfig of
the admin api configuration in. This bloated the generated satellite
configuration unnecessarily while also allow for confusion/mistakes.

Change-Id: Icf49cc1f147711e37e85f6eac1143fab8ddf1659
2022-05-27 22:26:06 +00:00
Moby von Briesen
ed5ebb2527 satellite: Rename "acct mgmt api" to "rest api"
"REST API" is a more accurate descriptor of the generated API in the
console package than "account management API". The generated API is very
flexible and will allow us to implement many more endpoints outside the
scope of "account management", and "account management" is not very well
defined to begin with.

Change-Id: Ie87faeaa3c743ef4371eaf0edd2826303d592da7
2022-04-25 18:51:46 +00:00
Vitalii
318f4dc688 satellite/admin: extend user update query
Extended user update query so prod owner can change user's paid tier status, bandwidth, storage and segment limits.

Change-Id: I82768afd1e50f653a50f7020310ce1e91578d746
2022-04-25 13:44:25 +00:00
Michał Niewrzał
671923cc60 satellite/admin: add mising segment limit to top menu
We missed menu entry for segment limits.

Change-Id: I977515acb282582b0730e581662ca262cc75f0b5
2022-04-20 16:36:14 +00:00
Vitalii
67b5b07730 apigen: api key authentication implemented
Implemented account management api key authentication.
Extended IsAuthenticated service method to include both cookie and api key authorization.

Change-Id: I6f2d01fdc6115cb860f2e49c74980a39155afe7e
2022-04-01 15:17:38 +00:00
Egon Elbre
a2fe69767d satellite/admin: delete unused file
Change-Id: Ie646fbfd9f0e8bb958314a232e8995474de25039
2022-03-30 10:56:26 +00:00
Cameron
6294334de6 satellite/admin: add account management api keys to admin
Add endpoints to satellite admin for account management api key creation
and revocation.

Change-Id: I2390f379f12b0958e68ddd63439d75dae129be19
2022-03-29 11:52:45 +00:00
Egon Elbre
1f1f777d06 satellite/admin/ui,web/{multinode,storagenode}: build without embedding
Embedded files significantly increase the binary size for linking.
Add a tag that allows disabling embedding the build npm code.

Change-Id: I9d1fd7376d1fa035965c33d259faaa6c4770dfe1
2022-03-29 13:18:04 +03:00
Egon Elbre
4a6c2e2a9c satellite/admin/ui: avoid needing an additional copy
This also fixes the build order. Unfortunately we need
to ensure that the web frontends are built before installing
Go binaries.

Fixes https://github.com/storj/storj/issues/4654

Change-Id: I5d1c83125fd3d1a454d3400b2cbdd44bd3f2250c
2022-03-25 11:42:22 +02:00
Ivan Fraixedes
bc0209dd3c
satellite/admin/ui: Add missing step for building it
Add a missing instruction step for allowing Go to embed the files
generated by the UI build process into the satellite binary.

Change-Id: Ie9223b8bb5317e53e692e3aa1d1086977daa17c9
2022-03-23 13:40:41 +01:00
Egon Elbre
0d2d59f884 all: fix linting issues
Change-Id: Idfc93948e59a181321d79b365e638d63e256a16f
2022-03-21 15:26:42 +00:00