cvat icon indicating copy to clipboard operation
cvat copied to clipboard

Analytics access

Open Eldies opened this issue 1 year ago • 3 comments

Motivation and context

Checkbox for granting access to /analytics

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)
  • [ ] I have increased versions of npm packages if it is necessary (cvat-canvas, cvat-core, cvat-data and cvat-ui)

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.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new property, hasAnalyticsAccess, in user profiles to manage access to analytics features.
    • Expanded criteria for displaying the "Analytics" button in the header to include users with analytics access.
  • Bug Fixes

    • Improved permission checks to include hasAnalyticsAccess, enhancing access control for analytics features.
  • Documentation

    • Updated inline admin interface for user profiles to allow direct editing of the hasAnalyticsAccess field.

These updates enhance user experience by providing better access management and visibility of analytics features.

Eldies avatar Oct 04 '24 10:10 Eldies

[!IMPORTANT]

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes involve the addition of a new boolean property, hasAnalyticsAccess, to the User class, which determines user access to analytics features. This property is reflected in the user interface, allowing broader access to the "Analytics" button based on user permissions. Additionally, a new field for has_analytics_access is introduced in the Profile model, along with corresponding updates in serializers, permissions, and access control rules. The changes enhance user profile management and analytics access across the application.

Changes

File Path Change Summary
cvat-core/src/user.ts Added hasAnalyticsAccess property, modified constructor and serialization to include has_analytics_access.
cvat-ui/src/components/header/header.tsx Updated conditional rendering for "Analytics" button to check for hasAnalyticsAccess.
cvat/apps/engine/migrations/0085_profile_has_analytics_access.py Added migration for new has_analytics_access field in Profile model.
cvat/apps/engine/models.py Introduced has_analytics_access field in Profile model; added multiple new classes and enumerations.
cvat/apps/engine/serializers.py Updated UserSerializer to include has_analytics_access; added several new serializer classes.
cvat/apps/iam/admin.py Created ProfileInline for editing Profile fields in admin; modified CustomUserAdmin.
cvat/apps/iam/permissions.py Added has_analytics_access to OpenPolicyAgentPermission; updated permission checking logic.
cvat/apps/log_viewer/rules/analytics.rego Introduced has_analytics_access to access control logic for analytics permissions.
cvat/apps/log_viewer/rules/tests/generators/analytics_test.gen.rego.py Added HAS_ANALYTICS_ACCESS constant; updated functions to include has_analytics_access.

Poem

In the fields of code we play,
New access blooms, bright as day.
Analytics now within our reach,
A button for all, a joyful speech!
With profiles rich and rules refined,
A world of data, joyfully aligned! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Oct 04 '24 10:10 coderabbitai[bot]

Codecov Report

Attention: Patch coverage is 79.48718% with 8 lines in your changes missing coverage. Please review.

Project coverage is 74.28%. Comparing base (2cca2dd) to head (8304c3f). Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8509      +/-   ##
===========================================
+ Coverage    74.26%   74.28%   +0.02%     
===========================================
  Files          403      403              
  Lines        43287    43316      +29     
  Branches      3914     3914              
===========================================
+ Hits         32147    32179      +32     
+ Misses       11140    11137       -3     
Components Coverage Δ
cvat-ui 78.78% <100.00%> (+0.05%) :arrow_up:
cvat-server 70.47% <78.94%> (+<0.01%) :arrow_up:

codecov-commenter avatar Oct 04 '24 16:10 codecov-commenter