Skip to content
Snippets Groups Projects
Commit 58f7c020 authored by Gabriel Engel's avatar Gabriel Engel
Browse files

re organising files

parent 0d7f4746
No related branches found
No related tags found
No related merge requests found
......@@ -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"
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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment