slack-smart-bot 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b243575f1dce8d61e387199037a62b2a1fb7eea2fb578981b1b82c18adb76393
4
- data.tar.gz: 2890ce0402d1a23b2fb2f8710bd9bedc25412a9b4a9f1dc23f614f06b507f4f3
3
+ metadata.gz: 0e81ed53db87bdccab438f126b87a2e7abd2d1b0ca9d79cdbbc4990209f18501
4
+ data.tar.gz: 259e6f186089d98bc641d1a604c89c88b09f396e99a0ff5f8c782f317dd46b72
5
5
  SHA512:
6
- metadata.gz: 5d3da033e26a6660a976ae408e5620bd63a389feb8d458f68f4e52a4b6e1256be98cb80a386729e01baf269e85ecaa54e150cbb565df37246c6dbb5c8892da10
7
- data.tar.gz: 4741d4dd84e4542ecf1682117ee6fb5cf2d6547070364e4cb4d882154008180191279b2691b02945bd8e5503fbc5973156a202bec45a0f8875c992dea6f3fa5c
6
+ metadata.gz: 73c128f5ee9cf8c457832c54ae99875519dc3d636d0ef41476df1ce034d4216b061c8fdafa5d3c40c9c6cb7932ac49dc22cde3d2094f18807e9d3760dc54bdc8
7
+ data.tar.gz: 556582c4bf0c62fe655be834fa7b7a315b136c877f44af5e55daad164387c1d82a6a89349c380db3f86195aaff3b6356f0957e15f36cdbb5b7dae0d15e709c0a
@@ -12,7 +12,8 @@ class SlackSmartBot
12
12
  # help:
13
13
  def bot_help(user, from, dest, dchannel, specific, help_command, rules_file)
14
14
  save_stats(__method__)
15
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
15
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
16
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
16
17
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
17
18
  else
18
19
  help_found = false
@@ -7,7 +7,8 @@ class SlackSmartBot
7
7
  def bot_status(dest, user)
8
8
  save_stats(__method__)
9
9
  get_bots_created()
10
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
10
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
11
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
11
12
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
12
13
  else
13
14
  gems_remote = `gem list slack-smart-bot --remote`
@@ -10,7 +10,8 @@ class SlackSmartBot
10
10
  def use_rules(dest, channel, user, dchannel)
11
11
  save_stats(__method__)
12
12
  get_bots_created()
13
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
13
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
14
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
14
15
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
15
16
  else
16
17
  #todo: add pagination for case more than 1000 channels on the workspace
@@ -21,7 +21,8 @@ class SlackSmartBot
21
21
  save_stats(__method__)
22
22
  unless typem == :on_extended
23
23
  from = user.name
24
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
24
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
25
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
25
26
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
26
27
  else
27
28
  @shortcuts[from] = Hash.new() unless @shortcuts.keys.include?(from)
@@ -10,7 +10,8 @@ class SlackSmartBot
10
10
  def delete_repl(dest, user, session_name)
11
11
  #todo: add tests
12
12
  save_stats(__method__)
13
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
13
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
14
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
14
15
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
15
16
  else
16
17
  if @repls.key?(session_name)
@@ -9,7 +9,8 @@ class SlackSmartBot
9
9
  save_stats(__method__)
10
10
  unless typem == :on_extended
11
11
  from = user.name
12
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
12
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
13
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
13
14
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
14
15
  else
15
16
  deleted = false
@@ -9,7 +9,8 @@ class SlackSmartBot
9
9
  def get_repl(dest, user, session_name)
10
10
  #todo: add tests
11
11
  save_stats(__method__)
12
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
12
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
13
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
13
14
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
14
15
  else
15
16
  Dir.mkdir("#{config.path}/repl") unless Dir.exist?("#{config.path}/repl")
@@ -32,7 +32,8 @@ class SlackSmartBot
32
32
  def repl(dest, user, session_name, env_vars, rules_file, command, description, type)
33
33
  #todo: add more tests
34
34
  from = user.name
35
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
35
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
36
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
36
37
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
37
38
  else
38
39
  if !@repl_sessions.key?(from)
@@ -9,7 +9,8 @@ class SlackSmartBot
9
9
 
10
10
  def ruby_code(dest, user, code, rules_file)
11
11
  save_stats(__method__)
12
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
12
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
13
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
13
14
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
14
15
  else
15
16
  unless code.match?(/System/i) or code.match?(/Kernel/i) or code.include?("File") or
@@ -14,7 +14,8 @@ class SlackSmartBot
14
14
  def run_repl(dest, user, session_name, env_vars, rules_file)
15
15
  #todo: add tests
16
16
  from = user.name
17
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
17
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
18
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
18
19
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
19
20
  else
20
21
  save_stats(__method__)
@@ -8,7 +8,8 @@ class SlackSmartBot
8
8
  #todo: add tests
9
9
  save_stats(__method__)
10
10
  from = user.name
11
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
11
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
12
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
12
13
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
13
14
  else
14
15
  message = ""
@@ -7,7 +7,8 @@ class SlackSmartBot
7
7
  def see_shortcuts(dest, user, typem)
8
8
  save_stats(__method__)
9
9
  from = user.name
10
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
10
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
11
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
11
12
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
12
13
  else
13
14
  unless typem == :on_extended
@@ -2,7 +2,8 @@ class SlackSmartBot
2
2
  def bot_rules(dest, help_command, typem, rules_file, user)
3
3
  save_stats(__method__)
4
4
  from = user.name
5
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
5
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
6
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
6
7
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
7
8
  else
8
9
  if typem == :on_extended or typem == :on_call #for the other cases above.
@@ -10,7 +10,8 @@ class SlackSmartBot
10
10
  def create_bot(dest, user, cloud, channel)
11
11
  save_stats(__method__)
12
12
  from = user.name
13
- if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id)
13
+ if config[:allow_access].key?(__method__) and !config[:allow_access][__method__].include?(user.name) and !config[:allow_access][__method__].include?(user.id) and
14
+ (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][__method__].include?(user[:enterprise_user].id)))
14
15
  respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
15
16
  else
16
17
  if config.on_master_bot
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-smart-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz