code: function () {
                  if (sealed) {
                      throw new Error('AuthorizationService is already sealed');
                  }
  
                  if (config.roleMapping) {
                      _.each(config.roleMapping, function (definition, name) {
                          var mergedAttributes = {};
  
                          if (_.every(definition, function (role, realm) {
                              var realRole = currentRoles[realm] && currentRoles[realm][role];
                              if (realRole) {
                                  _.map(realRole.$attributes, function (values, attribute) {
                                      mergedAttributes[attribute] = _.union(values, mergedAttributes[attribute] || []);
                                  });
  
                                  realRole.$unifiedRole = name;
  
                                  return true;
                              } else {
                                  return false;
                              }
                          })) {
                              unifiedRoles[name] = {
                                  $attributes: mergedAttributes
                              };
                          }
                      });
                  } else if (_.keys(currentRoles).length === 1) {
                      _.each(currentRoles[_.keys(currentRoles)[0]], function (roleDefinition, roleName) {
                          unifiedRoles[roleName] = {
                              $attributes: roleDefinition.$attributes
                          };
                          roleDefinition.$unifiedRole = roleName;
                      });
                  }
  
                  if (config.persistentRestrictions) {
                      var roleRestrictions = roleRestrictionsState.value();
                      if (roleRestrictions.length > 0) {
                          try {
                              this.setRoleFilter(roleRestrictions);
                          } catch (e) {
                              $log.warn('unable to restore security role restrictions, they have been reset');
                              this.setRoleFilter([]);
                          }
                      }
  
                      var attributeRestrictions = attributeRestrictionsState.value();
                      if (_.size(attributeRestrictions) > 0) {
                          try {
                              this.setAttributeFilter(attributeRestrictions);
                          } catch (e) {
                              $log.warn('unable to restore security attribute restrictions, they have been reset');
                              this.setAttributeFilter({});
                          }
                      }
                  }
  
                  sealed = true;
              }
docs: @ngdoc function
  @name w20CoreSecurity.service:AuthorizationService#seal
  @methodOf w20CoreSecurity.service:AuthorizationService
  
  @description
  
  Seal the AuthorizationService (an object sealed cannot be modified)