|
@@ -1,6 +1,7 @@
|
|
|
const { db, ObjectId } = require('../../../../app/src/infrastructure/mongodb')
|
|
const { db, ObjectId } = require('../../../../app/src/infrastructure/mongodb')
|
|
|
const { expect } = require('chai')
|
|
const { expect } = require('chai')
|
|
|
const SubscriptionUpdater = require('../../../../app/src/Features/Subscription/SubscriptionUpdater')
|
|
const SubscriptionUpdater = require('../../../../app/src/Features/Subscription/SubscriptionUpdater')
|
|
|
|
|
+const ManagedUsersHandler = require('../../../../app/src/Features/Subscription/ManagedUsersHandler')
|
|
|
const SubscriptionModel =
|
|
const SubscriptionModel =
|
|
|
require('../../../../app/src/models/Subscription').Subscription
|
|
require('../../../../app/src/models/Subscription').Subscription
|
|
|
const DeletedSubscriptionModel =
|
|
const DeletedSubscriptionModel =
|
|
@@ -43,6 +44,10 @@ class Subscription {
|
|
|
db.subscriptions.findOne({ _id: ObjectId(this._id) }, callback)
|
|
db.subscriptions.findOne({ _id: ObjectId(this._id) }, callback)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ getWithGroupPolicy(callback) {
|
|
|
|
|
+ SubscriptionModel.findById(this._id).populate('groupPolicy').exec(callback)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
setManagerIds(managerIds, callback) {
|
|
setManagerIds(managerIds, callback) {
|
|
|
return SubscriptionModel.findOneAndUpdate(
|
|
return SubscriptionModel.findOneAndUpdate(
|
|
|
{ _id: ObjectId(this._id) },
|
|
{ _id: ObjectId(this._id) },
|
|
@@ -55,6 +60,14 @@ class Subscription {
|
|
|
SubscriptionUpdater.refreshUsersFeatures(this, callback)
|
|
SubscriptionUpdater.refreshUsersFeatures(this, callback)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ enableManagedUsers(callback) {
|
|
|
|
|
+ ManagedUsersHandler.enableManagedUsers(this._id, callback)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getGroupPolicyForUser(user, callback) {
|
|
|
|
|
+ ManagedUsersHandler.getGroupPolicyForUser(user, callback)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
expectDeleted(deleterData, callback) {
|
|
expectDeleted(deleterData, callback) {
|
|
|
DeletedSubscriptionModel.find(
|
|
DeletedSubscriptionModel.find(
|
|
|
{ 'subscription._id': this._id },
|
|
{ 'subscription._id': this._id },
|