This code configures access control for Jupyter Notebooks by mapping specific functionalities to permission groups, determining which users or roles can access them. It uses a dictionary-like structure to define these mappings, enabling fine-grained control over notebook permissions.
npm run import -- "rpc groups"
var FUNCTION_GROUPS = ['Function'];
var SELENIUM_GROUPS = ['Selenium'];
var UNITTEST_GROUPS = ['Unit Test']; // TODO: identified using describe
var DEFAULT_GROUPS = ['Available']
var PUBLIC = {
// rpc basics
'rpc.ipynb[permissions]' : ['Public'],
'syntax.ipynb[parameter names]' : ['Public'],
// tags on contacts used for permissions groups
'google contacts.ipynb[google contact settings]': ['Inner Circle', 'Public'],
// searching
'gulp.ipynb[search notebooks]' : ['Public'],
'import.ipynb[search notebook questions]' : ['Public'],
'data collection.ipynb[meta search all]' : [], // no Public, use schedule instead
'data collection.ipynb[schedule search all]' : ['Public', 'scheduler'],
'data collection.ipynb[crawl domain]' : [], // no Public, use schedule instead
'data collection.ipynb[schedule crawl domain]': ['Public', 'scheduler'],
// date tools
'data collection.ipynb[tell joke]' : ['Public'],
'google timeline.ipynb[search timeline events]' : ['Public', 'map'],
'google scheduling.ipynb[search calendar]': ['Public', 'history'],
'google scheduling.ipynb[calendar search heatmap]' : ['Public', 'slider'],
// dev tools
'aws.ipynb[latest s3 bucket]' : ['Public', 'gallery'],
'git.ipynb[tip git tree]' : ['Public', 'slider'],
'git.ipynb[megamind]' : ['Public', 'editor'],
'git.ipynb[github commit html acl]' : ['Public', 'editor'],
'child process.ipynb[spawn child process]' : ['Public'],
'twilio.ipynb[accept incoming twilio message]': ['Public'],
'twilio.ipynb[twilio reminder]': ['Public', 'scheduler'],
// marketing site
'marketing scripts.ipynb[contact us handler]': ['Public'],
'convert spreadsheet.ipynb[get sheet identifier]': ['Public'],
'convert spreadsheet.ipynb[sheet marketing import]': ['Public'],
'convert spreadsheet.ipynb[setup sheet backend]': ['Public'],
'convert spreadsheet.ipynb[create a sheet]': ['Public'],
// study sauce
'study sauce.ipynb[authorize app to read profile info]': ['Public'],
'study sauce.ipynb[create a study sauce user directory]': ['Public'],
'study sauce.ipynb[render study sauce cards page]': ['Public'],
'study sauce.ipynb[create a copy of study sauce template]': ['Public'],
};
module.exports = {
FUNCTION_GROUPS,
SELENIUM_GROUPS,
UNITTEST_GROUPS,
DEFAULT_GROUPS,
PUBLIC
}
const PUBLIC_Notebooks = {
// RPC Basics
rpc: {
ipynb: {
permissions: ['Public']
},
syntax: {
'ipynb[parameter names]': ['Public']
}
},
// Tags on Contacts Used for Permissions Groups
'google contacts.ipynb': {
'google contact settings': ['Inner Circle', 'Public']
},
// Searching
search: {
gulp: {
'ipynb[search notebooks]': ['Public']
},
import: {
'ipynb[search notebook questions]': ['Public']
},
dataCollection: {
'ipynb[meta search all]': [], // No public access, use schedule instead
'ipynb[schedule search all]': ['Public','scheduler'],
'ipynb[crawl domain]': [], // No public access, use schedule instead
'ipynb[schedule crawl domain]': ['Public','scheduler']
}
},
// Date Tools
dateTools: {
dataCollection: {
'ipynb[tell joke]': ['Public']
},
timeline: {
'ipynb[search timeline events]': ['Public','map']
},
scheduling: {
'ipynb[search calendar]': ['Public', 'history'],
'ipynb[calendar search heatmap]': ['Public','slider']
}
},
// Dev Tools
devTools: {
aws: {
'ipynb[latest s3 bucket]': ['Public', 'gallery']
},
git: {
'ipynb[tip git tree]': ['Public','slider'],
'ipynb[megamind]': ['Public', 'editor'],
'ipynb[github commit html acl]': ['Public', 'editor']
},
process: {
'ipynb[spawn child process]': ['Public']
},
twilio: {
'ipynb[accept incoming twilio message]': ['Public'],
'ipynb[twilio reminder]': ['Public','scheduler']
}
},
// Marketing Site
marketingSite: {
'marketing scripts.ipynb': {
'contact us handler': ['Public']
},
convert: {
spreadsheet: {
'ipynb[get sheet identifier]': ['Public'],
'ipynb[sheet marketing import]': ['Public'],
'ipynb[setup sheet backend]': ['Public'],
'ipynb[create a sheet]': ['Public']
}
}
},
// Study Sauce
studySauce: {
'study sauce.ipynb': {
'authorize app to read profile info': ['Public'],
'create a study sauce user directory': ['Public'],
'render study sauce cards page': ['Public'],
'create a copy of study sauce template': ['Public']
}
}
};
const FUNCTION_GROUPS = ['Function'];
const SELENIUM_GROUPS = ['Selenium'];
const UNITTEST_GROUPS = ['Unit Test']; // Identified using describe
const DEFAULT_GROUPS = ['Available'];
module.exports = {
FUNCTION_GROUPS,
SELENIUM_GROUPS,
UNITTEST_GROUPS,
DEFAULT_GROUPS,
PUBLIC_Notebooks
};
This code defines a configuration for access control and permissions for various Jupyter Notebook functionalities.
Key Points:
FUNCTION_GROUPS
, SELENIUM_GROUPS
, UNITTEST_GROUPS
, and DEFAULT_GROUPS
.PUBLIC
object maps notebook functionalities (identified by keys) to their associated permission groups.PUBLIC
represents a specific notebook function or feature. The corresponding value is an array of permission groups that have access to that functionality.PUBLIC
likely default to the DEFAULT_GROUPS
.Purpose:
This configuration likely determines which users or roles have access to which Jupyter Notebook functionalities. For example, notebooks tagged with 'rpc.ipynb[permissions]'
are accessible to users in the 'Public'
group.
Structure:
The code uses a dictionary-like structure (PUBLIC
) to map notebook functionalities to permission groups. This allows for granular control over access permissions.