checkAccessLevelExists
// Some code
```remix-solidity
/**
CheckAccessLevelExists: Check if a specific access level exists for a given event.
@param _eventId: The unique identifier for the event.
@param _accessLevel: The access level to be checked for existence.
@return bool: A boolean indicating whether the access level exists for the event.
*/
function checkAccessLevelExists(
string calldata _eventId,
string calldata _accessLevel
) public view returns (bool) {
// Retrieve all access levels associated with the event
string[] memory _accessLevels = getAccessLevelsFromEventId(_eventId);
// Loop through access levels to check for the existence of the specified access level
for (uint256 i = 0; i < _accessLevels.length; ++i) {
if (
keccak256(bytes(_accessLevel)) ==
keccak256(bytes(_accessLevels[i]))
) {
return true;
}
}
return false;
}
```Explanation:
Last updated