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/app/oauth2-server-config/server/admin/methods/deleteOAuthApp.js

20 lines
667 B

import { Meteor } from 'meteor/meteor';
import { hasPermission } from '../../../../authorization';
import { OAuthApps } from '../../../../models/server/raw';
Meteor.methods({
async deleteOAuthApp(applicationId) {
if (!hasPermission(this.userId, 'manage-oauth-apps')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'deleteOAuthApp' });
}
const application = await OAuthApps.findOneById(applicationId);
if (application == null) {
throw new Meteor.Error('error-application-not-found', 'Application not found', {
method: 'deleteOAuthApp',
});
}
await OAuthApps.deleteOne({ _id: applicationId });
return true;
},
});