2023-06-20 03:38:59 -04:00
|
|
|
const mongoose = require('../infrastructure/Mongoose')
|
|
|
|
|
|
|
|
const { Schema } = mongoose
|
|
|
|
|
|
|
|
const GroupPolicySchema = new Schema(
|
|
|
|
{
|
|
|
|
// User can't delete their own account
|
|
|
|
userCannotDeleteOwnAccount: Boolean,
|
|
|
|
|
|
|
|
// User can't add a secondary email address, or affiliation
|
2023-07-05 04:53:48 -04:00
|
|
|
userCannotHaveSecondaryEmail: Boolean,
|
2023-06-20 03:38:59 -04:00
|
|
|
|
|
|
|
// User can't have an active (currently auto-renewing) personal subscription, nor can they start one
|
|
|
|
userCannotHaveSubscription: Boolean,
|
|
|
|
|
|
|
|
// User can't choose to leave the group subscription they are managed by
|
|
|
|
userCannotLeaveManagingGroupSubscription: Boolean,
|
|
|
|
|
2023-06-27 06:02:24 -04:00
|
|
|
// User can't have a Google SSO account, nor can they link it to their account
|
|
|
|
userCannotHaveGoogleSSO: Boolean,
|
|
|
|
|
|
|
|
// User can't have other third-party SSO (e.g. Twitter/ORCID/IEEE) active on their account, nor can they link it to their account
|
|
|
|
userCannotHaveOtherThirdPartySSO: Boolean,
|
2023-06-20 03:38:59 -04:00
|
|
|
},
|
|
|
|
{ minimize: false }
|
|
|
|
)
|
|
|
|
|
|
|
|
exports.GroupPolicy = mongoose.model('GroupPolicy', GroupPolicySchema)
|
|
|
|
exports.GroupPolicySchema = GroupPolicySchema
|