#8556 deprecate and remove has_access(..)() syntax

v1.71.1
closed
nobody
None
General
nobody
2024-06-21
2024-04-03
No

has_access returns a TruthyCallable which can be treated as a bool or called again, which is confusing. There's lots of has_access(...)() syntax that can be cleaned up now.

After cleanup is done (including within external plugins/extensions), we can then remove the TruthyCallable and predicate behavior of has_access, and have it return a simple bool.

Code changes necessary:
- has_access(...)() -> has_access(...)
- has_access(c.app, 'read')(user=user) -> has_access(c.app, 'read', user)
- require(has_access(c.app, 'read')) -> require_access(c.app, 'read'))

If require(...) is used in other situations, ideally it should be changed completely. Or, change from a callable to a bool like require(lambda: foo == bar) -> require(foo == bar) but this cannot be done ahead of time, it mus be done at the time of full removal.

Discussion

  • Dave Brondsema

    Dave Brondsema - 2024-04-03
    • status: open --> review
     
  • Dave Brondsema

    Dave Brondsema - 2024-04-03

    db/8556 on allura, forgehg, and forgepastebin

    db/8556-breaking-removal needs to be merged later, after we do a release and give anyone a chance to update their code. You can review and test it though.

     
  • Dave Brondsema

    Dave Brondsema - 2024-06-12

    Somehow db/8556-breaking-removal didn't have any changes in it. I re-created the changes at db/8556-breaking-removal-2 and have run all the tests. Its ready to be merged

     
  • Dillon Walls - 2024-06-13
    • status: review --> closed
     
  • Dillon Walls - 2024-06-13

    Looks good. Merged

     
  • Dave Brondsema

    Dave Brondsema - 2024-06-21
    • Milestone: unreleased --> v1.71.1
     

Log in to post a comment.