#4320 add service accounts
Closed by ryanlerch. Opened by karsten.
karsten/pagure add_service_accounts  into  master

Download 4320.patch

Add service accounts

Service accounts are just like normal user accounts, but with a longer expiration time for tokens (TODO: make that time configurable) and they can be maintained by a number of assigned service admins once they got created by a pagure admin.

This patch adds functionality to edit other user preferences. Normal users can't edit other user preferences, service admins can only edit their assigned service accounts. Nice side effect is that pagure admins can now edit other user accounts.

Signed-off-by: Karsten Hopp karsten@redhat.com

This is for https://pagure.io/pagure/issue/3553

This doesn't seem to be used anywhere :)

could we reformulate the docstring, from just reading it, I don't understand what it does :(

This could be moved outside of the if, allowing to drop the else entirely

If username is optional, I'd recommend we give it a default value (username=None)

I'm confused, does this means these templates can be accessed even if the service accounts are disabled?

2019 no? :)

if we always activate this file, I'd recommend we add a decorator that simply returns a 404 if the pagure instance isn't configured for service accounts.

Service accounts are just like normal user accounts, but with a longer expiration time for tokens

We ought to formulate this differently, otherwise, isn't the solution to simply increase the expiration time for API tokens? (which pagure admins can already do manually using the pagure-admin CLI).

rebased onto 14ab2530101b910182cba8d4fb86f7925d5f8774

I've
- removed unused functions in pagure/lib/model.py
- updated the docstring of get_other_user()
- moved 'name = flask.g.fas_user.username' in pagure/flask_app.py
to get rid of an else: statement
- set default username to None in get_other_user()
- update year in copyright of pagure/ui/services.py

regarding the check for ENABLE_SERVICE_ACCOUNTS. If you know that there is an URL http://localhost.localdomain:5000/user/new/service/ it is better to give a hint about what setting needs to be added/changed instead of returning 404. Just my opinion, but I can fix the code if you insist.

Pretty please pagure-ci rebuild

rebased onto c5e1f40af74c490eb66d39edc20c2b82dbd99bfd

2 new commits added

  • add decorator without username
  • flake8 and black fixes

rebased onto 1abbe7ddfce114724977894c61251d4faa87f64b

rebased onto a8c3c29fd77dde1d8964cdfdf2a5c39dd39166e2

rebased onto 8126b1b994bbad288a36ecb8f3118e51232392eb

@ngompa do we want to have service accounts in a next pagure release? if so, then I think we have to pick the code and create a new PR from it.

I think we would want to, as that opens the door for proper integration with external services with bot users. Right now, we kind of hack it with yet another SSO user (see the packit user in FAS, for example). Depending on the environment, that could be a very costly choice.

This project has moved to https://forge.fedoraproject.org/apps/pagure. As part of the migration, all open pull requests on pagure.io have been closed. If you'd like to continue working on this, please fork the repository on the new forge and re-submit your PR there.

Pull-Request has been closed by ryanlerch

Metadata