code: function (realm, subject) {
                  if (sealed) {
                      throw new Error('AuthorizationService is sealed, cannot add further subject authorizations');
                  }
  
                  var realmPermissions = currentPermissions[realm],
                      realmRoles = currentRoles[realm];
  
                  if (typeof realmPermissions === 'undefined') {
                      realmPermissions = currentPermissions[realm] = {};
                  }
  
                  if (typeof realmRoles === 'undefined') {
                      realmRoles = currentRoles[realm] = {};
                  }
  
                  // Parse roles
                  _.each(subject.roles, function (roleDefinition) {
                      if (typeof roleDefinition.name === 'undefined') {
                          throw new Error('A role definition must have a name attribute, got undefined');
                      }
  
                      // Merge roles permissions to realm permissions
                      mergePermissions(realmPermissions, roleDefinition.permissions, roleDefinition.attributes, roleDefinition.name);
  
                      if (typeof realmRoles[roleDefinition.name] === 'undefined') {
                          realmRoles[roleDefinition.name] = {
                              $attributes: {}
                          };
                      }
  
                      mergeAttributes(realmRoles[roleDefinition.name].$attributes, roleDefinition.attributes);
                  });
  
                  // Merge subject permissions to realm permissions
                  mergePermissions(realmPermissions, subject.permissions);
              }
docs: @ngdoc function
  @name w20CoreSecurity.service:AuthorizationService#addSubjectAuthorizations
  @methodOf w20CoreSecurity.service:AuthorizationService
  @param {String} realm The realm to add permission into
  @param {String} subject The subject
  
  @description
  
  Merge subject permissions to realm permissions