wedocs-plugin icon indicating copy to clipboard operation
wedocs-plugin copied to clipboard

Grant delete capability to admin and editor by default, also to roles selected on wedocs pro global permission settings

Open haideralibd opened this issue 1 year ago • 1 comments
trafficstars

…so to roles selected on wedocs pro global permission settings

Issue: https://github.com/weDevsOfficial/wedocs-pro/issues/90

Summary by CodeRabbit

  • New Features

    • Enhanced the wedocs search block with customizable attributes, improving user control over its appearance and behavior.
    • Introduced a new method to grant delete capabilities to specific user roles, enhancing security and role management.
  • Bug Fixes

    • Updated asset versioning to reflect recent improvements and ensure compatibility.
  • Style

    • Revamped CSS for the wedocs search block, improving responsiveness and aesthetics with new styles and variables.
  • Documentation

    • Added comments in CSS files for better clarity on the source of the styles and debugging assistance.

haideralibd avatar Aug 07 '24 09:08 haideralibd

Walkthrough

The recent updates to the wedocs plugin in WordPress introduce several enhancements, including improved user capability management for document deletion, a modular structure for the Redux store, and extensive customization options for the search block. Changes include the addition of a new Capability class to manage user roles, refined CSS for better aesthetics, and updates to various asset files to ensure compatibility and performance.

Changes

Files Change Summary
assets/build/block.asset.php Removed 'react' dependency; updated version from a9f22e2f040c1e4bfcd8 to d05819f3aa7353dc2183.
assets/build/block.js Enhanced wedocs search block with new attributes for customization; improved rendering logic in edit and save functions.
assets/build/frontend.asset.php Updated version from 9452b96fb7f339eb0d86 to a20f12fe6b47034f5721.
assets/build/frontend.css Added comments about CSS source and included source mapping for easier debugging.
assets/build/frontend.js Introduced module system setup for the frontend and integrated CSS extraction via Webpack.
assets/build/index.asset.php Updated version from 43de68933e801be37f9f to ab7a5beedef1700a147e.
assets/build/index.css Added comments and integrated styles from an external carousel library, enhancing existing styles.
assets/build/print.asset.php Updated version from dc9757ca31eec222b3ea to 9585c2e16bdeda6a19a1.
assets/build/print.js Introduced module system and properly marked exports for Webpack compatibility.
assets/build/store.asset.php Updated version from 743cb5f33b454f204fb0 to bd6e30c242bf00a67efe.
assets/build/store.js Restructured Redux store into modular files for actions, reducers, selectors, controls, and resolvers, enhancing maintainability.
assets/build/style-block.css Comprehensive updates to styling for the wedocs search block, improving responsiveness and aesthetics.
includes/Post_Types.php Added grant_delete_capability_to_specific_roles method to manage user capabilities for delete operations based on roles.
includes/Capability.php Introduced new Capability class to manage document deletion permissions based on user roles, with a method to grant capabilities dynamically.
wedocs.php Updated init_classes to include instantiation of the Capability class, enhancing user capability management within the application.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Editor
    participant SearchBlock
    participant ReduxStore
    participant Capability

    User->>Editor: Opens search block
    Editor->>SearchBlock: Configure attributes (e.g., color, width)
    SearchBlock-->>Editor: Update preview
    User->>SearchBlock: Submits search
    SearchBlock->>ReduxStore: Fetch results
    ReduxStore-->>SearchBlock: Return results
    SearchBlock-->>User: Display results

    User->>Capability: Attempts to delete document
    Capability->>User: Validate permissions
    Capability-->>User: Grant or deny delete capabilities

🐰 In the meadow where rabbits hop,
Changes frolic, they never stop!
With search blocks that dance and play,
User roles now hold sway!
CSS shines, oh so bright,
In our burrow, all feels right! 🌟


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 Aug 07 '24 09:08 coderabbitai[bot]

The Move To Trash button for an "Editor" works now but is getting some errors in the debug log. Can you give a feedback regarding this? @haideralibd vai [09-Aug-2024 09:14:26 UTC] PHP Notice: Undefined offset: 0 in /Users/RubaiyatQA/Sites/wedocs/wp-content/plugins/wedocs-plugin/includes/Capability.php on line 39

Rubaiyat-E-Mohammad avatar Aug 09 '24 09:08 Rubaiyat-E-Mohammad

@Rubaiyat-E-Mohammad bhai, i have fixed the issue. Please take a pull and test. Thanks.

haideralibd avatar Aug 13 '24 06:08 haideralibd

NIcely fixed

Rubaiyat-E-Mohammad avatar Aug 13 '24 11:08 Rubaiyat-E-Mohammad