|
|
@@ -2,6 +2,7 @@ module.exports = function(crowi) {
|
|
|
var debug = require('debug')('growi:models:page')
|
|
|
, mongoose = require('mongoose')
|
|
|
, escapeStringRegexp = require('escape-string-regexp')
|
|
|
+ , templateChecker = require('../util/templateChecker')
|
|
|
, ObjectId = mongoose.Schema.Types.ObjectId
|
|
|
, GRANT_PUBLIC = 1
|
|
|
, GRANT_RESTRICTED = 2
|
|
|
@@ -28,14 +29,6 @@ module.exports = function(crowi) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- function isTemplatePath(path) {
|
|
|
- if (path.match(/.*\/_{1,2}template$/)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
pageSchema = new mongoose.Schema({
|
|
|
path: { type: String, required: true, index: true, unique: true },
|
|
|
revision: { type: ObjectId, ref: 'Revision' },
|
|
|
@@ -105,7 +98,7 @@ module.exports = function(crowi) {
|
|
|
};
|
|
|
|
|
|
pageSchema.methods.isTemplate = function() {
|
|
|
- return isTemplatePath(this.path);
|
|
|
+ return templateChecker(this.path);
|
|
|
};
|
|
|
|
|
|
pageSchema.methods.isCreator = function(userData) {
|