code: function (realm, role, attributes) {
                  var realmRoles = currentRoles[realm];
                  if (typeof realmRoles === 'undefined') {
                      return false;
                  }
  
                  var roleDefinition = realmRoles[role];
                  if (typeof roleDefinition === 'undefined') {
                      return false;
                  }
  
                  if (!checkWithRoleFilter(roleDefinition.$unifiedRole)) {
                      return false;
                  }
  
                  if (!checkWithAttributeFilter(roleDefinition.$attributes)) {
                      return false;
                  }
  
                  if (typeof attributes !== 'undefined') {
                      return _.every(attributes, function (value, attribute) {
                          return includes(roleDefinition.$attributes[attribute], value);
                      });
                  } else {
                      return true;
                  }
              }
docs: @ngdoc function
  @name w20CoreSecurity.service:AuthorizationService#hasRole
  @methodOf w20CoreSecurity.service:AuthorizationService
  @param {String} realm The realm the check is made against.
  @param {String} role The role to check.
  @param {Object} attributes The optional attributes object to further check on the role.
  @returns {Boolean} True if the subject has the role, false otherwise.
  
  @description
  
  Check if the currently authenticated subject has the specified role with the specified attributes in the
  specified realm.