Skip to content

Commit 661b9b1

Browse files
author
Qiming Yuan
committed
Add require_role parameter.
1 parent 34fcb37 commit 661b9b1

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

buildall.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $generatorPath = "$generatorDir\csharp.stoneg.py"
2121
$generatorArgs = @("-m", "stone.cli", "-a:all", $generatorPath, $sourceDir)
2222
$docBuildPath = Resolve-Path "doc\StoneDocs.shfbproj"
2323
$majorVersion = "4.0"
24-
$releaseVersion = "4.5.1"
24+
$releaseVersion = "4.5.2"
2525
$assemblyInfoPath = "$sourceDir\AppProperties\AssemblyInfo.cs"
2626
$signKeyPath = "$sourceDir\dropbox_api_key.snk"
2727

dropbox-sdk-dotnet/Dropbox.Api/AppProperties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
[assembly: AssemblyCulture("")]
1919

2020
[assembly: AssemblyVersion("4.0.0")]
21-
[assembly: AssemblyFileVersion("4.0.6489")]
21+
[assembly: AssemblyFileVersion("4.0.6492")]

dropbox-sdk-dotnet/Dropbox.Api/Dropbox.Api.nuspec

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>Dropbox.Api</id>
5-
<version>4.5.1</version>
5+
<version>4.5.2</version>
66
<title>Dropbox v2 API</title>
77
<authors>Dropbox Inc</authors>
88
<owners>Dropbox Inc</owners>
@@ -13,9 +13,8 @@
1313
<description>Portable class library for accessing the Dropbox v2 API</description>
1414
<releaseNotes>
1515
What's New:
16-
- Files:
17-
- ListFolder now supports shared links.
18-
- Added Mode parameter to ListRevisions.
16+
- OAuth 2
17+
- Add require_role parameter.
1918
</releaseNotes>
2019
<copyright>Copyright (c) Dropbox Inc. 2016</copyright>
2120
<tags>Dropbox Api</tags>

dropbox-sdk-dotnet/Dropbox.Api/DropboxOauth2Helper.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ public static class DropboxOAuth2Helper
173173
/// <param name="disableSignup">When <c>true</c> (default is <c>false</c>) users will not be able to sign up for a
174174
/// Dropbox account via the authorization page. Instead, the authorization page will show a link to the Dropbox
175175
/// iOS app in the App Store. This is only intended for use when necessary for compliance with App Store policies.</param>
176+
/// <param name="requireRole"If this parameter is specified, the user will be asked to authorize with a particular
177+
/// type of Dropbox account, either work for a team account or personal for a personal account. Your app should still
178+
/// verify the type of Dropbox account after authorization since the user could modify or remove the require_role
179+
/// parameter</param>
176180
/// <returns>The uri of a web page which must be displayed to the user in order to authorize the app.</returns>
177-
public static Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string clientId, string redirectUri = null, string state = null, bool forceReapprove = false, bool disableSignup = false)
181+
public static Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string clientId, string redirectUri = null, string state = null, bool forceReapprove = false, bool disableSignup = false, string requireRole = null)
178182
{
179183
var uri = string.IsNullOrEmpty(redirectUri) ? null : new Uri(redirectUri);
180184

@@ -201,8 +205,12 @@ public static Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string cl
201205
/// <param name="disableSignup">When <c>true</c> (default is <c>false</c>) users will not be able to sign up for a
202206
/// Dropbox account via the authorization page. Instead, the authorization page will show a link to the Dropbox
203207
/// iOS app in the App Store. This is only intended for use when necessary for compliance with App Store policies.</param>
208+
/// <param name="requireRole"If this parameter is specified, the user will be asked to authorize with a particular
209+
/// type of Dropbox account, either work for a team account or personal for a personal account. Your app should still
210+
/// verify the type of Dropbox account after authorization since the user could modify or remove the require_role
211+
/// parameter</param>
204212
/// <returns>The uri of a web page which must be displayed to the user in order to authorize the app.</returns>
205-
public static Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string clientId, Uri redirectUri = null, string state = null, bool forceReapprove = false, bool disableSignup = false)
213+
public static Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string clientId, Uri redirectUri = null, string state = null, bool forceReapprove = false, bool disableSignup = false, string requireRole = null)
206214
{
207215
if (string.IsNullOrWhiteSpace(clientId))
208216
{
@@ -251,6 +259,11 @@ public static Uri GetAuthorizeUri(OAuthResponseType oauthResponseType, string cl
251259
queryBuilder.Append("&disable_signup=true");
252260
}
253261

262+
if (!string.IsNullOrWhiteSpace(requireRole))
263+
{
264+
queryBuilder.Append("require_role=").Append(requireRole);
265+
}
266+
254267
var uriBuilder = new UriBuilder("https://www.dropbox.com/oauth2/authorize")
255268
{
256269
Query = queryBuilder.ToString()

0 commit comments

Comments
 (0)