weDevsOfficial / wedocs-plugin

A documentation plugin for WordPress
https://wordpress.org/plugins/wedocs/
GNU General Public License v2.0
195 stars 93 forks source link

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

Closed haideralibd closed 2 months ago

haideralibd commented 3 months ago

…so to roles selected on wedocs pro global permission settings

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

Summary by CodeRabbit

Summary by CodeRabbit

coderabbitai[bot] commented 3 months ago

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
Rubaiyat-E-Mohammad commented 3 months ago

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

haideralibd commented 3 months ago

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

Rubaiyat-E-Mohammad commented 3 months ago

NIcely fixed