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

Align scope defaults with Mastodon API #116

Closed
bocops opened this issue Jan 20, 2023 · 1 comment · Fixed by #382 · May be fixed by #119
Closed

Align scope defaults with Mastodon API #116

bocops opened this issue Jan 20, 2023 · 1 comment · Fixed by #382 · May be fixed by #119
Assignees
Labels
breaking Incompatible with previous versions good first issue Good for newcomers, low-hanging fruit
Milestone

Comments

@bocops
Copy link
Collaborator

bocops commented Jan 20, 2023

AppMethods.createApp() currently defaults to all scopes if none are given. The endpoint that is called defaults to only read scope if none is given: Mastodon documentation.

We should default to the same values, and not request more. Breaking change, because our current default value allows more than would be allowed after this change.

Other API methods that send a scope should also be checked.

@bocops bocops added good first issue Good for newcomers, low-hanging fruit breaking Incompatible with previous versions labels Jan 20, 2023
@andregasser andregasser added this to the 2.0.0 milestone Jan 20, 2023
@andregasser andregasser self-assigned this Jan 20, 2023
@andregasser
Copy link
Owner

andregasser commented Jan 20, 2023

Let's fix this in the 2.0.0 then. Already on it.

@andregasser andregasser linked a pull request Jan 20, 2023 that will close this issue
@andregasser andregasser assigned bocops and unassigned andregasser Dec 8, 2023
bocops added a commit to bocops/bigbone that referenced this issue Dec 8, 2023
- makes all scope parameters in OAuth and App methods optional. Endpoints not receiving a scope parameter will default to granting "read" permission.
- removes default parameter value from Scope constructor. Users will need to define a certain scope if they want to use it.
Closes andregasser#116.

- adds all scopes as defined by Mastodon, marks existing scopes FOLLOW and ALL as deprecated.
- removes all internal usage of the now deprecated ALL scope.
Closes andregasser#143.

- moves deduplication of scopes from a separate function into the one building the parameter string. This avoids unnecessarily throwing an IllegalArgumentException.
Closes andregasser#381.
@bocops bocops mentioned this issue Dec 8, 2023
5 tasks
PattaFeuFeu added a commit that referenced this issue Dec 15, 2023
* Update scopes used in OAuth

- makes all scope parameters in OAuth and App methods optional. Endpoints not receiving a scope parameter will default to granting "read" permission.
- removes default parameter value from Scope constructor. Users will need to define a certain scope if they want to use it.
Closes #116.

- adds all scopes as defined by Mastodon, marks existing scopes FOLLOW and ALL as deprecated.
- removes all internal usage of the now deprecated ALL scope.
Closes #143.

- moves deduplication of scopes from a separate function into the one building the parameter string. This avoids unnecessarily throwing an IllegalArgumentException.
Closes #381.

* Enhance Scope usage in tests

- in integration tests, declare "full scope" once
- in unit tests, do not specify any Scope unless directly tested
- remove deprecated "follow" scope from the access token asset

* In samples to get access token, ensure that scopes requested for the token match those in OAuth URL.

* Enable hierarchical access to defined scopes

- replace Name enum with hierarchical structure for a more intuitive access to individual scopes
- changing samples and USAGE.md to match

Examples:
- Scope(Scope.Name.READ) becomes Scope(Scope.READ.ALL)
- Scope(Scope.Name.ADMIN_READ_ACCOUNTS) becomes Scope(Scope.ADMIN.READ.ACCOUNTS)

---------

Co-authored-by: Patrick Geselbracht <code@patrick-geselbracht.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Incompatible with previous versions good first issue Good for newcomers, low-hanging fruit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants