assignAbilityToActions static method
Implementation
static Map<String, dynamic> assignAbilityToActions(
String ability,
List<String> actions, {
Map limits = const {},
}) {
final sortedActions = List<String>.from(actions)
..sort((a, b) => a.compareTo(b));
Map<String, dynamic> abilities = {};
for (var method in sortedActions) {
abilities['$ability/$method'] = [
...(abilities['$ability/$method'] ?? []),
limits,
];
}
return Map<String, dynamic>.fromEntries(abilities.entries);
}