hasRoleForUser method

bool hasRoleForUser(
  1. String name,
  2. String role
)

hasRoleForUser determines whether a user has a role.

name the user. role the role. return whether the user has the role.

Implementation

bool hasRoleForUser(String name, String role) {
  var roles = getRolesForUser(name);

  return roles.any((element) => element == role);
}