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:30 UTC

[whimsy] branch mod-gui updated (5b0cc09 -> 3c1458c)

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

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


    from 5b0cc09  Merge branch 'master' into mod-gui
     new b389c34  TODO
     new ea90573  Karma for mailbox
     new 1b9b5ec  Add karma check
     new 3c1458c  Drop text code

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 www/moderation/desk/config.ru         |  2 +-
 www/moderation/desk/models/auth.rb    | 34 ++++++++++++++++++++++++++++++++++
 www/moderation/desk/models/mailbox.rb | 13 +++++++++++--
 3 files changed, 46 insertions(+), 3 deletions(-)
 create mode 100644 www/moderation/desk/models/auth.rb


[whimsy] 02/04: Karma for mailbox

Posted by se...@apache.org.
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


[whimsy] 03/04: Add karma check

Posted by se...@apache.org.
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 1b9b5ec02980e7199574c660a1cb89e6c8a7e5fe
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jan 9 23:36:12 2019 +0000

    Add karma check
---
 www/moderation/desk/models/mailbox.rb | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/www/moderation/desk/models/mailbox.rb b/www/moderation/desk/models/mailbox.rb
index a1a3c35..1dc18a9 100644
--- a/www/moderation/desk/models/mailbox.rb
+++ b/www/moderation/desk/models/mailbox.rb
@@ -13,6 +13,7 @@ require 'yaml'
 require_relative '../config.rb'
 
 require_relative 'message.rb'
+require_relative 'auth.rb'
 
 class Mailbox
 
@@ -181,7 +182,16 @@ class Mailbox
   # Is the message visible to the caller?
   # e.g. private and security lists are generally not visible to all
   def self.message_visible?(message)
-    message[:public] # || ASF member || PMC member
+    message[:public] and return true # shortcut because auth may be expensive
+    info = Auth.info({})
+    visible = info[:member]
+    visible ||= (message[:domain]||'').match(%r{^(.+)\.apache\.org$}) do |m|
+      group,_ = m.captures
+      # (P)PMC member?
+      groups = info[:project_owners] || [] 
+      groups.include? group
+    end
+    visible
   end
 
   def message_active?(status)


[whimsy] 04/04: Drop text code

Posted by se...@apache.org.
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 3c1458cb4763c2e3ea5e764de9bdfab6a4d4c29f
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jan 9 23:47:17 2019 +0000

    Drop text code
---
 www/moderation/desk/models/mailbox.rb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/www/moderation/desk/models/mailbox.rb b/www/moderation/desk/models/mailbox.rb
index 1dc18a9..2dc4603 100644
--- a/www/moderation/desk/models/mailbox.rb
+++ b/www/moderation/desk/models/mailbox.rb
@@ -30,7 +30,6 @@ class Mailbox
       @name = name.split('.').first
       @mbox = "#{ARCHIVE}/#{name}"
     end
-    @@test ||= object_id
   end
 
   # centralise the name generation


[whimsy] 01/04: TODO

Posted by se...@apache.org.
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 b389c34e10a314737dc92eb6b8e8d403024adf0c
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jan 9 23:34:27 2019 +0000

    TODO
---
 www/moderation/desk/config.ru | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/moderation/desk/config.ru b/www/moderation/desk/config.ru
index c3157de..9ba1d82 100644
--- a/www/moderation/desk/config.ru
+++ b/www/moderation/desk/config.ru
@@ -3,7 +3,7 @@ require File.expand_path('../server.rb', __FILE__)
 require 'whimsy/asf/rack'
 
 use ASF::HTTPS_workarounds
-use ASF::Auth::MembersAndOfficers
+use ASF::Auth::MembersAndOfficers # change this to Committers later
 use ASF::AutoGC
 
 use ASF::DocumentRoot