qfieldcloud icon indicating copy to clipboard operation
qfieldcloud copied to clipboard

Add Secrets to the admin page

Open boardend opened this issue 1 year ago • 1 comments

Secrets list view: Screenshot from 2024-04-26 11-04-09


Adding a new secret: Screenshot from 2024-04-26 11-05-37

  • Name, Type, Value and Project can be specified
    • Created by will be set to the current user

Modifying an existing secret: Screenshot from 2024-04-26 11-05-54

  • Value is not presented to the user
  • Everything is read only
    • Except that the Value can be overwritten
      • TextInput or Textarea based on Type

boardend avatar Apr 25 '24 21:04 boardend

@suricactus BadSignature error occurs when you have secrets in the db encrypted with a different key (e.g. a db dump from another system). Try to clean the secrets table and test with newly created secrets.

boardend avatar May 22 '24 11:05 boardend

There is now a read-only ProjectSecretInline:

Screenshot from 2024-05-25 11-14-44

The only missing part is a button in the project admin to create a new secret for that project. @suricactus do you have an idea how this can be implemented (without a custom project template)?

Otherwise I think this is ready to be merged.

boardend avatar May 25 '24 09:05 boardend

The only missing part is a button in the project admin to create a new secret for that project. @suricactus do you have an idea how this can be implemented (without a custom project template)?

See potential fix to this issue here: https://github.com/opengisch/qfieldcloud/pull/949

Otherwise I think this is ready to be merged.

I did a small commit, check it's commit and message. In general, we always prefer to use the decorator for new admin stuff, the old way looks a bit too hacky.

suricactus avatar May 26 '24 08:05 suricactus

One thing which you might have considered is to move the validation from admin.ProjectSecretForm.clean() to the models.Secret.clean().

Since we are messing with the name in admin.ProjectSecretForm.clean() too, I will leave everything in one place. But I will keep it in mind, when we e.g. extend the scope of the secrets.

Just re-based on my machine. If the tests pass, I will squash and merge.

boardend avatar May 27 '24 08:05 boardend