Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.15] Added functionality to handle access tokens #800

Open
wants to merge 16 commits into
base: 11.15
Choose a base branch
from

Conversation

inuitviking
Copy link

@inuitviking inuitviking commented Mar 6, 2024

Closes #799
Closes #798

This pull request includes:

  • A new method in AbstractApi: getGroupPath (group equivalent to getProjectPath)
  • New methods in Groups:
    • groupAccessTokens
    • groupAccessToken
    • createGroupAccessToken
    • deleteGroupAccessToken
    • rotateGroupAccessToken
  • New methods in Projects
    • rotateProjectAccessToken
  • Tests for above methods

The above methods are almost 1:1 to the same functionality available for project access tokens, making this pull request super easy to make. Tested with the available test tools seen in this project (albeit locally) and against my company's private group (with Premium). Works as expected in that regard.

The rotate methods simply rotate the specified access token, and returns the resulting array, containing also the token itself; this is handy for automatically updating variables in Gitlab containing these tokens.

This is similar to getProjectPath, but for groups.
Adds the same functions currently available for project access tokens,
but for groups.
@m4tthumphrey
Copy link
Contributor

@inuitviking Hello! Thanks for contributing on this project! However I am no longer involved with this, I think it is still under my username but I haven't used or look at this for a good few years now. I believe @GrahamCampbell is a maintainer these days.

@inuitviking
Copy link
Author

@inuitviking Hello! Thanks for contributing on this project! However I am no longer involved with this, I think it is still under my username but I haven't used or look at this for a good few years now. I believe @GrahamCampbell is a maintainer these days.

Ah, sorry for bothering you! Thank you for mentioning Graham.

The require for PHP versions was inaccurate, as this project actually
only supports PHP 8.1 and above.
inuitviking and others added 7 commits March 6, 2024 15:17
This has been added to make PHPStan happi. :)
It added tabs instead of spaces. :(
PHPDocs were faulty (according to PHPStan) in Authentication and
ExceptionThrower. The `make test` command should no longer fail.
It appears to be very picky; I guess this is good practice.
@GrahamCampbell GrahamCampbell changed the title Added functionality to handle group access tokens [11.15] Added functionality to handle group access tokens Mar 17, 2024
@GrahamCampbell GrahamCampbell changed the base branch from 11.13 to 11.15 March 17, 2024 21:39
@GrahamCampbell
Copy link
Member

Thanks for the PR. I've re-triggered the CI, and will try to review this shortly, for the 11.15.0 release. I wasn't able to allocate the time to get this into today's 11.14.0 release I'm afraid.

@inuitviking
Copy link
Author

I have added some more things since, as I got more requests for specific features. Will update tomorrow (Monday)

@inuitviking inuitviking changed the title [11.15] Added functionality to handle group access tokens [11.15] Added functionality to handle access tokens Mar 18, 2024
@inuitviking
Copy link
Author

I have added some more things since, as I got more requests for specific features. Will update tomorrow (Monday)

By the way, and excuse my late comment, this has been done on that Monday.

*
* @return mixed
*/
public function rotateProjectAccessToken(string|int $project_id, string|int $token_id, string $expiry = ''): mixed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Group access tokens ResultPager cannot unpack array with string keys
4 participants