Sha256: 2c1406c5cd4a4ffa71d40b92c5a665522ec67390eebe820724f6b4b6519cced7

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

class SlackSmartBot
    def has_access?(method, user=nil)
        user = Thread.current[:user] if user.nil?
        if config[:allow_access].key?(method) and !config[:allow_access][method].include?(user.name) and !config[:allow_access][method].include?(user.id) and 
            (!user.key?(:enterprise_user) or ( user.key?(:enterprise_user) and !config[:allow_access][method].include?(user[:enterprise_user].id)))
            respond "You don't have access to use this command, please contact an Admin to be able to use it: <@#{config.admins.join(">, <@")}>"
            return false
        else
            return true
        end      
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack-smart-bot-1.10.0 lib/slack/smart-bot/utils/has_access.rb