inveniosoftware / docs-invenio-rdm

InvenioRDM docs
https://inveniordm.docs.cern.ch/
MIT License
21 stars 60 forks source link

Fix admin user account documentation #599

Closed thomasms closed 5 months ago

thomasms commented 5 months ago

:heart: Thank you for your contribution!

Description

Please describe briefly your pull request.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Third-party code

If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.
thomasms commented 5 months ago

For me administration-access didn't work, you can see my error message below.

[root@a5e314412111 src]# invenio access allow administration-access user admin@localhost.com
Traceback (most recent call last):
  File "/usr/bin/invenio", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1720, in invoke
    return _process_result(rv)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1657, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/flask/cli.py", line 357, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/invenio_access/cli.py", line 147, in process_allow_action
    processor(action, argument)
  File "/usr/lib/python3.9/site-packages/invenio_access/cli.py", line 126, in processor
    db.session.add(ActionUsers.allow(action, argument=argument, user_id=user.id))
  File "/usr/lib/python3.9/site-packages/invenio_access/models.py", line 62, in allow
    return cls.create(action, exclude=False, **kwargs)
  File "/usr/lib/python3.9/site-packages/invenio_access/models.py", line 51, in create
    assert action.method == "action"
  File "/usr/lib/python3.9/site-packages/werkzeug/local.py", line 316, in __get__
    obj = instance._get_current_object()
  File "/usr/lib/python3.9/site-packages/werkzeug/local.py", line 520, in _get_current_object
    return get_name(local())  # type: ignore
  File "/usr/lib/python3.9/site-packages/invenio_access/cli.py", line 31, in <lambda>
    return LocalProxy(lambda: f(ctx, param, value))
  File "/usr/lib/python3.9/site-packages/invenio_access/cli.py", line 51, in process_action
    raise click.BadParameter('Action "%s" is not registered.', value)
  File "/usr/lib/python3.9/site-packages/click/exceptions.py", line 111, in __init__
    super().__init__(message, ctx)
  File "/usr/lib/python3.9/site-packages/click/exceptions.py", line 61, in __init__
    self.cmd: t.Optional["Command"] = self.ctx.command if self.ctx else None
AttributeError: 'str' object has no attribute 'command'

I am running this using the container instance and following the instructions from here.

I assumed it was a typo because it was the only thing that matched the access list:

[root@a5e314412111 src]# invenio access list
superuser-access:
admin-access:
files-rest-bucket-listmultiparts:*
files-rest-bucket-read:*
files-rest-bucket-read-versions:*
files-rest-bucket-update:*
files-rest-location-update:*
files-rest-multipart-delete:*
files-rest-multipart-read:*
files-rest-object-delete:*
files-rest-object-delete-version:*
files-rest-object-read:*
files-rest-object-read-version:*
fenekku commented 5 months ago

What version of invenio-app-rdm are you using? I am running 11.0.5 and I have:

> pipenv run invenio access list                                                                                                                                                              
Loading .env environment variables...                                                                                                                                                         
superuser-access:                                                                                                                                                                             
admin-access:                                                                                                                                                                                 
administration-access:                                                                                                                                                                        
files-rest-bucket-listmultiparts:*                                                                                                                                                            
files-rest-bucket-read:*                                                                                                                                                                      
files-rest-bucket-read-versions:*                                                                                                                                                             
files-rest-bucket-update:*                                                                                                                                                                    
files-rest-location-update:*                                                                                                                                                                  
files-rest-multipart-delete:*                                                                                                                                                                 
files-rest-multipart-read:*                                                                                                                                                                   
files-rest-object-delete:*                                                                                                                                                                    
files-rest-object-delete-version:*                                                                                                                                                            
files-rest-object-read:*                                                                                                                                                                      
files-rest-object-read-version:*                  

(the local/containerized divide "shouldn't" matter here)

If you are using v9 that would explain it :thinking:

thomasms commented 5 months ago

Ah indeed, I am using the LTS version 9.1. I assumed since this was the production version that the documentation would match, apologies for any confusion.

Is there a way to see the documentation for the LTS version easily?

fenekku commented 5 months ago

Ah indeed, I am using the LTS version 9.1. I assumed since this was the production version that the documentation would match, apologies for any confusion.

Is there a way to see the documentation for the LTS version easily?

No worries, it's on us to have a better documentation versioning experience. There isn't a way to switch to documentation for another version currently (the docs are not versioned that way anyway). We've adhoc-ly added itatlicized "New in version X" text in some places, but clearly it's not systematic enough to cover all cases. Anyway, adding that disclaimer ("New in version 11") is probably the right fix for now.

Thanks for pointing this out though! best.

thomasms commented 5 months ago

Thanks for the clear and quick response. I'll close the PR.