Skip to content

Commit

Permalink
Add persistent_id into bulk provision (#37)
Browse files Browse the repository at this point in the history
* add persistent_id field
* make the table flexible to accept persistent id
* make api call with persistent id
* update version number

Co-Authored-By: yjiangcs <[email protected]>
  • Loading branch information
yjiangcs authored and bprang committed Apr 26, 2019
1 parent fcdb6e4 commit 9d09757
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 14 deletions.
Binary file modified Installer/DBAdminToolkit.Setup.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/DBAdminToolkit.Setup/DBAdminToolkit.Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:6.1.0"
"ProductVersion" = "8:6.1.1"
"Manufacturer" = "8:Dropbox Enterprise Services"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down
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("6.1.0.0")]
[assembly: AssemblyFileVersion("6.1.0.0")]
[assembly: AssemblyVersion("6.1.1.0")]
[assembly: AssemblyFileVersion("6.1.1.0")]
2 changes: 2 additions & 0 deletions Source/DfBAdminToolkit.Common/Services/IMemberData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public interface IMemberData

string LastName { get; set; }

string PersistentId { get; set; }

bool SendWelcomeEmail { get; set; }

string MemberId { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Source/DfBAdminToolkit.Common/Services/MemberData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class MemberData

public string LastName { get; set; }

public string PersistentId { get; set; }

public bool SendWelcomeEmail { get; set; }

public string MemberId { get; set; }
Expand Down
6 changes: 5 additions & 1 deletion Source/DfBAdminToolkit.Common/Services/MemberServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public IServiceResponse AddMember(IMemberData data, string authToken)
),
new JProperty("force_async", false)
);
if (!String.IsNullOrEmpty(data.PersistentId)) {
JObject prov = (JObject)(jsonProv["new_members"] as JArray).First;
prov.Add(new JProperty("member_persistent_id", data.PersistentId.Trim()));
}
request.AddParameter("application/json", jsonProv, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
client.UserAgent = UserAgentVersion;
Expand Down Expand Up @@ -1752,4 +1756,4 @@ public IDataResponse GetStorage(string authToken)

#endregion
}
}
}
2 changes: 1 addition & 1 deletion Source/DfBAdminToolkit/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<add key="ApiVersion" value="2" />

<!-- API Actions & params -->
<add key="ConfigVersion" value="6.1.0.0" />
<add key="ConfigVersion" value="6.1.1.0" />
<add key="SearchDefaultLimit" value="1000" />
<add key="SearchFileCountLimit" value="1000" />
<add key="SuppressFilenamesInStatus" value="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<add key="ApiVersion" value="2" />

<!-- API Actions & params -->
<add key="ConfigVersion" value="6.1.0.0" />
<add key="ConfigVersion" value="6.1.1.0" />
<add key="SearchDefaultLimit" value="1000" />
<add key="SearchFileCountLimit" value="1000" />
<add key="SuppressFilenamesInStatus" value="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<add key="ApiVersion" value="2" />

<!-- API Actions & params -->
<add key="ConfigVersion" value="6.1.0.0" />
<add key="ConfigVersion" value="6.1.1.0" />
<add key="SearchDefaultLimit" value="1000" />
<add key="SearchFileCountLimit" value="1000" />
<add key="SuppressFilenamesInStatus" value="0" />
Expand Down
10 changes: 10 additions & 0 deletions Source/DfBAdminToolkit/Model/MemberListViewItemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class MemberListViewItemModel
private string _path;
private string _firstName;
private string _lastName;
private string _persistentId;
private string _status;
private string _role;
private decimal _usage;
Expand Down Expand Up @@ -59,6 +60,15 @@ public string LastName {
}
}

public string PersistentId {
get { return _persistentId; }
set
{
_persistentId = value;
OnPropertyChanged("PersistentId");
}
}

