- From: <laszlo.1.gombos@nokia.com>
- Date: Thu, 3 Nov 2011 15:28:49 +0000
- To: <wonsuk11.lee@samsung.com>, <public-device-apis@w3.org>
- CC: <jsoref@rim.com>, <dzung.d.tran@intel.com>
Wonsuk,
Thanks for the example. I reworked the example a bit and added it to the spec. Feedback welcome !
Regards,
Laszlo
-----Original Message-----
From: public-device-apis-request@w3.org [mailto:public-device-apis-request@w3.org] On Behalf Of ext Wonsuk Lee
Sent: Thursday, September 01, 2011 9:23 PM
To: public-device-apis@w3.org
Cc: 'Josh Soref'; 'Tran, Dzung D'
Subject: RE: [Feature Permissions] RE: ACTION-436: Provide an example for Permissions
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 Thursday, 3 November 2011 15:29:42 UTC