Changes between Version 85 and Version 86 of BluePrintAuthorization
- Timestamp:
- 06/22/10 15:28:38 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BluePrintAuthorization
v85 v86 140 140 * Preferred Option: Do the check alongside deleted as part of a big JOIN 141 141 {{{ 142 def shn_accessible_query( table):142 def shn_accessible_query(self, table): 143 143 """ 144 144 Return a filter of those records which are readable by the currently logged-in user … … 152 152 deleted = 1 153 153 154 roles = se ssion.s3.roles155 156 if 1 in roles:154 roles = self.session.s3.roles 155 156 if self.shn_has_role(1): 157 157 # Admins see all data 158 158 query = deleted … … 189 189 * {{{CrudS3}}} modifies {{{Crud.update()}}} to take a record as an option to a record_id & calls {{{SQLFORM2()}}} 190 190 {{{ 191 def shn_has_permission( name, tablename, record_id = 0):191 def shn_has_permission(self, name, tablename, record_id = 0): 192 192 """ 193 193 S3 framework function to define whether a user can access a record in manner "name" … … 196 196 """ 197 197 198 roles = se ssion.s3.roles198 roles = self.session.s3.roles 199 199 200 200 table = db[tablename] 201 201 # Check if table is restricted (Options 1 & 2) 202 if 1 in roles:202 if shn_has_role(1): 203 203 # Admins see all tables 204 204 authorised = True … … 211 211 # Assume we generally have fewer restrictions than roles 212 212 # for restriction in restrictions: 213 # if restriction == "0" or int(restriction) in roles:213 # if restriction == "0" or self.shn_has_role(restriction): 214 214 # restriction 0 is anonymous 215 215 # authorised = True … … 229 229 # Assume we generally have fewer restrictions than roles 230 230 for restriction in restrictions: 231 if restriction == "0" or int(restriction) in roles:231 if restriction == "0" or self.shn_has_role(restriction): 232 232 # restriction 0 is anonymous 233 233 authorised = True … … 271 271 # Assume we generally have fewer restrictions than roles 272 272 for restriction in restrictions: 273 if restriction in roles:273 if self.shn_has_role(restriction): 274 274 authorised = True 275 275 elif restriction == "2" and "created_by" in _fields: … … 289 289 # Assume we generally have fewer restrictions than roles 290 290 for restriction in restrictions: 291 if restriction == "0" or int(restriction) in roles:291 if restriction == "0" or self.shn_has_role(restriction): 292 292 # restriction 0 is anonymous 293 293 authorised = True