Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 141
    • Merge requests 141
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !181

Merged
Created Oct 14, 2016 by Jérome Perrin@jeromeOwner

Support properties' read permission in the GUI and in getProperty

  • Overview 14
  • Commits 10
  • Changes 20

Because unlike getFoo(), getProperty('foo') does not checks the permission defined on the accessor, when a form contain a my_foo field, the property would be displayed to the user who can view the form, even if the user does not actually have the permission to get this property. This because getter for default value of fields uses getProperty ( here ).

These changes modify behavior of getProperty, so that it enforces read permission security of properties and raise when user does not have permission to access properties.

Some notes about implementation:

  • getProperty now becomes a bit slower, but it was incorrect before, so I guess it's inevitable.
  • some efforts have been made to keep the impact on performance minimal. This uses the same approach of in edit of computing the set of restricted properties and using guarded_getattr only on these properties and using getattr on non-restricted properties. The computation of this set was moved to dynamic class generation time and as a result, edit becomes a bit faster.
  • the expectedFailure part of test_PropertySheetSecurityOnAccessors was moved to another test, but I'm not even sure we want to support this (read-protecting properties with default write permission) as, to me, such configuration does not make much sense.
  • new performance tests were added. I don't know what to use as min/max values so I just used something that should pass.
  • implementation for getProperty('*_list') was changed a lot, I have no idea why this was getting the method on the class and passing self as first argument. Now it we just get method on the instance, like we do for single properties.
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: accessor_getter_security
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7