pub fn validate_entry_point_access_with(
    contract_package: &ContractPackage,
    access: &EntryPointAccess,
    validator: impl Fn(&URef) -> bool,
) -> Result<(), Error> {
    if let EntryPointAccess::Groups(groups) = access {
        if groups.is_empty() {
            // Exits early in a special case of empty list of groups regardless of the group
            // checking logic below it.
            return Err(Error::InvalidContext);
        }

        let find_result = groups.iter().find(|g| {
            contract_package
                .groups()
                .get(g)
                .and_then(|set| set.iter().find(|u| validator(u)))
                .is_some()
        });

        if find_result.is_none() {
            return Err(Error::InvalidContext);
        }
    }
    Ok(())
}
/// Validates an entry point access with a special validator callback.
///
/// If the passed `access` object is a `Groups` variant, then this function will return a
/// [`Error::InvalidContext`] if there are no groups specified, as such entry point is uncallable.
/// For each [`URef`] in every group that this `access` object refers to, a validator callback is
/// called. If a validator function returns `false` for any of the `URef` in the set, an
/// [`Error::InvalidContext`] is returned.
///
/// Otherwise, if `access` object is a `Public` variant, then the entry point is considered callable
/// and an unit value is returned.
Validates an entry point access with a special validator callback.

Otherwise, if `access` object is a `Public` variant, then the entry point is considered callable
and an unit value is returned.
Validates an entry point access with a special validator callback . Otherwise if ` access ` object is a ` Public ` variant then the entry point is considered callable and an unit value is returned .
pub fn validate_entry_point_access_with(
    contract_package: &ContractPackage,
    access: &EntryPointAccess,
    validator: impl Fn(&URef) -> bool,
) -> Result<(), Error> {
    if let EntryPointAccess::Groups(groups) = access {
        if groups.is_empty() {
            // Exits early in a special case of empty list of groups regardless of the group
            // checking logic below it.
            return Err(Error::InvalidContext);
        }
        let find_result = groups.iter().find(|g| {
            contract_package
                .groups()
                .get(g)
                .and_then(|set| set.iter().find(|u| validator(u)))
                .is_some()
        });
        if find_result.is_none() {
            return Err(Error::InvalidContext);
        }
    }
    Ok(())
}
pub fn validate_entry_point_access_with ( contract_package : & ContractPackage , access : & EntryPointAccess , validator : impl Fn ( & URef ) -> bool , ) -> Result < ( ) , Error > { if let EntryPointAccess :: Groups ( groups ) = access { if groups . is_empty ( ) { // Exits early in a special case of empty list of groups regardless of the group // checking logic below it. return Err ( Error :: InvalidContext ) ; } let find_result = groups . iter ( ) . find ( | g | { contract_package . groups ( ) . get ( g ) . and_then ( | set | set . iter ( ) . find ( | u | validator ( u ) ) ) . is_some ( ) } ) ; if find_result . is_none ( ) { return Err ( Error :: InvalidContext ) ; } } Ok ( ( ) ) }
Validates an entry point access with a special validator callback.
Validates an entry point access with a special validator callback .
contract_package
&ContractPackage
access
&EntryPointAccess
validator
impl Fn(&URef) -> bool
contract_package
&ContractPackage
access
&EntryPointAccess
validator
impl Fn(&URef) -> bool