@@ -486,7 +486,7 @@ public void enableAutoBuildRoleLinks(boolean autoBuildRoleLinks) {
486486 /**
487487 * EnableAcceptJsonRequest controls whether to accept json as a request parameter
488488 *
489- * @param acceptJsonRequest
489+ * @param acceptJsonRequest a boolean that indicates whether JSON requests are accepted.
490490 */
491491 public void enableAcceptJsonRequest (boolean acceptJsonRequest ) {
492492 this .acceptJsonRequest = acceptJsonRequest ;
@@ -782,6 +782,11 @@ public EnforceResult enforceExWithMatcher(String matcher, Object... rvals) {
782782
783783 /**
784784 * addNamedMatchingFunc add MatchingFunc by ptype RoleManager
785+ *
786+ * @param ptype the type of the role manager.
787+ * @param name the name of the matching function to be added.
788+ * @param fn the matching function.
789+ * @return whether the matching function was successfully added.
785790 */
786791 public boolean addNamedMatchingFunc (String ptype , String name , BiPredicate <String , String > fn ) {
787792 if (rmMap .containsKey (ptype )) {
@@ -798,6 +803,11 @@ public boolean addNamedMatchingFunc(String ptype, String name, BiPredicate<Strin
798803
799804 /**
800805 * addNamedMatchingFunc add MatchingFunc by ptype RoleManager
806+ *
807+ * @param ptype the type of the role manager.
808+ * @param name the name of the matching function to be added.
809+ * @param fn the domain matching function.
810+ * @return whether the matching function was successfully added.
801811 */
802812 public boolean addNamedDomainMatchingFunc (String ptype , String name , BiPredicate <String , String > fn ) {
803813 if (rmMap .containsKey (ptype )) {
@@ -813,8 +823,14 @@ public boolean addNamedDomainMatchingFunc(String ptype, String name, BiPredicate
813823 }
814824
815825 /**
816- * addNamedLinkConditionFunc Add condition function fn for Link userName-> roleName,
826+ * addNamedLinkConditionFunc Add condition function fn for Link userName-> roleName,
817827 * when fn returns true, Link is valid, otherwise invalid
828+ *
829+ * @param ptype the type of the role manager.
830+ * @param user the username for which the link condition is being added.
831+ * @param role the role associated with the user for which the condition is evaluated.
832+ * @param fn a function that takes an array of parameters (e.g., [user, role]) and returns a Boolean indicating the validity of the link.
833+ * @return whether the Link is valid.
818834 */
819835 public boolean addNamedLinkConditionFunc (String ptype , String user , String role , Function <String [], Boolean > fn ){
820836 if (condRmMap .containsKey (ptype )){
@@ -826,8 +842,15 @@ public boolean addNamedLinkConditionFunc(String ptype, String user, String role,
826842 }
827843
828844 /**
829- * addNamedDomainLinkConditionFunc Add condition function fn for Link userName-> {roleName, domain},
845+ * addNamedDomainLinkConditionFunc Add condition function fn for Link userName-> {roleName, domain},
830846 * when fn returns true, Link is valid, otherwise invalid
847+ *
848+ * @param ptype the type of the conditional role manager.
849+ * @param user the username for which the link condition is being added.
850+ * @param role the role associated with the user for which the condition is evaluated.
851+ * @param domain the domain associated with the role.
852+ * @param fn a function that takes an array of parameters (e.g., [user, role, domain]) and returns a Boolean indicating the validity of the link.
853+ * @return whether the Link is valid.
831854 */
832855 public boolean addNamedDomainLinkConditionFunc (String ptype , String user , String role , String domain , Function <String [], Boolean > fn ) {
833856 if (condRmMap .containsKey (ptype )){
@@ -839,7 +862,13 @@ public boolean addNamedDomainLinkConditionFunc(String ptype, String user, String
839862 }
840863
841864 /**
842- * setNamedLinkConditionFuncParams Sets the parameters of the condition function fn for Link userName->roleName
865+ * setNamedLinkConditionFuncParams Sets the parameters of the condition function fn for Link userName->roleName
866+ *
867+ * @param ptype the type of the conditional role manager.
868+ * @param user the username for which the link condition parameters are being set.
869+ * @param role the role associated with the user for which the parameters are being configured.
870+ * @param params an array of parameters to be passed to the condition function.
871+ * @return whether the Link is valid.
843872 */
844873 public boolean setNamedLinkConditionFuncParams (String ptype , String user , String role , String ... params ){
845874 if (condRmMap .containsKey (ptype )){
@@ -852,7 +881,14 @@ public boolean setNamedLinkConditionFuncParams(String ptype, String user, String
852881
853882 /**
854883 * setNamedDomainLinkConditionFuncParams Sets the parameters of the condition function fn
855- * for Link userName->{roleName, domain}
884+ * for Link userName->{roleName, domain}
885+ *
886+ * @param ptype the type of the conditional role manager.
887+ * @param user the username for which the link condition parameters are being set.
888+ * @param role the role associated with the user for which the parameters are being configured.
889+ * @param domain the domain associated with the role and user.
890+ * @param params an array of parameters to be passed to the condition function, allowing customization of the condition logic.
891+ * @return whether the parameters were successfully set.
856892 */
857893 public boolean setNamedDomainLinkConditionFuncParams (String ptype , String user , String role , String domain , String ... params ){
858894 if (condRmMap .containsKey (ptype )){
@@ -863,6 +899,14 @@ public boolean setNamedDomainLinkConditionFuncParams(String ptype, String user,
863899 return false ;
864900 }
865901
902+ /***
903+ * getRTokens Retrieves request tokens and populates them into the provided parameters map.
904+ *
905+ * @param parameters a map to store the request tokens and their corresponding values.
906+ * @param rType the type of the request for which tokens are being retrieved, used to access the appropriate model.
907+ * @param rvals the request needs to be mediated, usually an array
908+ * of strings, can be class instances if ABAC is used.
909+ */
866910 private void getRTokens (Map <String , Object > parameters , String rType , Object ... rvals ) {
867911 String [] requestTokens = model .model .get ("r" ).get (rType ).tokens ;
868912 if (requestTokens .length != rvals .length ) {
@@ -874,6 +918,14 @@ private void getRTokens(Map<String, Object> parameters, String rType, Object...
874918 }
875919 }
876920
921+ /***
922+ * getPTokens Retrieves policy tokens and populates them into the provided parameters map.
923+ *
924+ * @param parameters a map to store the policy tokens and their corresponding values.
925+ * @param pType the type of the policy for which tokens are being retrieved, used for context.
926+ * @param pvals a list of values corresponding to the policy tokens.
927+ * @param pTokens an array of tokens associated with the policy.
928+ */
877929 private void getPTokens (Map <String , Object > parameters , String pType , List <String > pvals , String [] pTokens ) {
878930 if (pTokens .length != pvals .size ()) {
879931 throw new CasbinMatcherException ("invalid policy size: expected " + pTokens .length +
0 commit comments