Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / server / services / live-collection-handlers / live-collection-room-security-descriptors.js
bloba557a7c7ff8f35804b00b7a8b65ffae940354f92
1 'use strict';
3 const appEvents = require('gitter-web-appevents');
4 const restSerializer = require('../../serializers/rest-serializer');
6 module.exports = {
7 create: function(/*model*/) {
8 // no-op
9 },
11 update: async function(roomId, securityDescriptorModel) {
12 const url = `/rooms/${roomId}/security`;
13 const strategy = restSerializer.SecurityDescriptorStrategy.full();
14 const serializedSecurityDescriptor = await restSerializer.serializeObject(
15 securityDescriptorModel,
16 strategy
18 appEvents.dataChange2(url, 'update', serializedSecurityDescriptor, 'room.sd');
21 patch: function(roomId, patch) {
22 const url = `/rooms/${roomId}/security`;
23 const patchMessage = {
24 ...patch
25 //roomId
27 appEvents.dataChange2(url, 'patch', patchMessage, 'room.sd');
30 remove: function(/*model*/) {
31 // no-op
34 removeId: function(/*roomId*/) {
35 // no-op