|
@@ -25,6 +25,12 @@ class User extends AbstractModel
|
|
|
protected $conflictingRedirect = null;
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * @var ModelCollection|AbstractRedirect[]
|
|
|
+ */
|
|
|
+ protected $redirects = null;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @inheritdoc
|
|
|
*/
|
|
@@ -247,6 +253,40 @@ class User extends AbstractModel
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * @return ModelCollection|AbstractRedirect[]
|
|
|
+ */
|
|
|
+ public function getRedirects()
|
|
|
+ {
|
|
|
+ if(is_null($this->redirects)){
|
|
|
+ $this->redirects = AbstractRedirect::findMultiWhere(
|
|
|
+ array(DBC_ALIASES_DESTINATION, 'LIKE', '%'.$this->getEmail().'%')
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->redirects;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return ModelCollection|AbstractRedirect[]
|
|
|
+ */
|
|
|
+ public function getAnonymizedRedirects()
|
|
|
+ {
|
|
|
+ $redirects = $this->getRedirects();
|
|
|
+
|
|
|
+ foreach($redirects as $redirect){
|
|
|
+ $emails = $redirect->getDestination();
|
|
|
+
|
|
|
+ if(is_array($emails) && count($emails) > 1){
|
|
|
+ $redirect->setDestination(array($this->getEmail(), '…'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $redirects;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* Change this users password, throws Exception if password is invalid.
|
|
|
*
|