/// <summary> /// Creates a permission profile /// </summary> /// <param name="profileName">Profile name</param> /// <param name="accountRoleSettings">Sccount role settings</param> /// <param name="accessToken">Access Token for API call (OAuth)</param> /// <param name="basePath">BasePath for API calls (URI)</param> /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param> /// <returns>A permission profile</returns> public static PermissionProfile Create(string profileName, AccountRoleSettingsExtension accountRoleSettings, string accessToken, string basePath, string accountId) { // Construct your API headers var config = new Configuration(new ApiClient(basePath)); config.AddDefaultHeader("Authorization", "Bearer " + accessToken); AccountsApi accountsApi = new AccountsApi(config); var newPermissionProfile = new PermissionProfile(PermissionProfileName: profileName, Settings: accountRoleSettings); // Call the eSignature REST API return(accountsApi.CreatePermissionProfile(accountId, newPermissionProfile)); }
public DataObject GetWithPermissions(ObjectIdentity objectIdentity) { PermissionProfile permissionProfile = new PermissionProfile(); permissionProfile.PermissionTypeFilter = PermissionTypeFilter.ANY; OperationOptions operationOptions = new OperationOptions(); operationOptions.PermissionProfile = permissionProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List <ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objectIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return(dataPackage.DataObjects[0]); }
public DataObject GetWithPermissions(ObjectIdentity objectIdentity) { PermissionProfile permissionProfile = new PermissionProfile(); permissionProfile.PermissionTypeFilter = PermissionTypeFilter.ANY; OperationOptions operationOptions = new OperationOptions(); operationOptions.PermissionProfile = permissionProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List<ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objectIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return dataPackage.DataObjects[0]; }
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 API headers var config = new Configuration(new ApiClient(basePath)); config.AddDefaultHeader("Authorization", "Bearer " + accessToken); AccountsApi accountsApi = new AccountsApi(config); // Step 3. Construct your request var accountRoleSettings = new 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(); var newPermimssionProfile = new PermissionProfile(PermissionProfileName: permissionProfileModel.ProfileName, Settings: accountRoleSettings); try { // Step 4. Call the eSignature REST API var result = accountsApi.CreatePermissionProfile(accountId, newPermimssionProfile); 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")); } }