public void CombinatorialTest_PDF_Practicable( [Values(Signing.SigningEnabled, Signing.SigningDisabled)] Signing signing, [Values(Background.BackgroundEnabled, Background.BackgroundDisabled)] Background background, [Values(Encryption.EncryptionEnabled, Encryption.EncryptionDisabled)] Encryption encryption, [Values(EncryptionLevel.Rc40Bit, EncryptionLevel.Aes128Bit, EncryptionLevel.Aes128Bit, EncryptionLevel.Aes256Bit)] EncryptionLevel encryptionLevel, [Values(BasicPermissions.AllowBasicPermissions, BasicPermissions.DenyBasicPermissions)] BasicPermissions basicPermissions, [Values(ExtendedPermissions.AllowExtededPermissions, ExtendedPermissions.DenyExtededPermissions)] ExtendedPermissions extendedPermissions ) { _th.Profile.PdfSettings.Signature.Enabled = signing == Signing.SigningEnabled; _th.Profile.BackgroundPage.Enabled = background == Background.BackgroundEnabled; _th.Profile.PdfSettings.Security.Enabled = encryption == Encryption.EncryptionEnabled; _th.Profile.PdfSettings.Security.EncryptionLevel = encryptionLevel; _th.Profile.PdfSettings.Security.AllowToCopyContent = basicPermissions == BasicPermissions.AllowBasicPermissions; _th.Profile.PdfSettings.Security.AllowToEditTheDocument = basicPermissions == BasicPermissions.AllowBasicPermissions; _th.Profile.PdfSettings.Security.AllowPrinting = basicPermissions == BasicPermissions.AllowBasicPermissions; _th.Profile.PdfSettings.Security.AllowToEditComments = basicPermissions == BasicPermissions.AllowBasicPermissions; _th.Profile.PdfSettings.Security.RestrictPrintingToLowQuality = extendedPermissions == ExtendedPermissions.AllowExtededPermissions; _th.Profile.PdfSettings.Security.AllowToFillForms = extendedPermissions == ExtendedPermissions.AllowExtededPermissions; _th.Profile.PdfSettings.Security.AllowScreenReader = extendedPermissions == ExtendedPermissions.AllowExtededPermissions; _th.Profile.PdfSettings.Security.AllowToEditAssembly = extendedPermissions == ExtendedPermissions.AllowExtededPermissions; _th.GenerateGsJob(PSfiles.ThreePDFCreatorTestpages, OutputFormat.Pdf); _th.Job.Passwords.PdfSignaturePassword = TestCertPw; _th.RunGsJob(); DoAllTests(); }
/// <summary> /// Like một post or một page hoặc một đối tượng nào đó có thể like được /// </summary> /// <param name="objectId">Là id của đối tượng. VD: nếu muốn like 1 post thì objectId chính là postId của post đó</param> /// <returns>Nếu like thành công thì trả về true. Ngược lại trả về false.</returns> public async Task <LikeCompletedArgs> LikeAsync(string objectId) { if (!ExtendedPermissions.Contains(Constants.PublishActionsPermission)) { throw new KeyNotFoundException("Bạn phải yêu cầu quyền \"publish_action\" để có thể thực hiện chức năng này."); } if (!IsLogged) { await LoginAsync(); } //Kiểm tra lần nữa nếu vẫn chưa login thành công thì trả về bên ngoài là like không thành công if (!IsLogged) { return(new LikeCompletedArgs(false, "Người dùng chưa login. Bạn cần login trước khi có thể like!")); } bool isSuccess = false; var graphApi = String.Format("/v2.2/{0}/{1}", objectId, FacebookCommand.Like); try { var likeObjectResult = await facebookClient.PostTaskAsync(graphApi, new { access_token = "CAACEdEose0cBAPOQjRpbqOGH3Nml22buiTAg1ZCEjSibZAzpAFj6ZCc6fNlwzlevqSHtcEbq97iTgN4cEA2JFhcT6eKL7iFU0ZBfyGkCKrGLwPJZByZBWLQJqD3UrNYhTa0zEEHeBWUTPPcu9G2K6FY6JnbNDKvf3HNQNDHfto6PgDtPbaKdKsbTM2IPSMDgcef67JNeUYG7CZBgnZCwDCw3K9XLNDIsuHEZD" }); string likeObjectResultData = likeObjectResult.ToString(); if (!String.IsNullOrEmpty(likeObjectResultData)) { if (likeObjectResultData.Contains("true")) { isSuccess = true; } } return(new LikeCompletedArgs(isSuccess, likeObjectResultData)); } catch (Exception ex) { string message = string.Format("Like error! Message: {0}", ex.Message); Debug.WriteLine(message); return(new LikeCompletedArgs(false, ex.Message)); } }
/// <summary> /// Ensures that the permissions within <paramref name="toRemove"/> are not included in the set of permissions. /// </summary> /// <param name="sourcePermissions">The permissions from which to clear the desired permissions.</param> /// <param name="toRemove">The permissions to remove.</param> /// <remarks> /// </remarks> /// <returns>A new <see cref="ExtendedPermissions"/> which removes the desired permissions from the source.</returns> public static ExtendedPermissions Clear(this ExtendedPermissions sourcePermissions, ExtendedPermissions toRemove) { ExtendedPermissions flags = (ExtendedPermissions)(-1); flags ^= toRemove; return (sourcePermissions & flags); }
/// <summary> /// Ensures that <paramref name="toAdd"/> permissions are included within the <paramref name="sourcePermissions"/> permissions set, and returns the result. /// </summary> /// <param name="sourcePermissions">The permissions to which to set the additional permissions.</param> /// <param name="toAdd">The additional permissions to add.</param> /// <remarks> /// <para>The contents of <paramref name="sourcePermissions"/> are not changed. However, you could fluently add permissions by chaining these calls together:</para> /// <code lang="csharp"> /// ExtendedPermissions result = ExtendedPermissions.Friend.Set(ExtendedPermissions.OfflineAccess).Set(ExtendedPermissions.ReadMailbox); /// </code> /// </remarks> /// <returns>A new <see cref="ExtendedPermissions"/> which combine the source and additional permissions.</returns> public static ExtendedPermissions Set(this ExtendedPermissions sourcePermissions, ExtendedPermissions toAdd) { return sourcePermissions | toAdd; }
/// <summary> /// Checks to see whether one or more permissions are set for a given permissions entry. /// </summary> /// <param name="permissions">The permissions to check.</param> /// <param name="toCheck">The permissions to see if they are set.</param> /// <returns><see langword="true"/> if the permissions are set within the <paramref name="permissions"/> parameter; otherwise <see langword="false" />.</returns> public static bool IsSet(this ExtendedPermissions permissions, ExtendedPermissions toCheck) { return ((permissions & toCheck) == toCheck); }
public static string DetermineUriForRequest(string appID, string redirectUrl, bool isRedirectUrlEncoded = false, ExtendedPermissions permissions = ExtendedPermissions.None, AuthorizationPromptStyle promptType = AuthorizationPromptStyle.Popup) { if (!isRedirectUrlEncoded) redirectUrl = redirectUrl.UrlEncode(); string url = string.Format(CultureInfo.CurrentUICulture, URL_ACCESS_TOKEN_REQUEST_FMT, appID, redirectUrl, permissions.Print(), promptType.Print()); return url; }
/// <summary> /// /// </summary> /// <param name="applicationName"></param> /// <param name="userID"></param> /// <param name="permissions"></param> protected virtual void OnPermissionsUpdated(string applicationName, string userID, ExtendedPermissions permissions) { }