Standard Format Code Changes
This commit is contained in:
1 parent
4ce8cde5b0
commit
37028e34ad
33 files changed
+175
-232
No files matched your search
@@ -5,8 +5,8 @@ import { AutorizationError } from '../errors'
|
||||
const cloneDetails = (authId, team, clone) => {
|
||||
logger.debug('cloneDetails -> Entering function.')
|
||||
|
||||
if(!(authId === (process.env.AUTH_CLIENT_ID + '@clients') || isAuthorized(team, authId))){
|
||||
logger.debug('User %s is not authorized to manage team %s.', authId, team.slug )
|
||||
if (!(authId === (process.env.AUTH_CLIENT_ID + '@clients') || isAuthorized(team, authId))) {
|
||||
logger.debug('User %s is not authorized to manage team %s.', authId, team.slug)
|
||||
throw new AutorizationError()
|
||||
}
|
||||
|
||||
@@ -20,29 +20,29 @@ const cloneDetails = (authId, team, clone) => {
|
||||
clone.botName = selectedBot.name
|
||||
clone.botAvatar = selectedBot.avatar
|
||||
clone.teamAvatar = team.profile.avatar
|
||||
clone.userLoggedIn = team.members[0].member.alias //TODO change by context info if possible
|
||||
clone.userLoggedIn = team.members[0].member.alias // TODO change by context info if possible
|
||||
|
||||
logger.debug('cloneDetails -> Retrieving clone details complete.')
|
||||
return clone
|
||||
};
|
||||
}
|
||||
|
||||
function getSelectedBot(team, selectedBotId){
|
||||
function getSelectedBot (team, selectedBotId) {
|
||||
logger.debug('cloneDetails -> Getting selected bot.')
|
||||
if(isDefined(team)){
|
||||
if (isDefined(team)) {
|
||||
for (var i = 0; i < team.fb.length; i++) {
|
||||
if(team.fb[i].id === selectedBotId){
|
||||
if (team.fb[i].id === selectedBotId) {
|
||||
return team.fb[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isAuthorized(team, authId){
|
||||
function isAuthorized (team, authId) {
|
||||
logger.debug('cloneDetails -> Checking if the user is authorized by the teams module.')
|
||||
let authorized = false
|
||||
if(isDefined(team)){
|
||||
if (isDefined(team)) {
|
||||
for (var i = 0; i < team.members.length; i++) {
|
||||
if(team.members[i].member.authId === authId){
|
||||
if (team.members[i].member.authId === authId) {
|
||||
authorized = true
|
||||
break
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user