Added !serverannounce command.
This commit is contained in:
parent
375cdfb3d8
commit
df18b4d783
4 changed files with 35 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
const {mongoose} = require('mongoose');
|
||||
|
||||
//Local Imports
|
||||
//const {userModel} = require('./userSchema');
|
||||
const userSchema = require('./userSchema');
|
||||
const channelPermissionSchema = require('./channel/channelPermissionSchema');
|
||||
|
||||
//This originally belonged to the permissionSchema, but this avoids circular dependencies.
|
||||
|
|
@ -43,6 +45,12 @@ const permissionSchema = new mongoose.Schema({
|
|||
default: "admin",
|
||||
required: true
|
||||
},
|
||||
announce: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
enum: rankEnum,
|
||||
default: "admin",
|
||||
required: true
|
||||
},
|
||||
banUser: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
enum: rankEnum,
|
||||
|
|
@ -105,6 +113,11 @@ permissionSchema.statics.rankToNum = function(rank){
|
|||
}
|
||||
|
||||
permissionSchema.statics.permCheck = async function(user, perm){
|
||||
const userDB = await userSchema.userModel.findOne({user: user.user});
|
||||
return await this.permCheckByUserDoc(userDB, perm);
|
||||
}
|
||||
|
||||
permissionSchema.statics.permCheckByUserDoc = async function(user, perm){
|
||||
//Get permission list
|
||||
const perms = await this.getPerms();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue