The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-api/server/v1/settings.js

29 lines
834 B

// settings endpoints
RocketChat.API.v1.addRoute('settings/:_id', { authRequired: true }, {
get() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-privileged-setting')) {
return RocketChat.API.v1.unauthorized();
}
return RocketChat.API.v1.success(_.pick(RocketChat.models.Settings.findOneNotHiddenById(this.urlParams._id), '_id', 'value'));
},
post() {
if (!RocketChat.authz.hasPermission(this.userId, 'edit-privileged-setting')) {
return RocketChat.API.v1.unauthorized();
}
try {
check(this.bodyParams, {
value: Match.Any
});
if (RocketChat.models.Settings.updateValueNotHiddenById(this.urlParams._id, this.bodyParams.value)) {
return RocketChat.API.v1.success();
}
return RocketChat.API.v1.failure();
} catch (e) {
return RocketChat.API.v1.failure(e.message);
}
}
});