<?php

final class PhabricatorMetaMTAMailingList extends PhabricatorMetaMTADAO
  implements PhabricatorPolicyInterface {

  protected $name;
  protected $email;
  protected $uri;

  public function generatePHID() {
    return PhabricatorPHID::generateNewPHID(
      PhabricatorMailingListPHIDTypeList::TYPECONST);
  }

  public function getConfiguration() {
    return array(
      self::CONFIG_AUX_PHID => true,
    ) + parent::getConfiguration();
  }


/* -(  PhabricatorPolicyInterface  )----------------------------------------- */


  public function getCapabilities() {
    return array(
      PhabricatorPolicyCapability::CAN_VIEW,
    );
  }

  public function getPolicy($capability) {
    return PhabricatorPolicies::POLICY_USER;
  }

  public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
    return false;
  }

  public function describeAutomaticCapability($capability) {
    return null;
  }

}

<?php

final class PhabricatorMetaMTAMailingList extends PhabricatorMetaMTADAO
  implements
    PhabricatorPolicyInterface,
    PhabricatorDestructableInterface {

  protected $name;
  protected $email;
  protected $uri;

  public function generatePHID() {
    return PhabricatorPHID::generateNewPHID(
      PhabricatorMailingListPHIDTypeList::TYPECONST);
  }

  public function getConfiguration() {
    return array(
      self::CONFIG_AUX_PHID => true,
    ) + parent::getConfiguration();
  }


/* -(  PhabricatorPolicyInterface  )----------------------------------------- */


  public function getCapabilities() {
    return array(
      PhabricatorPolicyCapability::CAN_VIEW,
    );
  }

  public function getPolicy($capability) {
    return PhabricatorPolicies::POLICY_USER;
  }

  public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
    return false;
  }

  public function describeAutomaticCapability($capability) {
    return null;
  }


/* -(  PhabricatorDestructableInterface  )----------------------------------- */


  public function destroyObjectPermanently(
    PhabricatorDestructionEngine $engine) {

    $this->openTransaction();
    $this->delete();
    $this->saveTransaction();
  }

}

Allow mailing lists to be permanently deleted
Allow mailing lists to be permanently deleted

Summary: Allow `PhabricatorMetaMTAMailingList` to be permanently deleted with `./bin/remove destroy`.

Test Plan:
```
./bin/remove destroy PHID-MLST-nseux3r55escj573shsf
 IMPORTANT: OBJECTS WILL BE PERMANENTLY DESTROYED!

There is no way to undo this operation or ever retrieve this data.

These 1 object(s) will be completely destroyed forever:

    - PHID-MLST-nseux3r55escj573shsf (PhabricatorMetaMTAMailingList)

    Are you absolutely certain you want to destroy these 1 object(s)? [y/N] y

Destroying objects...
Destroying PhabricatorMetaMTAMailingList PHID-MLST-nseux3r55escj573shsf...
Permanently destroyed 1 object(s).
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9979
