W3C home > Mailing lists > Public > public-device-apis@w3.org > September 2011

RE: [Feature Permissions] RE: ACTION-436: Provide an example for Permissions

From: Wonsuk Lee <wonsuk11.lee@samsung.com>
Date: Fri, 02 Sep 2011 10:22:52 +0900
To: public-device-apis@w3.org
Cc: 'Josh Soref' <jsoref@rim.com>, "'Tran, Dzung D'" <dzung.d.tran@intel.com>
Message-id: <002601cc690e$d612d9c0$82388d40$%lee@samsung.com>
Hi. All.
Below is the revised example of feature perm. according to the comments from Josh and Tran. 

var featureID = "contacts";

function doSomeThing() {
  // Getting the permission level of the feature identified by 'featureID'
  var response = navigator.permissionLevel(featureID);

  if (response == USER_ALLOWED) {
    // Do something with USER_ALLOWED permission
    getContacts(); // Perform a contacts search
    // ...
  }
  else {
    // Do something with USER_DENIED permission
    alert("This web app will be working except there will be no integration to retrieve "+featureID+" information");
  }
}

// Perform 'doSomeThing' function after requesting a permission for the feature (identified by 'featureID') to the user.
navigator.requestPermission(featureID, doSomeThing);


best regards,
Wonsuk.

> -----Original Message-----
> From: public-device-apis-request@w3.org [mailto:public-device-apis-
> request@w3.org] On Behalf Of Wonsuk Lee
> Sent: Thursday, September 01, 2011 10:42 AM
> To: 'Tran, Dzung D'
> Cc: 'Josh Soref'; public-device-apis@w3.org
> Subject: RE: [Feature Permissions] RE: ACTION-436: Provide an example for
> Permissions
> 
> Hi. Tran.
> Good point. Thanks.
> 
> Best regards,
> Wonsuk.
> 
> > -----Original Message-----
> > From: public-device-apis-request@w3.org [mailto:public-device-apis-
> > request@w3.org] On Behalf Of Tran, Dzung D
> > Sent: Thursday, September 01, 2011 1:49 AM
> > To: Josh Soref; Wonsuk Lee; public-device-apis@w3.org
> > Subject: [Feature Permissions] RE: ACTION-436: Provide an example for
> > Permissions
> >
> >   if (response == 2) {  // should use USER_ALLOWED constant
> >
> > Also, in the spec
> http://dev.w3.org/2009/dap/perms/FeaturePermissions.html
> >
> > The description for "feature" in section 3.2 Methods seems to be
> incorrect.
> > It said "Returns one of the permission values USER_ALLOWED,
> > DEFAULT_ALLOWED, DEFAULT_DENIED, USER_DENIED." Instead of "Describes the
> > feature that is been requested for permission to access"
> >
> >
> > Thanks
> > Dzung Tran
> >
> >
> > -----Original Message-----
> > From: public-device-apis-request@w3.org [mailto:public-device-apis-
> > request@w3.org] On Behalf Of Josh Soref
> > Sent: Wednesday, August 31, 2011 8:05 AM
> > To: Wonsuk Lee; public-device-apis@w3.org
> > Subject: RE: ACTION-436: Provide an example for Permissions
> >
> > Wongsuk wrote:
> > > var featureID = "contacts";
> > > function doSomeThing() {
> > >  // Getting the permission level of a feature
> > >  var response = navigator.permissionLevel(featureID);
> > >
> > >  if (response === 2) {   //  USER_ALLOWED = 2
> > >    // Do something with USER_ALLOWED permission
> > >     getContacts(); // Perform an contacts search
> >
> > This should be either `a contact` or `a contacts` (certainly not `an`)
> >
> > >                     ...
> > >  }
> >
> > Please note that you should have braces for the else block:
> > >  else
> > >    // Do something with USER_DENIED permission
> >
> > >    alert("This web app will be working except your "+featureID+"
> > information");
> >
> > s/your/there will be no integration to retrieve/
> >
> > > }
> > > navigator.requestPermission(featureID, doSomeThing);
> >
> > Note that this message is not an endorsement of the feature...
> >
> > ---------------------------------------------------------------------
> > This transmission (including any attachments) may contain confidential
> > information, privileged material (including material protected by the
> > solicitor-client or other applicable privileges), or constitute non-
> public
> > information. Any use of this information by anyone other than the
> intended
> > recipient is prohibited. If you have received this transmission in error,
> > please immediately reply to the sender and delete this information from
> > your system. Use, dissemination, distribution, or reproduction of this
> > transmission by unintended recipients is not authorized and may be
> > unlawful.
Received on Friday, 2 September 2011 01:23:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:22 GMT