re organising files

pull/1449/head
Gabriel Engel 10 years ago
parent 0d7f4746f4
commit 58f7c0208a
  1. 6
      packages/rocketchat-lib/package.js
  2. 22
      packages/rocketchat-lib/server/methods/addOAuthService.coffee
  3. 22
      packages/rocketchat-lib/server/methods/removeOAuthService.coffee

@ -48,13 +48,15 @@ Package.onUse(function(api) {
api.addFiles('server/functions/setUsername.coffee', 'server');
// SERVER METHODS
api.addFiles('server/methods/addOAuthService.coffee', 'server');
api.addFiles('server/methods/joinDefaultChannels.coffee', 'server');
api.addFiles('server/methods/removeOAuthService.coffee', 'server');
api.addFiles('server/methods/robotMethods.coffee', 'server');
api.addFiles('server/methods/saveSetting.coffee', 'server');
api.addFiles('server/methods/sendInvitationEmail.coffee', 'server');
api.addFiles('server/methods/sendMessage.coffee', 'server');
api.addFiles('server/methods/setAdminStatus.coffee', 'server');
api.addFiles('server/methods/setRealName.coffee', 'server');
api.addFiles('server/methods/saveSetting.coffee', 'server');
api.addFiles('server/methods/setUsername.coffee', 'server');
api.addFiles('server/methods/updateUser.coffee', 'server');
@ -63,10 +65,8 @@ Package.onUse(function(api) {
// Settings
api.addFiles('settings/lib/onLoadSettings.coffee');
api.addFiles('settings/server/startup.coffee', 'server');
api.addFiles('settings/server/updateServices.coffee', 'server');
api.addFiles('settings/server/addOAuthService.coffee', 'server');
// CLIENT LIB
api.addFiles('client/lib/openRoom.coffee', 'client');

@ -20,25 +20,3 @@ Meteor.methods
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_label_text" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Text'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_label_color", '#FFFFFF' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Color'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_color" , '#13679A' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Color'}
removeOAuthService: (name) ->
if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] addOAuthService -> Invalid user")
console.log '[methods] addOAuthService -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
unless RocketChat.authz.hasPermission( Meteor.userId(), 'add-oauth-service') is true
throw new Meteor.Error 'not-authorized', '[methods] addOAuthService -> Not authorized'
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}_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"

@ -0,0 +1,22 @@
Meteor.methods
removeOAuthService: (name) ->
if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] addOAuthService -> Invalid user")
console.log '[methods] addOAuthService -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
unless RocketChat.authz.hasPermission( Meteor.userId(), 'add-oauth-service') is true
throw new Meteor.Error 'not-authorized', '[methods] addOAuthService -> Not authorized'
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}_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"
Loading…
Cancel
Save