Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/access-strategy-types/when.js
"use strict"; | |||||
const Promise = require("bluebird"); | const Promise = require("bluebird"); | ||||
const Query = require("../../../datastore/query.js"); | const Query = require("../../../datastore/query.js"); | ||||
async function construct_query( | async function construct_query( | ||||
app, | app, | ||||
context, | context, | ||||
collection_name, | collection_name, | ||||
special_filter_name, | special_filter_name, | ||||
Show All 14 Lines | new Query.And( | ||||
new Query.Not(filtering_query), | new Query.Not(filtering_query), | ||||
await when_false.getRestrictingQuery(context) | await when_false.getRestrictingQuery(context) | ||||
) | ) | ||||
); | ); | ||||
} | } | ||||
module.exports = app => ({ | module.exports = app => ({ | ||||
name: "when", | name: "when", | ||||
getRestrictingQuery: async function( | async getRestrictingQuery( | ||||
context, | context, | ||||
[ | [ | ||||
collection_name, | collection_name, | ||||
special_filter_name, | special_filter_name, | ||||
when_true_name, | when_true_name, | ||||
when_false_name = "noone", | when_false_name = "noone", | ||||
] | ] | ||||
) { | ) { | ||||
return construct_query( | return construct_query( | ||||
app, | app, | ||||
context, | context, | ||||
collection_name, | collection_name, | ||||
special_filter_name, | special_filter_name, | ||||
when_true_name, | when_true_name, | ||||
when_false_name | when_false_name | ||||
); | ); | ||||
}, | }, | ||||
checker_function: async function( | async checker_function( | ||||
context, | context, | ||||
[ | [ | ||||
collection_name, | collection_name, | ||||
special_filter_name, | special_filter_name, | ||||
when_true_name, | when_true_name, | ||||
when_false_name = "noone", | when_false_name = "noone", | ||||
], | ], | ||||
item | item | ||||
Show All 20 Lines |