0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Parse Cloudで管理画面(Data Browser)からの値の変更かを判定する方法

Posted at

Parse Cloudの機能を使うと値の変更前後に独自の処理を入れることができます。

Validationで使うことが多いと思いますが、Parseが提供している管理画面(Data Browser)から値を変更したときにもこの処理を通ってしまうので、自由に値を変更させてテストしたい場合に困りました。

Parse自体は判定用の関数を提供していないようなので、全権限(master key)を持っているアクセスが来た場合は管理画面からと判断することにしました。


Parse.Cloud.beforeSave(Parse.User, function(request, response) {

    var masterKey = request.master;

    if (masterKey) {
        //masterKeyでのアクセスの場合は管理画面からだと判断する
        response.success();
    }
   
   //Validation処理を入れる
});

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?