PLT-3484 OAuth2 Service Provider (#3632)

* PLT-3484 OAuth2 Service Provider

* PM text review for OAuth 2.0 Service Provider

* PLT-3484 OAuth2 Service Provider UI tweaks (#3668)

* Tweaks to help text

* Pushing OAuth improvements (#3680)

* Re-arrange System Console for OAuth 2.0 Provider
Этот коммит содержится в:
enahum
2016-08-03 12:19:27 -05:00
коммит произвёл Harrison Healey
родитель ea027c8de4
Коммит 5bc3cea6fe
50 изменённых файлов: 2334 добавлений и 1158 удалений

Просмотреть файл

@@ -20,6 +20,8 @@ class IntegrationStore extends EventEmitter {
this.outgoingWebhooks = new Map();
this.commands = new Map();
this.oauthApps = new Map();
}
addChangeListener(callback) {
@@ -149,6 +151,35 @@ class IntegrationStore extends EventEmitter {
this.setCommands(teamId, commands);
}
hasReceivedOAuthApps(userId) {
return this.oauthApps.has(userId);
}
getOAuthApps(userId) {
return this.oauthApps.get(userId) || [];
}
setOAuthApps(userId, oauthApps) {
this.oauthApps.set(userId, oauthApps);
}
addOAuthApp(oauthApp) {
const userId = oauthApp.creator_id;
const oauthApps = this.getOAuthApps(userId);
oauthApps.push(oauthApp);
this.setOAuthApps(userId, oauthApps);
}
removeOAuthApp(userId, id) {
let apps = this.getOAuthApps(userId);
apps = apps.filter((app) => app.id !== id);
this.setOAuthApps(userId, apps);
}
handleEventPayload(payload) {
const action = payload.action;
@@ -197,6 +228,18 @@ class IntegrationStore extends EventEmitter {
this.removeCommand(action.teamId, action.id);
this.emitChange();
break;
case ActionTypes.RECEIVED_OAUTHAPPS:
this.setOAuthApps(action.userId, action.oauthApps);
this.emitChange();
break;
case ActionTypes.RECEIVED_OAUTHAPP:
this.addOAuthApp(action.oauthApp);
this.emitChange();
break;
case ActionTypes.REMOVED_OAUTHAPP:
this.removeOAuthApp(action.userId, action.id);
this.emitChange();
break;
}
}
}

Просмотреть файл

@@ -37,7 +37,6 @@ class ModalStoreClass extends EventEmitter {
case ActionTypes.TOGGLE_DELETE_POST_MODAL:
case ActionTypes.TOGGLE_GET_POST_LINK_MODAL:
case ActionTypes.TOGGLE_GET_TEAM_INVITE_LINK_MODAL:
case ActionTypes.TOGGLE_REGISTER_APP_MODAL:
case ActionTypes.TOGGLE_GET_PUBLIC_LINK_MODAL:
this.emit(type, value, args);
break;