Ejemplo n.º 1
0
 /** @inheritdoc */
 public static function boot()
 {
     parent::boot();
     //  Ensure user is active upon creation
     static::creating(function (ServiceUser $model) {
         $model->active_ind = true;
     });
     static::created(function (ServiceUser $model) {
         AppKey::createKeyForEntity($model, OwnerTypes::SERVICE_USER);
     });
 }
Ejemplo n.º 2
0
 /**
  * Generate a client id and secret
  */
 protected static function boot()
 {
     parent::boot();
     //  Fired before creating or updating...
     static::saving(function ($row) {
         static::enforceBusinessLogic($row);
         if (empty($row->server_secret)) {
             $row->server_secret = config('dfe.security.console-api-key', 'this-value-is-not-set');
         }
     });
     static::creating(function ($row) {
         if (empty($row->key_class_text)) {
             $row->key_class_text = AppKeyClasses::OTHER;
         }
         if (empty($row->client_id) || empty($row->client_secret)) {
             $_algorithm = config('dfe.signature-method', EnterpriseDefaults::DEFAULT_SIGNATURE_METHOD);
             $row->client_id = hash_hmac($_algorithm, str_random(40), $row->server_secret);
             $row->client_secret = hash_hmac($_algorithm, str_random(40), $row->server_secret . $row->client_id);
         }
     });
 }
Ejemplo n.º 3
0
 /**
  * Boot method to wire in our events
  */
 public static function boot()
 {
     parent::boot();
     static::buildMetadataTemplate();
     static::creating(function (Instance $instance) {
         $instance->instance_name_text = $instance->sanitizeName($instance->instance_name_text);
         $instance->checkStorageKey();
     });
     static::created(function (Instance $instance) {
         $instance->refreshMetadata();
     });
     static::updating(function (Instance $instance) {
         $instance->refreshMetadata();
     });
     static::deleted(function (Instance $instance) {
         AppKey::byOwner($instance->id, OwnerTypes::INSTANCE)->delete();
     });
 }
Ejemplo n.º 4
0
 /**
  * Boot method to wire in our events
  */
 public static function boot()
 {
     parent::boot();
     static::creating(function (User $model) {
         $model->checkStorageKey();
         //  Ensure user is active upon creation
         $model->active_ind = true;
     });
     static::created(function (User $model) {
         AppKey::createKeyForEntity($model, OwnerTypes::USER);
     });
 }