TF-1857 Add func check capability supported
(cherry picked from commit 5cbd3bd626e65589a071bef1dfe11d82b344bbad)
This commit is contained in:
@@ -26,12 +26,25 @@ void requireCapability(Session session, AccountId accountId, List<CapabilityIden
|
||||
}
|
||||
}
|
||||
|
||||
extension CapabilityIdentifierExtension on List<CapabilityIdentifier> {
|
||||
extension ListCapabilityIdentifierExtension on List<CapabilityIdentifier> {
|
||||
|
||||
bool isSupported(Session session, AccountId accountId) {
|
||||
try {
|
||||
requireCapability(session, accountId, this);
|
||||
return true;
|
||||
} catch (error) {
|
||||
logError('ListCapabilityIdentifierExtension::isSupported(): $error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension CapabilityIdentifierExtension on CapabilityIdentifier {
|
||||
|
||||
bool isSupported(Session session, AccountId accountId) {
|
||||
try {
|
||||
requireCapability(session, accountId, [this]);
|
||||
return true;
|
||||
} catch (error) {
|
||||
logError('CapabilityIdentifierExtension::isSupported(): $error');
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user