protected override void InitializeInternal() { // Data for this method // signerEmail // signerName var basePath = RequestItemsService.Session.BasePath + "/restapi"; var accessToken = RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN} var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID} var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var accountsApi = new AccountsApi(apiClient); var permissions = accountsApi.ListPermissions(accountId); PermissionProfiles = permissions.PermissionProfiles; var permissionProfile = permissions.PermissionProfiles.FirstOrDefault(); ProfileModel = new PermissionProfileModel { ProfileId = permissionProfile.PermissionProfileId, ProfileName = permissionProfile.PermissionProfileName, AccountRoleSettingsModel = new AccountRoleSettingsModel(permissionProfile.Settings) }; }
public IActionResult Create(PermissionProfileModel profileModel) { // Check the token with minimal buffer time. bool tokenOk = CheckToken(3); if (!tokenOk) { // We could store the parameters of the requested operation so it could be // restarted automatically. But since it should be rare to have a token issue // here, we'll make the user re-enter the form data after authentication. RequestItemsService.EgName = EgName; return(Redirect("/ds/mustAuthenticate")); } // Data for this method // signerEmail // signerName var basePath = RequestItemsService.Session.BasePath + "/restapi"; // Obtain your OAuth token var accessToken = RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN} var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID} try { // Call the eSignature REST API var results = ChangePermissionSingleSetting.UpdatePermissionProfile( profileModel.ProfileId, accessToken, basePath, accountId); ViewBag.h1 = "The permission profile was updated"; ViewBag.message = "The permission profile was updated!<br />Permission profile ID: " + results.PermissionProfileId + "."; return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
public IActionResult Create(PermissionProfileModel profileModel) { // Check the token with minimal buffer time. bool tokenOk = CheckToken(3); if (!tokenOk) { // We could store the parameters of the requested operation so it could be // restarted automatically. But since it should be rare to have a token issue // here, we'll make the user re-enter the form data after authentication. RequestItemsService.EgName = EgName; return(Redirect("/ds/mustAuthenticate")); } // Data for this method // signerEmail // signerName var basePath = RequestItemsService.Session.BasePath + "/restapi"; // Step 1. Obtain your OAuth token var accessToken = RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN} var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID} // Step 2. Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var accountsApi = new AccountsApi(apiClient); // Step 3. Construct the request body var permission = accountsApi.ListPermissions(accountId).PermissionProfiles. FirstOrDefault(profile => profile.PermissionProfileId == profileModel.ProfileId); var settingsToUpdate = new AccountRoleSettingsExtension { SigningUiVersion = "2" }; settingsToUpdate.UseNewDocuSignExperienceInterface = profileModel.AccountRoleSettingsModel.UseNewDocuSignExperienceInterface? "1" : "0"; settingsToUpdate.EnableSequentialSigningInterface = profileModel.AccountRoleSettingsModel.EnableSequentialSigningInterface.ToString(); settingsToUpdate.PowerFormRole = profileModel.AccountRoleSettingsModel.PowerFormRole.ToString(); settingsToUpdate.VaultingMode = profileModel.AccountRoleSettingsModel.VaultingMode.ToString(); settingsToUpdate.AllowTaggingInSendAndCorrect = profileModel.AccountRoleSettingsModel.AllowTaggingInSendAndCorrect.ToString(); settingsToUpdate.AllowedAddressBookAccess = profileModel.AccountRoleSettingsModel.AllowedAddressBookAccess.ToString(); settingsToUpdate.AllowedTemplateAccess = profileModel.AccountRoleSettingsModel.AllowedTemplateAccess.ToString(); // Present on PermissionProfileView. settingsToUpdate.AllowBulkSending = profileModel.AccountRoleSettingsModel.AllowBulkSending.ToString(); settingsToUpdate.AllowEnvelopeSending = profileModel.AccountRoleSettingsModel.AllowEnvelopeSending.ToString(); settingsToUpdate.AllowSignerAttachments = profileModel.AccountRoleSettingsModel.AllowSignerAttachments.ToString(); settingsToUpdate.AllowApiAccess = profileModel.AccountRoleSettingsModel.AllowApiAccess.ToString(); settingsToUpdate.AllowApiAccessToAccount = profileModel.AccountRoleSettingsModel.AllowApiAccessToAccount.ToString(); settingsToUpdate.AllowApiSequentialSigning = profileModel.AccountRoleSettingsModel.AllowApiSequentialSigning.ToString(); settingsToUpdate.EnableApiRequestLogging = profileModel.AccountRoleSettingsModel.EnableApiRequestLogging.ToString(); settingsToUpdate.AllowApiSendingOnBehalfOfOthers = profileModel.AccountRoleSettingsModel.AllowApiSendingOnBehalfOfOthers.ToString(); settingsToUpdate.AllowWetSigningOverride = profileModel.AccountRoleSettingsModel.AllowWetSigningOverride.ToString(); settingsToUpdate.EnableRecipientViewingNotifications = profileModel.AccountRoleSettingsModel.EnableRecipientViewingNotifications.ToString(); settingsToUpdate.ReceiveCompletedSelfSignedDocumentsAsEmailLinks = profileModel.AccountRoleSettingsModel.ReceiveCompletedSelfSignedDocumentsAsEmailLinks.ToString(); settingsToUpdate.UseNewSendingInterface = profileModel.AccountRoleSettingsModel.UseNewSendingInterface.ToString(); settingsToUpdate.AllowDocuSignDesktopClient = profileModel.AccountRoleSettingsModel.AllowDocuSignDesktopClient.ToString(); settingsToUpdate.AllowSendersToSetRecipientEmailLanguage = profileModel.AccountRoleSettingsModel.AllowSendersToSetRecipientEmailLanguage.ToString(); settingsToUpdate.AllowVaulting = profileModel.AccountRoleSettingsModel.AllowVaulting.ToString(); settingsToUpdate.AllowedToBeEnvelopeTransferRecipient = profileModel.AccountRoleSettingsModel.AllowedToBeEnvelopeTransferRecipient.ToString(); settingsToUpdate.EnableTransactionPointIntegration = profileModel.AccountRoleSettingsModel.EnableTransactionPointIntegration.ToString(); try { // Step 4. Call the eSignature REST API var results = accountsApi.UpdatePermissionProfile(accountId, profileModel.ProfileId, permission); ViewBag.h1 = "The permission profile was updated"; ViewBag.message = "The permission profile was updated!<br />Permission profile ID: " + results.PermissionProfileId + "."; return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
public IActionResult Create(PermissionProfileModel permissionProfileModel) { // Check the token with minimal buffer time. bool tokenOk = CheckToken(3); if (!tokenOk) { // We could store the parameters of the requested operation so it could be // restarted automatically. But since it should be rare to have a token issue // here, we'll make the user re-enter the form data after authentication. RequestItemsService.EgName = EgName; return(Redirect("/ds/mustAuthenticate")); } // Data for this method // signerEmail // signerName var basePath = RequestItemsService.Session.BasePath + "/restapi"; // Step 1. Obtain your OAuth token var accessToken = RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN} var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID} // Step 2. Construct your request var accountRoleSettings = new global::eSignature.Examples.CreatePermissionProfile.AccountRoleSettingsExtension(); accountRoleSettings.UseNewDocuSignExperienceInterface = "1"; accountRoleSettings.EnableSequentialSigningInterface = true.ToString(); accountRoleSettings.PowerFormRole = "admin"; accountRoleSettings.VaultingMode = "none"; accountRoleSettings.AllowTaggingInSendAndCorrect = true.ToString(); accountRoleSettings.AllowedAddressBookAccess = "personalAndShared"; accountRoleSettings.AllowedTemplateAccess = "share"; accountRoleSettings.SigningUiVersion = "2"; // Present on PermissionProfileView. accountRoleSettings.AllowBulkSending = permissionProfileModel.AccountRoleSettingsModel.AllowBulkSending.ToString(); accountRoleSettings.AllowEnvelopeSending = permissionProfileModel.AccountRoleSettingsModel.AllowEnvelopeSending.ToString(); accountRoleSettings.AllowSignerAttachments = permissionProfileModel.AccountRoleSettingsModel.AllowSignerAttachments.ToString(); accountRoleSettings.AllowApiAccess = permissionProfileModel.AccountRoleSettingsModel.AllowApiAccess.ToString(); accountRoleSettings.AllowApiAccessToAccount = permissionProfileModel.AccountRoleSettingsModel.AllowApiAccessToAccount.ToString(); accountRoleSettings.AllowApiSequentialSigning = permissionProfileModel.AccountRoleSettingsModel.AllowApiSequentialSigning.ToString(); accountRoleSettings.EnableApiRequestLogging = permissionProfileModel.AccountRoleSettingsModel.EnableApiRequestLogging.ToString(); accountRoleSettings.AllowApiSendingOnBehalfOfOthers = permissionProfileModel.AccountRoleSettingsModel.AllowApiSendingOnBehalfOfOthers.ToString(); accountRoleSettings.AllowWetSigningOverride = permissionProfileModel.AccountRoleSettingsModel.AllowWetSigningOverride.ToString(); accountRoleSettings.EnableRecipientViewingNotifications = permissionProfileModel.AccountRoleSettingsModel.EnableRecipientViewingNotifications.ToString(); accountRoleSettings.ReceiveCompletedSelfSignedDocumentsAsEmailLinks = permissionProfileModel.AccountRoleSettingsModel.ReceiveCompletedSelfSignedDocumentsAsEmailLinks.ToString(); accountRoleSettings.UseNewSendingInterface = permissionProfileModel.AccountRoleSettingsModel.UseNewSendingInterface.ToString(); accountRoleSettings.AllowDocuSignDesktopClient = permissionProfileModel.AccountRoleSettingsModel.AllowDocuSignDesktopClient.ToString(); accountRoleSettings.AllowSendersToSetRecipientEmailLanguage = permissionProfileModel.AccountRoleSettingsModel.AllowSendersToSetRecipientEmailLanguage.ToString(); accountRoleSettings.AllowVaulting = permissionProfileModel.AccountRoleSettingsModel.AllowVaulting.ToString(); accountRoleSettings.AllowedToBeEnvelopeTransferRecipient = permissionProfileModel.AccountRoleSettingsModel.AllowedToBeEnvelopeTransferRecipient.ToString(); accountRoleSettings.EnableTransactionPointIntegration = permissionProfileModel.AccountRoleSettingsModel.EnableTransactionPointIntegration.ToString(); try { // Step 3. Call the eSignature REST API var result = global::eSignature.Examples.CreatePermissionProfile.Create(permissionProfileModel.ProfileName, accountRoleSettings, accessToken, basePath, accountId); ViewBag.h1 = "The permission profile was updated"; ViewBag.message = $"The permission profile was created!<br />Permission profile ID: {result.PermissionProfileId}, name:{result.PermissionProfileName}."; return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
protected override void InitializeInternal() => ProfileModel = new PermissionProfileModel();