EN
Det här innehållet finns inte tillgängligt på ditt språk men här finns den engelska versionen,
Det här ämnet har inte bedömts ännu - Bedöm det här ämnet

Authorize user

Server scripts are used to implement authorization rules to make sure that authenticated users can only see their own data or granting additional capabilities to administrators.

Important: To be able to authenticate users, you must register your app with an identity provider. You must then register the provider-generated client secret with Mobile Services. For more information, see Get started with users (Windows Store/Windows Phone/iOS).

The following example sets the owner property based on the userId of an authenticated user.

function insert(item, user, request) {
    item.owner = user.userId;
    request.execute();
}

The following example adds an additional filter to the query based on the userId of an authenticated user. This filter restricts the result to only items that belong to the current user.

function read(query, user, request) {
    query.where({
        owner: user.userId
    });
    request.execute();
}

For more information, see the Mobile Services script reference

Var detta till hjälp?
(1500 tecken kvar)
© 2013 Microsoft. Med ensamrätt.
facebook page visit twitter rss feed newsletter