summaryrefslogtreecommitdiff
path: root/app/models/identity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/identity.rb')
-rw-r--r--app/models/identity.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb
index e7b5785..e09d7f2 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -95,6 +95,18 @@ class Identity < CouchRest::Model::Base
}
end
+ def status
+ return :blocked if disabled?
+ case destination
+ when address
+ :main_email
+ when /@#{APP_CONFIG[:domain]}\Z/i,
+ :alias
+ else
+ :forward
+ end
+ end
+
def enabled?
self.user_id
end
@@ -103,6 +115,14 @@ class Identity < CouchRest::Model::Base
!enabled?
end
+ def actions
+ if enabled?
+ [] # [:show, :edit]
+ else
+ [:destroy]
+ end
+ end
+
def disable
self.destination = nil
self.user_id = nil