GroupPolicy.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. const mongoose = require('../infrastructure/Mongoose')
  2. const { Schema } = mongoose
  3. const GroupPolicySchema = new Schema(
  4. {
  5. // User can't delete their own account
  6. userCannotDeleteOwnAccount: Boolean,
  7. // User can't add a secondary email address, or affiliation
  8. userCannotAddSecondaryEmail: Boolean,
  9. // User can't have an active (currently auto-renewing) personal subscription, nor can they start one
  10. userCannotHaveSubscription: Boolean,
  11. // User can't choose to leave the group subscription they are managed by
  12. userCannotLeaveManagingGroupSubscription: Boolean,
  13. // User can't have a Google SSO account, nor can they link it to their account
  14. userCannotHaveGoogleSSO: Boolean,
  15. // 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
  16. userCannotHaveOtherThirdPartySSO: Boolean,
  17. },
  18. { minimize: false }
  19. )
  20. exports.GroupPolicy = mongoose.model('GroupPolicy', GroupPolicySchema)
  21. exports.GroupPolicySchema = GroupPolicySchema