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

unreleased
review
nobody
None
General
nobody
2024-04-03
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.

Related

Commit: [5892b1]
Commit: [a8497a]
Commit: [bc4676]
Commit: [1edc56]
Commit: [74e83f]
Commit: [e0ee0f]

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.

     

Log in to post a comment.