Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor IAM id access #8969

Merged
merged 7 commits into from
Jan 22, 2025
Merged

Refactor IAM id access #8969

merged 7 commits into from
Jan 22, 2025

Conversation

zhiltsov-max
Copy link
Contributor

@zhiltsov-max zhiltsov-max commented Jan 20, 2025

The existing object id access pattern for foreign keys produces unnecessary dependencies on the whole foreign object. It can be optimized to using just the object id, which is stored in the same db row in most cases (except m2m fields). This change doesn't immediately lead to optimized DB requests, but it opens optimization opportunities in the future.

  • Optimized object id access for foreign key model fields in IAM checks
  • Added obj field type annotations for Permission types
  • Removed 1 extra DB request in task read serializer

Motivation and context

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@zhiltsov-max zhiltsov-max requested review from SpecLad and removed request for Marishka17 January 20, 2025 17:08
@zhiltsov-max zhiltsov-max force-pushed the zm/optimize-iam-data-access branch from 677cb5d to c382cc4 Compare January 20, 2025 17:11
@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 48.64865% with 19 lines in your changes missing coverage. Please review.

Project coverage is 73.84%. Comparing base (f9b7138) to head (271f44a).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8969      +/-   ##
===========================================
- Coverage    73.84%   73.84%   -0.01%     
===========================================
  Files          417      417              
  Lines        44591    44602      +11     
  Branches      4031     4031              
===========================================
+ Hits         32927    32935       +8     
- Misses       11664    11667       +3     
Components Coverage Δ
cvat-ui 78.27% <ø> (-0.01%) ⬇️
cvat-server 70.07% <48.64%> (+<0.01%) ⬆️

cvat/apps/engine/permissions.py Outdated Show resolved Hide resolved
cvat/apps/engine/permissions.py Outdated Show resolved Hide resolved
cvat/apps/engine/serializers.py Show resolved Hide resolved
cvat/apps/webhooks/permissions.py Show resolved Hide resolved
@zhiltsov-max zhiltsov-max merged commit 68ffe4a into develop Jan 22, 2025
34 checks passed
@zhiltsov-max zhiltsov-max deleted the zm/optimize-iam-data-access branch January 22, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants