You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/01/09 23:47:32 UTC

[whimsy] 02/04: Karma for mailbox

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch mod-gui
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit ea9057321f0a52531685875f392903bc0175a198
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jan 9 23:34:57 2019 +0000

    Karma for mailbox
---
 www/moderation/desk/models/auth.rb | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/www/moderation/desk/models/auth.rb b/www/moderation/desk/models/auth.rb
new file mode 100644
index 0000000..818ee8f
--- /dev/null
+++ b/www/moderation/desk/models/auth.rb
@@ -0,0 +1,34 @@
+#
+# What karma? 
+# Used by mailbox
+#
+class Auth
+  def self.info(env)
+    ASF::Auth.decode(env)
+    info = {id: env.user}
+
+    person = ASF::Person.find(env.user)
+
+# not needed ?
+#    if ASF::Service.find('asf-secretary').members.include? person
+#      info[:secretary] = true
+#    end
+#
+#    if ASF::Service.find('apldap').members.include? person
+#      info[:root] = true
+#    end
+
+    if person.asf_member?
+      info[:member] = true
+    end
+
+#    if ASF.pmc_chairs.include? person
+#      info[:pmc_chair] = true
+#    end
+
+#    info[:services] = person.services
+
+    info[:project_owners] = person.project_owners.map(&:name)
+    info
+  end
+end