How does one go about restricting/blocking the usage of an spreadsheet add-on in a shared file? Is it even possible?
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/99280317-cf12-4b88-8789-6bf58524f51f%40googlegroups.com.
Hmm. Good question. Natively the Sheets "owner" can restrict access to the spreadsheet.If the use case of allowing editors to the spreadsheet AND you want to restrict where only the "owner" can run the add-on, then you may need to add some code to check active user versus the sheet owner. then more code to notify the "editors" this add-on is intended for spreadsheet "owners" only.Code examples:SpreadsheetApp service:getViewers()Kind Regards,Steve WebsterSW gApps LLC, PresidentGoogle Product Expert in: Google Apps Script, Drive, and DocsGoogle Vendor (2012-2013) || Google Apps Developer Blog Guest BloggerAdd-ons: Text gBlaster and Remove Blank Rows
On Sat, Feb 8, 2020 at 12:51 PM Andrew Apell <chis...@gmail.com> wrote:
--
How does one go about restricting/blocking the usage of an spreadsheet add-on in a shared file? Is it even possible?
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Thanks Steve... so it's Session.getActiveUser().getEmail() not Session.getEffectiveUser().getEmail()?
On Saturday, 8 February 2020 23:49:50 UTC+3, Steve Webster wrote:
Hmm. Good question. Natively the Sheets "owner" can restrict access to the spreadsheet.If the use case of allowing editors to the spreadsheet AND you want to restrict where only the "owner" can run the add-on, then you may need to add some code to check active user versus the sheet owner. then more code to notify the "editors" this add-on is intended for spreadsheet "owners" only.Code examples:SpreadsheetApp service:getViewers()Kind Regards,Steve WebsterSW gApps LLC, PresidentGoogle Product Expert in: Google Apps Script, Drive, and DocsGoogle Vendor (2012-2013) || Google Apps Developer Blog Guest BloggerAdd-ons: Text gBlaster and Remove Blank Rows
On Sat, Feb 8, 2020 at 12:51 PM Andrew Apell <chis...@gmail.com> wrote:
--
How does one go about restricting/blocking the usage of an spreadsheet add-on in a shared file? Is it even possible?
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/99280317-cf12-4b88-8789-6bf58524f51f%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/99893ba4-c8e1-4d52-9a6e-1d6002055dc5%40googlegroups.com.
Yep. The active user is the one actually logged in, the effective user is the one who initially authorised the script.
On Sat, 8 Feb 2020 at 21:17, Andrew Apell <chis...@gmail.com> wrote:
Thanks Steve... so it's Session.getActiveUser().getEmail() not Session.getEffectiveUser().getEmail()?
On Saturday, 8 February 2020 23:49:50 UTC+3, Steve Webster wrote:
Hmm. Good question. Natively the Sheets "owner" can restrict access to the spreadsheet.If the use case of allowing editors to the spreadsheet AND you want to restrict where only the "owner" can run the add-on, then you may need to add some code to check active user versus the sheet owner. then more code to notify the "editors" this add-on is intended for spreadsheet "owners" only.Code examples:SpreadsheetApp service:getViewers()Kind Regards,Steve WebsterSW gApps LLC, PresidentGoogle Product Expert in: Google Apps Script, Drive, and DocsGoogle Vendor (2012-2013) || Google Apps Developer Blog Guest BloggerAdd-ons: Text gBlaster and Remove Blank Rows
On Sat, Feb 8, 2020 at 12:51 PM Andrew Apell <chis...@gmail.com> wrote:
--
How does one go about restricting/blocking the usage of an spreadsheet add-on in a shared file? Is it even possible?
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/99280317-cf12-4b88-8789-6bf58524f51f%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Yep. The active user is the one actually logged in, the effective user is the one who initially authorised the script.
On Sat, 8 Feb 2020 at 21:17, Andrew Apell <chis...@gmail.com> wrote:
Thanks Steve... so it's Session.getActiveUser().getEmail() not Session.getEffectiveUser().getEmail()?
On Saturday, 8 February 2020 23:49:50 UTC+3, Steve Webster wrote:
Hmm. Good question. Natively the Sheets "owner" can restrict access to the spreadsheet.If the use case of allowing editors to the spreadsheet AND you want to restrict where only the "owner" can run the add-on, then you may need to add some code to check active user versus the sheet owner. then more code to notify the "editors" this add-on is intended for spreadsheet "owners" only.Code examples:SpreadsheetApp service:getViewers()Kind Regards,Steve WebsterSW gApps LLC, PresidentGoogle Product Expert in: Google Apps Script, Drive, and DocsGoogle Vendor (2012-2013) || Google Apps Developer Blog Guest BloggerAdd-ons: Text gBlaster and Remove Blank Rows
On Sat, Feb 8, 2020 at 12:51 PM Andrew Apell <chis...@gmail.com> wrote:
--
How does one go about restricting/blocking the usage of an spreadsheet add-on in a shared file? Is it even possible?
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/99280317-cf12-4b88-8789-6bf58524f51f%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
/**
* Checks if the current user is owner
* @returns {boolean}
*/
function isThereOwner() {
var ow = SpreadsheetApp.getActive()
.getOwner()
.getEmail();
var au = getMeEmail();
return ow == au;
}
function getMeEmail() {
var responce = UrlFetchApp.fetch("https://www.googleapis.com/oauth2/v2/userinfo?fields=email" , {
headers: {
Authorization: 'Bearer ' + ScriptApp.getOAuthToken()
},
"muteHttpExceptions": true
});
if(responce.getResponseCode() < 400){
return JSON.parse(responce.getContentText()).email;
} else {
return undefined;
}
}