matches method
Check if this permission matches a resource
Implementation
bool matches(Permission type, String? resource) {
if (permission != type && permission != Permission.fullAccess) {
return false;
}
if (pattern == null || resource == null) {
return true;
}
// Support wildcard patterns
if (pattern!.endsWith('.*')) {
final prefix = pattern!.substring(0, pattern!.length - 2);
return resource.startsWith(prefix);
}
return pattern == resource;
}