Changes between Version 7 and Version 8 of BluePrintAuthorization
- Timestamp:
- 06/18/10 17:41:45 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BluePrintAuthorization
v7 v8 5 5 * Add Controller check as well as menu check. 6 6 * Configure permissions in {{{000_config.py}}} instead of {{{01_modules.py}}}? 7 * Change {{{deployment_settings.modules}}} from a list of strings to a list of dicts 8 {{{ 9 deployment_settings_modules = Storage( 10 name = "gis", 11 name_nice = "Mapping", 12 readable = None, 13 writable = None, 14 description = "Situation Awareness & Geospatial Analysis", 15 module_type = 2, 16 resource_readable = Storage( 17 layer_js = None, 18 ) 19 resource_writable = Storage( 20 layer_js = "|6|", # How to look up this 'magic' number before we've got a database yet? :/ 21 ) 22 ) 23 }}} 7 24 * A Developer needs to be able to restrict access to a Function 8 25 * Decorator function - although it doesn't support OR (we could easily write our own function to do this, though) 9 26 * A Developer needs to be able to restrict access to a resource 10 27 * REST controller can be blocked via a Decorator 11 * Full security policy can be invoked, but this is painful /untested within S3 recently28 * Full security policy can be invoked, but this is painful (based on protected by default & granted, whereas we want open by default & restricted)/untested within S3 recently 12 29 * We could check for what other functions can access data? Sync. Hard to maintain though. 13 * Need a new method. Do all accesses go via S3XRC? If not, then needs to be a DAL-level method! Use the Web2Py 'full' for tables but not records?30 * Need a new method. Do all accesses go via S3XRC? If not, then needs to be a DAL-level method! Use an auth_permission table like Web2Py 'full' for tables? Set within 000_config.py, along with modules? 14 31 * A Developer needs to be able to restrict access to a record 15 32 * Add 2 reusable multiple=True fields to each table which needs this: {{{reader_id}}} & {{{writer_id}}} combined as {{{permissions_id}}} … … 20 37 * Option 1: Do the check alongside deleted as part of a big JOIN 21 38 {{{ 22 def shn_accessible_query( user,table):39 def shn_accessible_query(table): 23 40 """ Modified version of current function from models/01_crud.py """ 24 41 25 42 deleted = (table.deleted == None) 26 43 27 _memberships = db.auth_membership 28 memberships = db(_memberships.user_id == user).select(_memberships.group_id) 44 try: 45 user_id = auth.user.id 46 _memberships = db.auth_membership 47 memberships = db(_memberships.user_id == user_id).select(_memberships.group_id) 48 except: 49 memberships = None 50 29 51 roles = [] 30 52 for membership in memberships: … … 45 67 def user_function: 46 68 table = db[tablename] 47 available = shn_accessible_query( user,table)69 available = shn_accessible_query(table) 48 70 query = available & query 49 71 }}} … … 70 92 * unless routed somewhere visible as well! 71 93 * onaccept on message routing (tagging) to check if the only tags are on restricted resources...if they are then restrict the message too. 72 94 * Some tables should be writable by unauthenticated users (writable=|0|) 95 * Need special handling for this in shn_create/shn_update? 73 96 ---- 74 97 BluePrintAuthenticationAccess