mumukit-platform 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e249892bfa851c6d0a8bf033c1d768452b968f019d27857fc9277ae24a0b2250
4
- data.tar.gz: 7e31fe679b7dcb8e50fd5d47e874268752240755552baec0446411ebcbab7204
3
+ metadata.gz: a9debde5cab571898e9f88dd89a6f6800dfc9a1549ae00fc5d84792aa15cdc17
4
+ data.tar.gz: 6eae2161b167142e81ea81920316d3ec68e394545c0b0952fd8c5ec5606f22b1
5
5
  SHA512:
6
- metadata.gz: 5497d47595b8b810f112759f2fd732240245dc151c1702bd504e6df9c454095925b34e15cf18d7c539bacc15c731f3f8e96e37847e85cb2de66a25aa2e28005c
7
- data.tar.gz: e2eac480aeb4b9f381c110046a3eb3f9940a210dd19624c1fae2ed7eb4d8b527995c9fd505d66d770b08f3de49926abec9fd01f98a2c664c2a168986c14acb48
6
+ metadata.gz: ff19191a1dbca41064ecf36df3e0e945546ad30a179a53bd3f763552c86cb65e9ccb8819f755c7b1fff5bedc0571c7ef25bb8eb2eecb5f734c47184567e926d4
7
+ data.tar.gz: a76f6ca3e5b593d77f748e9205503d2986808eade31f2207e7e30ffdf880b027237e69d18245d1b5e2f8972fb8d2884cf1e31cbf8160f4561a6c2f2aaadb86ea
@@ -2,6 +2,7 @@ class Mumukit::Platform::Organization::Settings < Mumukit::Platform::Model
2
2
  model_attr_accessor :login_methods,
3
3
  :login_provider,
4
4
  :login_provider_settings,
5
+ :forum_discussions_minimal_role,
5
6
  :raise_hand_enabled?,
6
7
  :feedback_suggestions_enabled?,
7
8
  :public?,
@@ -17,4 +18,8 @@ class Mumukit::Platform::Organization::Settings < Mumukit::Platform::Model
17
18
  def login_methods
18
19
  @login_methods ||= ['user_pass']
19
20
  end
21
+
22
+ def forum_discussions_minimal_role
23
+ (@forum_discussions_minimal_role || 'student').to_sym
24
+ end
20
25
  end
@@ -34,21 +34,36 @@ module Mumukit::Platform::User::Helpers
34
34
  self.permissions = permissions.merge(new_permissions)
35
35
  end
36
36
 
37
- [:student, :teacher, :headmaster, :janitor].each do |role|
37
+ (Mumukit::Auth::Roles::ROLES - [:writer, :editor, :owner] + [:discusser]).each do |role|
38
38
  role_of = "#{role}_of?"
39
39
  role_here = "#{role}_here?"
40
40
 
41
+ # Tells whether this user has #{role} permissions in
42
+ # the given organization
41
43
  define_method role_of do |organization|
42
44
  has_permission? role, organization.slug
43
45
  end
44
46
 
47
+ # Tells whether this user has #{role} permissions in
48
+ # the current organization
45
49
  define_method role_here do
46
50
  send role_of, Mumukit::Platform::Organization.current
47
51
  end
48
52
  end
49
53
 
50
- def make_student_of!(slug)
51
- add_permission! :student, slug
54
+ # Tells whether this user has forum discusser permissions in
55
+ # the given organization
56
+ def discusser_of?(organization)
57
+ has_permission? organization.forum_discussions_minimal_role, organization.slug
58
+ end
59
+
60
+ (Mumukit::Auth::Roles::ROLES - [:owner]).each do |role|
61
+
62
+ # Assignes the #{role} role to this user
63
+ # for the given slug
64
+ define_method "make_#{role}_of!" do |slug|
65
+ add_permission! role, slug
66
+ end
52
67
  end
53
68
 
54
69
  ## Profile
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Platform
3
- VERSION = '4.1.0'
3
+ VERSION = '4.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-platform
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-nuntius