The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-lib/server/methods/removeOAuthService.coffee

26 lines
1.4 KiB

Meteor.methods
removeOAuthService: (name) ->
check name, String
if not Meteor.userId()
throw new Meteor.Error('error-invalid-user', "Invalid user", { method: 'removeOAuthService' })
unless RocketChat.authz.hasPermission( Meteor.userId(), 'add-oauth-service') is true
throw new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'removeOAuthService' }
name = name.toLowerCase().replace(/[^a-z0-9]/g, '')
name = s.capitalize(name)
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_url"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_token_path"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_identity_path"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_authorize_path"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_scope"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_token_sent_via"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_id"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_secret"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_button_label_text"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_button_label_color"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_button_color"
RocketChat.settings.removeById "Accounts_OAuth_Custom_#{name}_login_style"