MCPcopy Create free account
hub / github.com/parse-community/parse-server / _UnsafeRestQuery

Function _UnsafeRestQuery

src/RestQuery.js:100–277  ·  view source on GitHub ↗

* _UnsafeRestQuery is meant for specific internal usage only. When you need to skip security checks or some triggers. * Don't use it if you don't know what you are doing. * @param config * @param auth * @param className * @param restWhere * @param restOptions * @param clientSDK * @param runA

(
  config,
  auth,
  className,
  restWhere = {},
  restOptions = {},
  clientSDK,
  runAfterFind = true,
  context,
  isGet
)

Source from the content-addressed store, hash-verified

98 * @param context
99 */
100function _UnsafeRestQuery(
101 config,
102 auth,
103 className,
104 restWhere = {},
105 restOptions = {},
106 clientSDK,
107 runAfterFind = true,
108 context,
109 isGet
110) {
111 this.config = config;
112 this.auth = auth;
113 this.className = className;
114 this.restWhere = restWhere;
115 this.restOptions = restOptions;
116 this.clientSDK = clientSDK;
117 this.runAfterFind = runAfterFind;
118 this.response = null;
119 this.findOptions = {};
120 this.context = context || {};
121 this.isGet = isGet;
122 if (!this.auth.isMaster) {
123 if (this.className == '_Session') {
124 if (!this.auth.user) {
125 throw createSanitizedError(Parse.Error.INVALID_SESSION_TOKEN, 'Invalid session token', config);
126 }
127 this.restWhere = {
128 $and: [
129 this.restWhere,
130 {
131 user: {
132 __type: 'Pointer',
133 className: '_User',
134 objectId: this.auth.user.id,
135 },
136 },
137 ],
138 };
139 }
140 }
141
142 this.doCount = false;
143 this.includeAll = false;
144
145 // The format for this.include is not the same as the format for the
146 // include option - it's the paths we should include, in order,
147 // stored as arrays, taking into account that we need to include foo
148 // before including foo.bar. Also it should dedupe.
149 // For example, passing an arg of include=foo.bar,foo.baz could lead to
150 // this.include = [['foo'], ['foo', 'baz'], ['foo', 'bar']]
151 this.include = [];
152 let keysForInclude = '';
153
154 // If we have keys, we probably want to force some includes (n-1 level)
155 // See issue: https://github.com/parse-community/parse-server/issues/3185
156 if (Object.prototype.hasOwnProperty.call(restOptions, 'keys')) {
157 keysForInclude = restOptions.keys;

Callers

nothing calls this directly

Calls 2

createSanitizedErrorFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…