Skip to content

Commit

Permalink
4.0
Browse files Browse the repository at this point in the history
partner launcher, team folders and new user UI
  • Loading branch information
jackb-dropbox committed Aug 29, 2016
1 parent b9aae19 commit 6a1867f
Show file tree
Hide file tree
Showing 55 changed files with 4,511 additions and 922 deletions.
Binary file modified Installer/DBAdminToolkit.Setup.zip
Binary file not shown.
268 changes: 161 additions & 107 deletions Source/DBAdminToolkit.Setup/DBAdminToolkit.Setup.vdproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Source/DfBAdminToolkit.Common/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.5.0.0")]
[assembly: AssemblyFileVersion("3.5.0.0")]
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")]
16 changes: 16 additions & 0 deletions Source/DfBAdminToolkit.Common/Services/IMemberServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public interface IMemberServices {

string SetProfileUrl { get; set; }

string ActivateTeamFolderUrl { get; set; }

string ArchiveTeamFolderUrl { get; set; }

string CreateTeamFolderUrl { get; set; }

string ListTeamFolderUrl { get; set; }

string UpdateMembersTeamFolderUrl { get; set; }

string UserAgentVersion { get; set; }

#endregion Endpoint urls
Expand Down Expand Up @@ -76,5 +86,11 @@ public interface IMemberServices {
IDataResponse FindDevices(IMemberData data, string authToken);

IDataResponse DumpDevices(IMemberData data, string authToken);

IDataResponse ListTeamFolders(string authToken);

IServiceResponse CreateTeamFolder(string teamFolderName, bool syncSetting, string authToken);

IServiceResponse SetFolderStatus(string teamFolderId, bool activeSetting, string authToken);
}
}
138 changes: 138 additions & 0 deletions Source/DfBAdminToolkit.Common/Services/MemberServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ public class MemberServices

public string DeleteMemberGroupUrl { get; set; }

public string ActivateTeamFolderUrl { get; set; }

public string ArchiveTeamFolderUrl { get; set; }

public string CreateTeamFolderUrl { get; set; }

public string ListTeamFolderUrl { get; set; }

public string UpdateMembersTeamFolderUrl { get; set; }

public string UserAgentVersion { get; set; }

public MemberServices(
Expand Down Expand Up @@ -683,6 +693,134 @@ public IServiceResponse SetProfile(IMemberData data, string authToken)
return serviceResponse;
}

