<commit_before>package se.su.it.signuptool

import ladok.lpw.service.changeaddress.facadeclient.ChangeAddressVO
import se.su.it.sucard.client.CardOrderVO
import se.su.it.sucard.client.AddressVO

class SignupService {

  def WsMethodService

  static transactional = false

  Map enableAccount(ShibAttributes attrs) throws Exception {
    def vo = null
    vo = WsMethodService?.findEnrolledUserByNIN(attrs.nin)
    if (!vo && attrs.domain =~ /student.su.se/) {
      vo = WsMethodService?.enrollUser(attrs.domain, attrs.givenName, attrs.sn, attrs.nin)
    }

    if (!vo?.uid && !vo?.password) {
      throw new Exception("Aktiveringen av ditt konto misslyckades.")
    }

    WsMethodService?.enableBasicServices(vo.uid)
    def mail =  WsMethodService?.getMail(vo.uid)

    [vo: vo, mail: mail]
  }

  def setSukatMail(String uid, String mail) {
    return WsMethodService?.setMail(uid, mail)
  }

  def placeCardOrder(String uid, String firstName, String lastName, ChangeAddressVO defaultAddress, UserSuppliedData usd) {
    AddressVO avo = null
    if(usd.shouldDeliverDefaultAddress() && defaultAddress != null && defaultAddress.permanentAddr != null) {
      avo = new AddressVO()
      avo.streetadress1 = defaultAddress.permanentAddr.coadr.length() > 0 ? defaultAddress.permanentAddr.coadr : defaultAddress.permanentAddr.gatadr
      avo.streetaddress2 = defaultAddress.permanentAddr.coadr.length() > 0 ? defaultAddress.permanentAddr.gatadr : ""
      avo.zipcode = defaultAddress.permanentAddr.postnr
      avo.locality = defaultAddress.permanentAddr.ort
    }
    else if(usd.shouldDeliverOtherAddress()) {
      avo = new AddressVO()
      avo.streetadress1 = usd.coadr.length() > 0 ? usd.coadr : usd.gatadr
      avo.streetaddress2 = usd.coadr.length() > 0 ? usd.gatadr : ""
      avo.zipcode = usd.postnr
      avo.locality = usd.ort
    }
    else if(usd.shouldDeliverHelpdesk()) {

    }
    else {
      return false
    }
    CardOrderVO covo = new CardOrderVO()
    covo.address = avo
    covo.firstname = firstName
    covo.lastname = lastName
    covo.owner = uid
    return WsMethodService?.orderCard(covo)
  }
}
<commit_msg>Update enableUser for changes in enrollUser.<commit_after>package se.su.it.signuptool

import ladok.lpw.service.changeaddress.facadeclient.ChangeAddressVO
import se.su.it.sucard.client.CardOrderVO
import se.su.it.sucard.client.AddressVO

class SignupService {

  def WsMethodService

  static transactional = false

  Map enableAccount(ShibAttributes attrs) throws Exception {
    def vo = WsMethodService.enrollUser(attrs.domain, attrs.givenName, attrs.sn, attrs.nin)
    def mail =  WsMethodService.getMail(vo.uid)
    [vo: vo, mail: mail]
  }

  def setSukatMail(String uid, String mail) {
    return WsMethodService?.setMail(uid, mail)
  }

  def placeCardOrder(String uid, String firstName, String lastName, ChangeAddressVO defaultAddress, UserSuppliedData usd) {
    AddressVO avo = null
    if(usd.shouldDeliverDefaultAddress() && defaultAddress != null && defaultAddress.permanentAddr != null) {
      avo = new AddressVO()
      avo.streetadress1 = defaultAddress.permanentAddr.coadr.length() > 0 ? defaultAddress.permanentAddr.coadr : defaultAddress.permanentAddr.gatadr
      avo.streetaddress2 = defaultAddress.permanentAddr.coadr.length() > 0 ? defaultAddress.permanentAddr.gatadr : ""
      avo.zipcode = defaultAddress.permanentAddr.postnr
      avo.locality = defaultAddress.permanentAddr.ort
    }
    else if(usd.shouldDeliverOtherAddress()) {
      avo = new AddressVO()
      avo.streetadress1 = usd.coadr.length() > 0 ? usd.coadr : usd.gatadr
      avo.streetaddress2 = usd.coadr.length() > 0 ? usd.gatadr : ""
      avo.zipcode = usd.postnr
      avo.locality = usd.ort
    }
    else if(usd.shouldDeliverHelpdesk()) {

    }
    else {
      return false
    }
    CardOrderVO covo = new CardOrderVO()
    covo.address = avo
    covo.firstname = firstName
    covo.lastname = lastName
    covo.owner = uid
    return WsMethodService?.orderCard(covo)
  }
}

{'fraction_non_alphanumeric': 0.10385093167701863, 'fraction_numerical': 0.003975155279503106, 'mean_word_length': 3.5337837837837838, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3225740', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1343, 'n_words': 250}