public string Role {
get { return _role; }
set {
Expand Down
24 changes: 21 additions & 3 deletions Source/DfBAdminToolkit/Presenter/ProvisioningPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ public bool LoadInputFile(IProvisioningModel model, IMainPresenter presenter)
LastName = reader.GetField<string>(2),
IsChecked = true
};
string persistent_id;
reader.TryGetField<string>(3, out persistent_id);
lvItem.PersistentId = persistent_id;

model.Members.Add(lvItem);
}
catch
Expand Down Expand Up @@ -156,6 +160,9 @@ public bool LoadUpdateInputFile(IProvisioningModel model, IMainPresenter present
NewExternalId = reader.GetField<string>(2),
IsChecked = true
};
string persistent_id;
reader.TryGetField<string>(3, out persistent_id);
lvItem.PersistentId = persistent_id;
model.Members.Add(lvItem);
}
catch
Expand Down Expand Up @@ -204,16 +211,17 @@ private string ProvisionRoles(IProvisioningModel model, IMainPresenter presenter
{
foreach (MemberListViewItemModel item in model.Members.Where(m => m.IsChecked).ToList())
{
IServiceResponse response = service.AddMember(new MemberData()
MemberData memberData = new MemberData()
{
Email = item.Email,
FirstName = item.FirstName,
LastName = item.LastName,
PersistentId = item.PersistentId,
SendWelcomeEmail = model.SendWelcomeEmail,
ProvisionStatus = item.ProvisionStatus,
RoleName = model.SelectedRole
}, model.AccessToken);
};
IServiceResponse response = service.AddMember(memberData, model.AccessToken);

if (response.StatusCode == HttpStatusCode.OK)
{
Expand All @@ -231,6 +239,16 @@ private string ProvisionRoles(IProvisioningModel model, IMainPresenter presenter
item.ProvisionStatus = "Team is already full.The organization has no available licenses.";
presenter.UpdateProgressInfo("Team is already full. The organization has no available licenses.");
}
if (response.Message.Contains("persistent_id_disabled"))
{
item.ProvisionStatus = "Persistent ID Disabled";
presenter.UpdateProgressInfo("Persistent ID Disabled");
}
if (response.Message.Contains("duplicate_member_persistent_id"))
{
item.ProvisionStatus = "Duplicate member persistent ID";
presenter.UpdateProgressInfo("Duplicate member persistent ID");
}
if (response.Message.Contains("free_team_member_limit_reached"))
{
item.ProvisionStatus = "Team is already full. The free team member limit has been reached.";
Expand Down
4 changes: 2 additions & 2 deletions Source/DfBAdminToolkit/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("6.1.0.0")]
[assembly: AssemblyFileVersion("6.1.0.0")]
[assembly: AssemblyVersion("6.1.1.0")]
[assembly: AssemblyFileVersion("6.1.1.0")]
10 changes: 10 additions & 0 deletions Source/DfBAdminToolkit/View/ProvisioningView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Source/DfBAdminToolkit/View/ProvisioningView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public ProvisioningView()
this.olvColumnProvisioning_Usage.IsVisible = false;
olvColumnProvisioning_NewEmail.IsVisible = false;
olvColumnProvisioning_NewExternalId.IsVisible = false;
olvColumnProvisionin_PersistentId.IsVisible = false;
olvColumnProvisioning_Status.IsVisible = false;

this.objectListView_ProvisioningMembers.RebuildColumns();
}

Expand Down Expand Up @@ -522,6 +524,7 @@ private void Button_ProvisioningLoadInputFile_Click(object sender, EventArgs e)
olvColumnProvisioning_NewEmail.IsVisible = false;
olvColumnProvisioning_NewExternalId.IsVisible = false;
olvColumnProvisioning_Status.IsVisible = true;
olvColumnProvisionin_PersistentId.IsVisible = true;
this.objectListView_ProvisioningMembers.RebuildColumns();

if (CommandLoadInputFile != null)
Expand All @@ -540,6 +543,7 @@ private void Button_ProvisioningLoadUpdateInputFile_Click(object sender, EventAr
olvColumnProvisioning_NewEmail.IsVisible = true;
olvColumnProvisioning_NewExternalId.IsVisible = true;
olvColumnProvisioning_Status.IsVisible = true;
olvColumnProvisionin_PersistentId.IsVisible = true;
this.objectListView_ProvisioningMembers.RebuildColumns();
if (CommandLoadUpdateInputFile != null)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/ProviderLauncher/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("6.1.0.0")]
[assembly: AssemblyFileVersion("6.1.0.0")]
[assembly: AssemblyVersion("6.1.1.0")]
[assembly: AssemblyFileVersion("6.1.1.0")]

0 comments on commit 9d09757

Please sign in to comment.