public IDataResponse ListTeamFolders(string authToken)
{
IDataResponse dataResponse = null;
try
{
if (!string.IsNullOrEmpty(ListTeamFolderUrl))
{
RestClient client = new RestClient(
string.Format("{0}/{1}/", _baseUrl, _apiVersion)
);
RestRequest request = new RestRequest(ListTeamFolderUrl, Method.POST);

//add headers
request.AddHeader("Authorization", "Bearer " + authToken);
JObject json = new JObject(
new JProperty("limit", 1000)
);
request.AddParameter("application/json", json, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
client.UserAgent = UserAgentVersion;
IRestResponse response = client.Execute(request);
dataResponse = new DataResponse(response.StatusCode, response.ErrorMessage, response.Content);
}
else
{
throw new ArgumentNullException("Missing service url");
}
}
catch (Exception e)
{
dataResponse = new DataResponse(HttpStatusCode.InternalServerError, e.Message, null);
}
return dataResponse;
}

public IServiceResponse CreateTeamFolder(string teamFolderName, bool syncSetting, string authToken)
{
IServiceResponse serviceResponse = null;
string syncStringSetting = "sync";
if (!syncSetting)
{
syncStringSetting = "no_sync";
}
try
{
if (!string.IsNullOrEmpty(CreateTeamFolderUrl))
{
RestClient client = new RestClient(string.Format("{0}/{1}/", _baseUrl, _apiVersion));
RestRequest request = new RestRequest(CreateTeamFolderUrl, Method.POST);
request.AddHeader("Authorization", Convert.ToString("Bearer ") + authToken);
request.AddHeader("Content-Type", "application/json");

JObject json = new JObject(
new JProperty("name", teamFolderName),
new JProperty("default_sync_setting", syncStringSetting)
);

request.AddParameter("application/json", json, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
client.UserAgent = UserAgentVersion;
IRestResponse response = client.Execute(request);
serviceResponse = new ServiceResponse(response.StatusCode, response.ErrorMessage);
}
else
{
throw new ArgumentNullException("Missing service url");
}
}
catch (Exception e)
{
serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
}
return serviceResponse;
}

public IServiceResponse SetFolderStatus(string teamFolderId, bool activeSetting, string authToken)
{
IServiceResponse serviceResponse = null;
string url = string.Empty;
if (activeSetting)
{
url = ActivateTeamFolderUrl;
}
if (!activeSetting)
{
url = ArchiveTeamFolderUrl;
}
try
{
if (!string.IsNullOrEmpty(ActivateTeamFolderUrl) || !string.IsNullOrEmpty(ArchiveTeamFolderUrl))
{
RestClient client = new RestClient(string.Format("{0}/{1}/", _baseUrl, _apiVersion));
RestRequest request = new RestRequest(url, Method.POST);
request.AddHeader("Authorization", Convert.ToString("Bearer ") + authToken);
request.AddHeader("Content-Type", "application/json");

if (activeSetting)
{
JObject json = new JObject(
new JProperty("team_folder_id", teamFolderId)
);
request.AddParameter("application/json", json, ParameterType.RequestBody);
}
if (!activeSetting)
{
JObject json = new JObject(
new JProperty("team_folder_id", teamFolderId),
new JProperty("force_async_off", false)
);
request.AddParameter("application/json", json, ParameterType.RequestBody);
}
request.RequestFormat = DataFormat.Json;
client.UserAgent = UserAgentVersion;
IRestResponse response = client.Execute(request);
serviceResponse = new ServiceResponse(response.StatusCode, response.ErrorMessage);
}
else
{
throw new ArgumentNullException("Missing service url");
}
}
catch (Exception e)
{
serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
}
return serviceResponse;
}

public IDataResponse DumpFile(IMemberData data, string outputFolder, string authToken)
{
IDataResponse dataResponse = null;
Expand Down
9 changes: 7 additions & 2 deletions Source/DfBAdminToolkit.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DfBAdminToolkit", "DfBAdminToolkit\DfBAdminToolkit.csproj", "{EC2E5FEB-36F2-46E3-959B-CFF92360C202}"
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "DBAdminToolkit.Setup", "DBAdminToolkit.Setup\DBAdminToolkit.Setup.vdproj", "{67F7291F-4179-4A69-8B74-40C5769A3ED1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DfBAdminToolkit.Common", "DfBAdminToolkit.Common\DfBAdminToolkit.Common.csproj", "{1091B7C4-F32C-4219-B04A-A25BD4D0B928}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProviderLauncher", "ProviderLauncher\ProviderLauncher.csproj", "{A2EEBF5F-C3C9-44B5-A594-1D06E305AFF9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -25,6 +26,10 @@ Global
{1091B7C4-F32C-4219-B04A-A25BD4D0B928}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1091B7C4-F32C-4219-B04A-A25BD4D0B928}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1091B7C4-F32C-4219-B04A-A25BD4D0B928}.Release|Any CPU.Build.0 = Release|Any CPU
{A2EEBF5F-C3C9-44B5-A594-1D06E305AFF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2EEBF5F-C3C9-44B5-A594-1D06E305AFF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2EEBF5F-C3C9-44B5-A594-1D06E305AFF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2EEBF5F-C3C9-44B5-A594-1D06E305AFF9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions Source/DfBAdminToolkit/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<add key="ActionGetUsage" value="users/get_space_usage" />
<add key="ActionGetInfo" value="team/get_info" />
<add key="ActionSetProfile" value="team/members/set_profile" />
<add key="ActionActivateTeamFolder" value="team/team_folder/activate" />
<add key="ActionArchiveTeamFolder" value="team/team_folder/archive" />
<add key="ActionCreateTeamFolder" value="team/team_folder/create" />
<add key="ActionListTeamFolder" value="team/team_folder/list" />
<add key="ActionUpdateMembersTeamFolder" value="team/team_folder/update_members" />

<!-- registry handling -->
<add key="RegistryEntryPoint" value="SOFTWARE\Dropbox Business Toolkit" />
Expand Down
25 changes: 25 additions & 0 deletions Source/DfBAdminToolkit/ApplicationResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,31 @@ public static string ActionSetProfile
get { return ConfigurationManager.AppSettings.Get("ActionSetProfile"); }
}

public static string ActionActivateTeamFolder
{
get { return ConfigurationManager.AppSettings.Get("ActionActivateTeamFolder"); }
}

public static string ActionArchiveTeamFolder
{
get { return ConfigurationManager.AppSettings.Get("ActionArchiveTeamFolder"); }
}

public static string ActionCreateTeamFolder
{
get { return ConfigurationManager.AppSettings.Get("ActionCreateTeamFolder"); }
}

public static string ActionListTeamFolder
{
get { return ConfigurationManager.AppSettings.Get("ActionListTeamFolder"); }
}

public static string ActionUpdateMembersTeamFolder
{
get { return ConfigurationManager.AppSettings.Get("ActionUpdateMembersTeamFolder"); }
}

public static int SearchDefaultLimit {
get {
int limit = 1000;
Expand Down
15 changes: 15 additions & 0 deletions Source/DfBAdminToolkit/DfBAdminToolkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@
<Compile Include="Model\IModel.cs" />
<Compile Include="Model\IProvisioningModel.cs" />
<Compile Include="Model\ISettingsModel.cs" />
<Compile Include="Model\ITeamFoldersModel.cs" />
<Compile Include="Model\ITextSearchModel.cs" />
<Compile Include="Model\LegalModel.cs" />
<Compile Include="Model\MainModel.cs" />
<Compile Include="Model\MemberListViewItemModel.cs" />
<Compile Include="Model\ProvisioningModel.cs" />
<Compile Include="Model\SettingsModel.cs" />
<Compile Include="Model\TeamFoldersListViewItemModel.cs" />
<Compile Include="Model\TeamFoldersModel.cs" />
<Compile Include="Model\TeamListViewItemModel.cs" />
<Compile Include="Model\TextSearchModel.cs" />
<Compile Include="Presenter\DataMigrationPresenter.cs" />
Expand All @@ -125,6 +128,7 @@
<Compile Include="Presenter\ILegalPresenter.cs" />
<Compile Include="Presenter\IProvisioningPresenter.cs" />
<Compile Include="Presenter\ISettingsPresenter.cs" />
<Compile Include="Presenter\ITeamFoldersPresenter.cs" />
<Compile Include="Presenter\ITextSearchPresenter.cs" />
<Compile Include="Presenter\LegalPresenter.cs" />
<Compile Include="Presenter\IMainPresenter.cs" />
Expand All @@ -133,6 +137,7 @@
<Compile Include="Presenter\PresenterBase.cs" />
<Compile Include="Presenter\ProvisioningPresenter.cs" />
<Compile Include="Presenter\SettingsPresenter.cs" />
<Compile Include="Presenter\TeamFoldersPresenter.cs" />
<Compile Include="Presenter\TextSearchPresenter.cs" />
<Compile Include="Services\GitHubService.cs" />
<Compile Include="Tooltips.cs" />
Expand Down Expand Up @@ -166,6 +171,7 @@
<Compile Include="View\IGroupsView.cs" />
<Compile Include="View\IProvisioningView.cs" />
<Compile Include="View\ISettingsView.cs" />
<Compile Include="View\ITeamFoldersView.cs" />
<Compile Include="View\ITextSearchView.cs" />
<Compile Include="View\Overlay\MemberInfoOverlay.cs" />
<Compile Include="View\ProvisioningView.cs">
Expand All @@ -180,6 +186,12 @@
<Compile Include="View\SettingsView.Designer.cs">
<DependentUpon>SettingsView.cs</DependentUpon>
</Compile>
<Compile Include="View\TeamFoldersView.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="View\TeamFoldersView.designer.cs">
<DependentUpon>TeamFoldersView.cs</DependentUpon>
</Compile>
<Compile Include="View\TextSearchView.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -227,6 +239,9 @@
<EmbeddedResource Include="View\SettingsView.resx">
<DependentUpon>SettingsView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\TeamFoldersView.resx">
<DependentUpon>TeamFoldersView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\TextSearchView.resx">
<DependentUpon>TextSearchView.cs</DependentUpon>
</EmbeddedResource>
Expand Down
3 changes: 3 additions & 0 deletions Source/DfBAdminToolkit/ErrorMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ public static class ErrorMessages
public readonly static string FAILED_TO_CREATE_GROUP = "Bad request to the API, possibly due to no permissions on your app to create groups.";
public readonly static string FAILED_TO_ADD_MEMBER_TO_GROUP = "Bad request to the API, possibly due to no permissions on your app to add members to groups.";
public readonly static string FAILED_TO_DELETE_MEMBER_FROM_GROUP = "Bad request to the API, possibly due to no permissions on your app to delete members from groups.";
public readonly static string FAILED_TO_GET_TEAMFOLDERS = "Bad request to the API, possibly due to no permissions to get team folders.";
public readonly static string FAILED_TO_CREATE_TEAMFOLDER = "Bad request to the API, possibly due to no permissions on your app to create team folders.";
public readonly static string FAILED_TO_UPDATE_TEAM_FOLDER_STATUS = "Bad request to the API, possibly due to no permissions on your app to update team folder status.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<add key="ActionGetGroupsContinuation" value="team/groups/list/continue" />
<add key="ActionCreateGroup" value="team/groups/create" />
<add key="ActionAddMemberGroup" value="team/groups/members/add" />
<add key="ActionDeleteMemberGroup" value="team/groups/members/remove" />
<add key="ActionDeleteMemberGroup" value="team/groups/members/remove" />
<add key="ActionFilesDownload" value="files/download" />
<add key="ActionAddMember" value="team/members/add" />
<add key="ActionRemoveMember" value="team/members/remove" />
Expand All @@ -33,6 +33,11 @@
<add key="ActionGetUsage" value="users/get_space_usage" />
<add key="ActionGetInfo" value="team/get_info" />
<add key="ActionSetProfile" value="team/members/set_profile" />
<add key="ActionActivateTeamFolder" value="team/team_folder/activate" />
<add key="ActionArchiveTeamFolder" value="team/team_folder/archive" />
<add key="ActionCreateTeamFolder" value="team/team_folder/create" />
<add key="ActionListTeamFolder" value="team/team_folder/list" />
<add key="ActionUpdateMembersTeamFolder" value="team/team_folder/update_members" />

<!-- registry handling -->
<add key="RegistryEntryPoint" value="SOFTWARE\Dropbox Business Toolkit" />
Expand Down
2 changes: 2 additions & 0 deletions Source/DfBAdminToolkit/Install Config/Providers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Providers>
</Providers>
12 changes: 12 additions & 0 deletions Source/DfBAdminToolkit/Model/ITeamFoldersModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace DfBAdminToolkit.Model {

using System.Collections.Generic;

public interface ITeamFoldersModel
: IModel {

string AccessToken { get; set; }

List<TeamFoldersListViewItemModel> TeamFolders { get; set; }
}
}
Loading

0 comments on commit 6a1867f

Please sign in to comment.