-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
onedrive: about the Sites.Read.All permission request #5883
Conversation
5d76ca0
to
6ccc558
Compare
I added (partial) docs about the Sites.Read.All permission. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @cqjjjzr! Please see my comments below :)
backend/onedrive/onedrive.go
Outdated
@@ -374,6 +388,12 @@ func Config(ctx context.Context, name string, m configmap.Mapper, config fs.Conf | |||
region, graphURL := getRegionURL(m) | |||
|
|||
if config.State == "" { | |||
disableSitePermission, ok := m.Get("disable_site_permission") | |||
if disableSitePermission == "true" && ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if disableSitePermission == "true" && ok { | |
if ok && disableSitePermission == "true" { |
Usually we put ok
before the value predicate. Or we can just remove it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some more thinking I think we should just remove the check on ok
to allow possible changes to the default value. If at some later point we decided true
will be better as the default, the ok
check here will break that as it assumes false
should be the default.
docs/content/onedrive.md
Outdated
@@ -132,7 +132,7 @@ Client ID and Key by following the steps below: | |||
2. Enter a name for your app, choose account type `Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)`, select `Web` in `Redirect URI`, then type (do not copy and paste) `http://localhost:53682/` and click Register. Copy and keep the `Application (client) ID` under the app name for later use. | |||
3. Under `manage` select `Certificates & secrets`, click `New client secret`. Enter a description (can be anything) and set `Expires` to 24 months. Copy and keep that secret _Value_ for later use (you _won't_ be able to see this value afterwards). | |||
4. Under `manage` select `API permissions`, click `Add a permission` and select `Microsoft Graph` then select `delegated permissions`. | |||
5. Search and select the following permissions: `Files.Read`, `Files.ReadWrite`, `Files.Read.All`, `Files.ReadWrite.All`, `offline_access`, `User.Read`. Once selected click `Add permissions` at the bottom. | |||
5. Search and select the following permissions: `Files.Read`, `Files.ReadWrite`, `Files.Read.All`, `Files.ReadWrite.All`, `offline_access`, `User.Read`, `Sites.Read.All` (optional). Once selected click `Add permissions` at the bottom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. Search and select the following permissions: `Files.Read`, `Files.ReadWrite`, `Files.Read.All`, `Files.ReadWrite.All`, `offline_access`, `User.Read`, `Sites.Read.All` (optional). Once selected click `Add permissions` at the bottom. | |
5. Search and select the following permissions: `Files.Read`, `Files.ReadWrite`, `Files.Read.All`, `Files.ReadWrite.All`, `offline_access`, `User.Read`, and optionally `Sites.Read.All` (see below). Once selected click `Add permissions` at the bottom. |
Perhaps this and an extra sentence below explaining the option & linking to the issue #1770 would be better.
Should I push multiple commits or squash them using rebase and do a force push? |
You don't need to force push :) Force pushing will probably mess up with the review history. Just push them normally and everything will be squashed before merging into master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks! I'll merge this now.
What is the purpose of this change?
In fix of #1770 , a new permission request was added in the OneDrive backend support:
Sites.Read.All
. This is intended to solve the error when using a custom SharePoint site. However, such changes are undocumented.On a domain with an excessively strict authorization policy (e.g. my university), the domain disallows users to consent permissions on their own and the
Sites.Read.All
permission is undocumented thus not configured, the extraSites.Read.All
scope when requesting an access token will trigger "Application needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it." message.Therefore, this PR involves a new advanced config entry
disable_site_permission
(default to false). When turned on, this config will prevent the OAuth client to requestSites.Read.All
permission. The "Search for a SharePoint site" may be unusable because of this, but for those under a strict policy who don't need custom site configuration, this should be enough.For the documentation, since I'm unfamiliar with the documentation structure, I didn't attempt to include all documentation for this. Instructions on writing docs will be much appreciated
Was the change discussed in an issue or in the forum before?
See #1770
Checklist