diff --git a/.github/scripts/add_seo_descriptions.py b/.github/scripts/add_seo_descriptions.py new file mode 100644 index 0000000000..25fd508479 --- /dev/null +++ b/.github/scripts/add_seo_descriptions.py @@ -0,0 +1,255 @@ +import os +import sys +import re +import json +from openai import OpenAI + +client = OpenAI(api_key=os.environ['OPENAI_API_KEY']) + +# Regex patterns as constants +SEO_BLOCK_PATTERN = r'```+json\s*//\[doc-seo\]\s*(\{.*?\})\s*```+' +SEO_BLOCK_WITH_BACKTICKS_PATTERN = r'(```+)json\s*//\[doc-seo\]\s*(\{.*?\})\s*\1' + +def has_seo_description(content): + """Check if content already has SEO description with Description field""" + match = re.search(SEO_BLOCK_PATTERN, content, flags=re.DOTALL) + + if not match: + return False + + try: + json_str = match.group(1) + seo_data = json.loads(json_str) + return 'Description' in seo_data and seo_data['Description'] + except json.JSONDecodeError: + return False + +def has_seo_block(content): + """Check if content has any SEO block (with or without Description)""" + return bool(re.search(SEO_BLOCK_PATTERN, content, flags=re.DOTALL)) + +def remove_seo_blocks(content): + """Remove all SEO description blocks from content""" + return re.sub(SEO_BLOCK_PATTERN + r'\s*', '', content, flags=re.DOTALL) + +def is_content_too_short(content, min_length=200): + """Check if content is less than minimum length (excluding SEO blocks)""" + clean_content = remove_seo_blocks(content) + return len(clean_content.strip()) < min_length + +def get_content_preview(content, max_length=1000): + """Get preview of content for OpenAI (excluding SEO blocks)""" + clean_content = remove_seo_blocks(content) + return clean_content[:max_length].strip() + +def escape_json_string(text): + """Escape special characters for JSON""" + return text.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n') + +def create_seo_block(description): + """Create a new SEO block with the given description""" + escaped_desc = escape_json_string(description) + return f'''```json +//[doc-seo] +{{ + "Description": "{escaped_desc}" +}} +``` + +''' + +def generate_description(content, filename): + """Generate SEO description using OpenAI""" + try: + preview = get_content_preview(content) + + response = client.chat.completions.create( + model="gpt-4o-mini", + messages=[ + {"role": "system", "content": """Create a short and engaging summary (1–2 sentences) for sharing this documentation link on Discord, LinkedIn, Reddit, Twitter and Facebook. Clearly describe what the page explains or teaches. +Highlight the value for developers using ABP Framework. +Be written in a friendly and professional tone. +Stay under 150 characters. +--> https://abp.io/docs/latest <--"""}, + {"role": "user", "content": f"""Generate a concise, informative meta description for this documentation page. + +File: {filename} +Content Preview: +{preview} + +Requirements: +- Maximum 150 characters + +Generate only the description text, nothing else:"""} + ], + max_tokens=150, + temperature=0.7 + ) + + description = response.choices[0].message.content.strip() + return description + except Exception as e: + print(f"❌ Error generating description: {e}") + return f"Learn about {os.path.splitext(filename)[0]} in ABP Framework documentation." + +def update_seo_description(content, description): + """Update existing SEO block with new description""" + match = re.search(SEO_BLOCK_WITH_BACKTICKS_PATTERN, content, flags=re.DOTALL) + + if not match: + return None + + backticks = match.group(1) + json_str = match.group(2) + + try: + seo_data = json.loads(json_str) + seo_data['Description'] = description + updated_json = json.dumps(seo_data, indent=4, ensure_ascii=False) + + new_block = f'''{backticks}json +//[doc-seo] +{updated_json} +{backticks}''' + + return re.sub(SEO_BLOCK_WITH_BACKTICKS_PATTERN, new_block, content, count=1, flags=re.DOTALL) + except json.JSONDecodeError: + return None + +def add_seo_description(content, description): + """Add or update SEO description in content""" + # Try to update existing block first + updated_content = update_seo_description(content, description) + if updated_content: + return updated_content + + # No existing block or update failed, add new block at the beginning + return create_seo_block(description) + content + +def is_file_ignored(filepath, ignored_folders): + """Check if file is in an ignored folder""" + path_parts = filepath.split('/') + return any(ignored in path_parts for ignored in ignored_folders) + +def get_changed_files(): + """Get changed files from command line or environment variable""" + if len(sys.argv) > 1: + return sys.argv[1:] + + changed_files_str = os.environ.get('CHANGED_FILES', '') + return [f.strip() for f in changed_files_str.strip().split('\n') if f.strip()] + +def process_file(filepath, ignored_folders): + """Process a single markdown file. Returns (processed, skipped, skip_reason)""" + if not filepath.endswith('.md'): + return False, False, None + + # Check if file is in ignored folder + if is_file_ignored(filepath, ignored_folders): + print(f"📄 Processing: {filepath}") + print(f" 🚫 Skipped (ignored folder)\n") + return False, True, 'ignored' + + print(f"📄 Processing: {filepath}") + + try: + # Read file with original line endings + with open(filepath, 'r', encoding='utf-8', newline='') as f: + content = f.read() + + # Check if content is too short + if is_content_too_short(content): + print(f" ⏭️ Skipped (content less than 200 characters)\n") + return False, True, 'too_short' + + # Check if already has SEO description + if has_seo_description(content): + print(f" ⏭️ Skipped (already has SEO description)\n") + return False, True, 'has_description' + + # Generate description + filename = os.path.basename(filepath) + print(f" 🤖 Generating description...") + description = generate_description(content, filename) + print(f" 💡 Generated: {description}") + + # Add or update SEO description + if has_seo_block(content): + print(f" 🔄 Updating existing SEO block...") + else: + print(f" ➕ Adding new SEO block...") + + updated_content = add_seo_description(content, description) + + # Write back (preserving line endings) + with open(filepath, 'w', encoding='utf-8', newline='') as f: + f.write(updated_content) + + print(f" ✅ Updated successfully\n") + return True, False, None + + except Exception as e: + print(f" ❌ Error: {e}\n") + return False, False, None + +def save_statistics(processed_count, skipped_count, skipped_too_short, skipped_ignored): + """Save processing statistics to file""" + try: + with open('/tmp/seo_stats.txt', 'w') as f: + f.write(f"{processed_count}\n{skipped_count}\n{skipped_too_short}\n{skipped_ignored}") + except Exception as e: + print(f"⚠️ Warning: Could not save statistics: {e}") + +def save_updated_files(updated_files): + """Save list of updated files""" + try: + with open('/tmp/seo_updated_files.txt', 'w') as f: + f.write('\n'.join(updated_files)) + except Exception as e: + print(f"⚠️ Warning: Could not save updated files list: {e}") + +def main(): + # Get ignored folders from environment + IGNORED_FOLDERS_STR = os.environ.get('IGNORED_FOLDERS', 'Blog-Posts,Community-Articles,_deleted,_resources') + IGNORED_FOLDERS = [folder.strip() for folder in IGNORED_FOLDERS_STR.split(',') if folder.strip()] + + # Get changed files + changed_files = get_changed_files() + + # Statistics + processed_count = 0 + skipped_count = 0 + skipped_too_short = 0 + skipped_ignored = 0 + updated_files = [] + + print("🤖 Processing changed markdown files...\n") + print(f"� Ignored folders: {', '.join(IGNORED_FOLDERS)}\n") + + # Process each file + for filepath in changed_files: + processed, skipped, skip_reason = process_file(filepath, IGNORED_FOLDERS) + + if processed: + processed_count += 1 + updated_files.append(filepath) + elif skipped: + skipped_count += 1 + if skip_reason == 'too_short': + skipped_too_short += 1 + elif skip_reason == 'ignored': + skipped_ignored += 1 + + # Print summary + print(f"\n📊 Summary:") + print(f" ✅ Updated: {processed_count}") + print(f" ⏭️ Skipped (total): {skipped_count}") + print(f" ⏭️ Skipped (too short): {skipped_too_short}") + print(f" 🚫 Skipped (ignored folder): {skipped_ignored}") + + # Save statistics + save_statistics(processed_count, skipped_count, skipped_too_short, skipped_ignored) + save_updated_files(updated_files) + +if __name__ == '__main__': + main() diff --git a/.github/workflows/auto-add-seo.yml b/.github/workflows/auto-add-seo.yml new file mode 100644 index 0000000000..c56079af25 --- /dev/null +++ b/.github/workflows/auto-add-seo.yml @@ -0,0 +1,210 @@ +name: Auto Add SEO Descriptions + +on: + pull_request: + paths: + - 'docs/en/**/*.md' + branches: + - 'rel-*' + - 'dev' + types: [closed] + +jobs: + add-seo-descriptions: + if: | + github.event.pull_request.merged == true && + !startsWith(github.event.pull_request.head.ref, 'auto-docs-seo/') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.ref }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install openai + + - name: Get changed markdown files from merged PR using GitHub API + id: changed-files + uses: actions/github-script@v7 + with: + script: | + const prNumber = ${{ github.event.pull_request.number }}; + + // Get all files changed in the PR with pagination + const allFiles = []; + let page = 1; + let hasMore = true; + + while (hasMore) { + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + per_page: 100, + page: page + }); + + allFiles.push(...files); + hasMore = files.length === 100; + page++; + } + + console.log(`Total files changed in PR: ${allFiles.length}`); + + // Filter for only added/modified markdown files in docs/en/ + const changedMdFiles = allFiles + .filter(file => + (file.status === 'added' || file.status === 'modified') && + file.filename.startsWith('docs/en/') && + file.filename.endsWith('.md') + ) + .map(file => file.filename); + + console.log(`\nFound ${changedMdFiles.length} added/modified markdown files in docs/en/:`); + changedMdFiles.forEach(file => console.log(` - ${file}`)); + + // Write to environment file for next steps + const fs = require('fs'); + fs.writeFileSync(process.env.GITHUB_OUTPUT, + `any_changed=${changedMdFiles.length > 0 ? 'true' : 'false'}\n` + + `all_changed_files=${changedMdFiles.join(' ')}\n`, + { flag: 'a' } + ); + + return changedMdFiles; + + - name: Create new branch for SEO updates + if: steps.changed-files.outputs.any_changed == 'true' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + # Create new branch from current base branch (which already has merged files) + BRANCH_NAME="auto-docs-seo/${{ github.event.pull_request.number }}" + git checkout -b $BRANCH_NAME + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + + echo "✅ Created branch: $BRANCH_NAME" + echo "" + echo "📝 Files to process for SEO descriptions:" + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + if [ -f "$file" ]; then + echo " ✓ $file" + else + echo " ✗ $file (not found)" + fi + done + + - name: Process changed files and add SEO descriptions + if: steps.changed-files.outputs.any_changed == 'true' + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + IGNORED_FOLDERS: ${{ vars.DOCS_SEO_IGNORED_FOLDERS }} + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + python3 .github/scripts/add_seo_descriptions.py + + + - name: Commit and push changes + if: steps.changed-files.outputs.any_changed == 'true' + run: | + git add -A docs/en/ + + if git diff --staged --quiet; then + echo "No changes to commit" + echo "has_commits=false" >> $GITHUB_ENV + else + BRANCH_NAME="auto-docs-seo/${{ github.event.pull_request.number }}" + git commit -m "docs: Add SEO descriptions to modified documentation files" -m "Related to PR #${{ github.event.pull_request.number }}" + git push origin $BRANCH_NAME + echo "has_commits=true" >> $GITHUB_ENV + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + fi + + - name: Create Pull Request + if: env.has_commits == 'true' + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const stats = fs.readFileSync('/tmp/seo_stats.txt', 'utf8').split('\n'); + const processedCount = parseInt(stats[0]) || 0; + const skippedCount = parseInt(stats[1]) || 0; + const skippedTooShort = parseInt(stats[2]) || 0; + const skippedIgnored = parseInt(stats[3]) || 0; + const prNumber = ${{ github.event.pull_request.number }}; + const baseRef = '${{ github.event.pull_request.base.ref }}'; + const branchName = `auto-docs-seo/${prNumber}`; + + if (processedCount > 0) { + // Read the actually updated files list (not all changed files) + const updatedFilesStr = fs.readFileSync('/tmp/seo_updated_files.txt', 'utf8'); + const updatedFiles = updatedFilesStr.trim().split('\n').filter(f => f.trim()); + + let prBody = '🤖 **Automated SEO Descriptions**\n\n'; + prBody += `This PR automatically adds SEO descriptions to documentation files that were modified in PR #${prNumber}.\n\n`; + prBody += '## 📊 Summary\n'; + prBody += `- ✅ **Updated:** ${processedCount} file(s)\n`; + prBody += `- ⏭️ **Skipped (total):** ${skippedCount} file(s)\n`; + if (skippedTooShort > 0) { + prBody += ` - ⏭️ Content < 200 chars: ${skippedTooShort} file(s)\n`; + } + if (skippedIgnored > 0) { + prBody += ` - 🚫 Ignored folders: ${skippedIgnored} file(s)\n`; + } + prBody += '\n## 📝 Modified Files\n'; + prBody += updatedFiles.slice(0, 20).map(f => `- \`${f}\``).join('\n'); + if (updatedFiles.length > 20) { + prBody += `\n- ... and ${updatedFiles.length - 20} more`; + } + prBody += '\n\n## 🔧 Details\n'; + prBody += `- **Related PR:** #${prNumber}\n\n`; + prBody += 'These descriptions were automatically generated to improve SEO and search engine visibility. 🚀'; + + const { data: pr } = await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: `docs: Add SEO descriptions (from PR ${prNumber})`, + head: branchName, + base: baseRef, + body: prBody + }); + + console.log(`✅ Created PR: ${pr.html_url}`); + + // Add reviewers to the PR (from GitHub variable) + const reviewersStr = '${{ vars.DOCS_SEO_REVIEWERS || '' }}'; + const reviewers = reviewersStr.split(',').map(r => r.trim()).filter(r => r); + + if (reviewers.length === 0) { + console.log('⚠️ No reviewers specified in DOCS_SEO_REVIEWERS variable.'); + return; + } + + try { + await github.rest.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr.number, + reviewers: reviewers, + team_reviewers: [] + }); + console.log(`✅ Added reviewers (${reviewers.join(', ')}) to PR ${pr.number}`); + } catch (error) { + console.log(`⚠️ Could not add reviewers: ${error.message}`); + } + } + diff --git a/.github/workflows/auto-pr.yml b/.github/workflows/auto-pr.yml index 80d0acd30f..4cb89fd21d 100644 --- a/.github/workflows/auto-pr.yml +++ b/.github/workflows/auto-pr.yml @@ -1,13 +1,13 @@ -name: Merge branch rel-10.1 with rel-10.0 +name: Merge branch dev with rel-10.1 on: push: branches: - - rel-10.0 + - rel-10.1 permissions: contents: read jobs: - merge-rel-10-1-with-rel-10-0: + merge-dev-with-rel-10-1: permissions: contents: write # for peter-evans/create-pull-request to create branch pull-requests: write # for peter-evans/create-pull-request to create a PR @@ -15,17 +15,17 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: rel-10.1 + ref: dev - name: Reset promotion branch run: | - git fetch origin rel-10.0:rel-10.0 - git reset --hard rel-10.0 + git fetch origin rel-10.1:rel-10.1 + git reset --hard rel-10.1 - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - branch: auto-merge/rel-10-0/${{github.run_number}} - title: Merge branch rel-10.1 with rel-10.0 - body: This PR generated automatically to merge rel-10.1 with rel-10.0. Please review the changed files before merging to prevent any errors that may occur. + branch: auto-merge/rel-10-1/${{github.run_number}} + title: Merge branch dev with rel-10.1 + body: This PR generated automatically to merge dev with rel-10.1. Please review the changed files before merging to prevent any errors that may occur. reviewers: maliming draft: true token: ${{ github.token }} @@ -34,5 +34,5 @@ jobs: GH_TOKEN: ${{ secrets.BOT_SECRET }} run: | gh pr ready - gh pr review auto-merge/rel-10-0/${{github.run_number}} --approve - gh pr merge auto-merge/rel-10-0/${{github.run_number}} --merge --auto --delete-branch + gh pr review auto-merge/rel-10-1/${{github.run_number}} --approve + gh pr merge auto-merge/rel-10-1/${{github.run_number}} --merge --auto --delete-branch diff --git a/Directory.Packages.props b/Directory.Packages.props index 453ddc618f..fa951f8d7d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -16,6 +16,7 @@ + @@ -87,7 +88,6 @@ - @@ -167,7 +167,7 @@ - + @@ -182,6 +182,10 @@ + + + + @@ -189,6 +193,6 @@ - + diff --git a/README.md b/README.md index fa6632daa8..4ef4bfab56 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ - [Quick Start](https://abp.io/docs/latest/tutorials/todo) is a single-part, quick-start tutorial to build a simple application with the ABP Framework. Start with this tutorial if you want to understand how ABP works quickly. - [Web Application Development Tutorial](https://abp.io/docs/latest/tutorials/book-store) is a complete tutorial on developing a full-stack web application with all aspects of a real-life solution. - [Modular Monolith Application](https://abp.io/docs/latest/tutorials/modular-crm/index): A multi-part tutorial that demonstrates how to create application modules, compose and communicate them to build a monolith modular web application. +- [Microservice Tutorial](https://abp.io/docs/latest/tutorials/microservice/index): A multi-part guide that walks you through building a microservice solution with ABP, from creating independent services and enabling inter-service communication to exposing them through an API Gateway and generating CRUD pages with ABP Suite. ## What ABP Provides? diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 4f19fd9299..bb6c1aeef4 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -672,6 +672,7 @@ "SupportQuestionCountPerDeveloperOnRenewLicense": "Support Question Count Per Developer for License Renewal", "SupportQuestionCountPerDeveloperOnNewLicense": "Support Question Count Per Developer for New License", "IncludedDeveloperCount": "Included Developer Count", + "AiTokenCountPerDeveloper": "AI Token Count Per Developer", "CanBuyAdditionalDevelopers": "Can Buy Additional Developers", "HasEmailSupport": "Has Email Support", "IsSupportPrivateQuestion": "Can Open Private Support Question", @@ -776,6 +777,13 @@ "Menu:Studio": "Studio", "Menu:Solutions": "Solutions", "Menu:Users": "Users", - "Menu:UserReports": "Users" + "Menu:UserReports": "Users", + "Enum:TokenType:1": "Free", + "Enum:TokenType:2": "Paid", + "Enum:SourceChannel:1": "Studio", + "Enum:SourceChannel:2": "Support Site", + "Enum:SourceChannel:3": "Suite", + "Menu:AITokens": "AI Tokens", + "Permission:OrganizationTokenUsage": "Organization Token Usage" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json index 35c4766f8b..16b93b9cc5 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json @@ -228,7 +228,9 @@ "Articles": "Articles", "Organizations": "Organizations", "ManageAccount": "Manage Account", + "MyManageAccount": "My Account", "CommunityProfile": "Community Profile", + "MyCommunityProfile": "My Community Profile", "BlogProfile": "Blog Profile", "Tickets": "Tickets", "Raffles": "Raffles", @@ -248,13 +250,28 @@ "NewsletterDefinition": "Blog posts, community news, etc.", "OrganizationOverview": "Organization Overview", "EmailPreferences": "Email Preferences", + "MyEmailPreferences": "My Email Preferences", "VideoCourses": "Essential Videos", "DoYouAgreePrivacyPolicy": "By clicking Subscribe button you agree to the Terms & Conditions and Privacy Policy.", "AbpConferenceDescription": "ABP Conference is a virtual event for .NET developers to learn and connect with the community.", "Mobile": "Mobile", "MetaTwitterCard": "summary_large_image", "IPAddress": "IP Address", + "MyReferrals": "My Referrals", "LicenseBanner:InfoText": "Your license will expire in {0} days.", - "LicenseBanner:CallToAction": "Please extend your license." + "LicenseBanner:CallToAction": "Please extend your license.", + "Referral.CreatorUserIdIsRequired": "Creator user ID is required.", + "Referral.TargetEmailIsRequired": "Target email is required.", + "Referral.YouAlreadyHaveLinkForThisEmail": "You have already created a referral link for this email address.", + "Referral.MaxLinkLimitExceeded": "You have reached the maximum limit of {Limit} active referral links.", + "Referral.LinkNotFound": "Referral link not found.", + "Referral.LinkNotFoundOrNotOwned": "Referral link not found or you don't have permission to access it.", + "Referral.CannotDeleteUsedLink": "You cannot delete a referral link that has already been used.", + "Referral.CannotReferYourself": "You cannot create a referral link for your own email address.", + "Referral:TargetEmail": "Target Email", + "Referral.CannotReferSameOrganizationMember": "Referral links cannot be used for existing organization members.", + "LinkCopiedToClipboard": "Link copied to clipboard", + "AreYouSureToDeleteReferralLink": "Are you sure you want to delete this referral link?", + "DefaultErrorMessage": "An error occurred." } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json index e3d8c34c72..981500451a 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json @@ -616,6 +616,7 @@ "QuestionItemErrorMessage": "Could not get the latest question details from Stackoverflow.", "Oops": "Oops!", "CreatePostSuccessMessage": "The Post has been successfully submitted. It will be published after a review from the site admin.", + "PostCreationFailed": "An error occurred while creating the post. Please try again later.", "Browse": "Browse", "CoverImage": "Cover Image", "ShareYourExperiencesWithTheABPFramework": "ABP Community Articles | Read or Submit Articles", @@ -1552,6 +1553,15 @@ "IntegrateToYourKubernetesCluster_Description1": "Connect your local development environment to a local or remote Kubernetes cluster, where that cluster already runs your microservice solution.", "IntegrateToYourKubernetesCluster_Description2": "Access any service in Kubernetes with their service name as DNS, just like they are running in your local computer.", "IntegrateToYourKubernetesCluster_Description3": "Intercept any service in that cluster, so all the traffic to the intercepted service is automatically redirected to your service that is running in your local machine. When your service needs to use any service in Kubernetes, the traffic is redirected back to the cluster, just like your local service is running inside the Kubernetes.", + "AskOurAiAssistant": "Ask Our AI Assistant", + "AskOurAiAssistant_Description1": "Build faster with an AI that actually understands your ABP project. The ABP AI Assistant answers your technical questions, explains your code, and helps you solve problems directly inside ABP Studio — with full awareness of your project’s structure. You can even send screenshots or code files to get precise, context-based guidance.", + "AskOurAiAssistant_Description2": "What It Helps You Do", + "AskOurAiAssistant_Description3": "Ask anything about your ABP project — domain layer, modules, configuration, entities, services, or UI.", + "AskOurAiAssistant_Description4": "Get smart, code-aware explanations tailored to your solution.", + "AskOurAiAssistant_Description5": "Generate snippets and scaffolding suggestions instantly.", + "AskOurAiAssistant_Description6": "Fix errors faster with context-aware debugging support.", + "AskOurAiAssistant_Description7": "Learn ABP best practices as you build.", + "AskOurAiAssistant_Description8": "Whether you're generating new features, debugging an issue, or exploring a module, the AI Assistant gives you actionable, project-specific answers — right when you need them.", "GetInformed": "Get Informed", "Studio_GetInformed_Description1": "Leave your contact information to get informed and try it first when ABP Studio has been launched.", "Studio_GetInformed_Description2": "Planned preview release date: Q3 of 2023.", diff --git a/common.props b/common.props index ba6c43fd96..42e230791c 100644 --- a/common.props +++ b/common.props @@ -1,8 +1,8 @@ latest - 10.0.2 - 5.0.2 + 10.1.0-preview + 5.1.0-preview $(NoWarn);CS1591;CS0436 https://abp.io/assets/abp_nupkg.png https://abp.io/ diff --git a/docs/en/Blog-Posts/2025-10-23-ABP-is-Sponsoring-DotNET-Conf-2025/post.md b/docs/en/Blog-Posts/2025-10-23-ABP-is-Sponsoring-DotNET-Conf-2025/post.md new file mode 100644 index 0000000000..6f546ee392 --- /dev/null +++ b/docs/en/Blog-Posts/2025-10-23-ABP-is-Sponsoring-DotNET-Conf-2025/post.md @@ -0,0 +1,20 @@ +### ABP is Sponsoring .NET Conf 2025\! + +We are very excited to announce that **ABP is a proud sponsor of .NET Conf 2025\!** This year marks the 15th online conference, celebrating the launch of .NET 10 and bringing together the global .NET community for three days\! + +Mark your calendar for **November 11th-13th** because you do not want to miss the biggest .NET virtual event of the year\! + +### About .NET Conf + +.NET Conference has always been **a free, virtual event, creating a world-class, engaging experience for developers** across the globe. This year, the conference is bigger than ever, drawing over 100 thousand live viewers and sponsoring hundreds of local community events worldwide\! + +### What to Expect + +**The .NET 10 Launch:** The event kicks off with the official release and deep-dive into the newest features of .NET 10\. + +**Three Days of Live Content:** Over the course of the event you'll get a wide selection of live sessions featuring speakers from the community and members of the .NET team. + +### Chance to Win a License\! + +As a proud sponsor, ABP is giving back to the community\! We are giving away one **ABP Personal License for a full year** to a lucky attendee of .NET Conf 2025\! To enter for a chance to win, simply register for the event [**here.**](https://www.dotnetconf.net/) + diff --git a/docs/en/Blog-Posts/2025-11-02-Repository-Pattern-in-the-Aspnetcore/post.md b/docs/en/Blog-Posts/2025-11-02-Repository-Pattern-in-the-Aspnetcore/post.md new file mode 100644 index 0000000000..d1692471aa --- /dev/null +++ b/docs/en/Blog-Posts/2025-11-02-Repository-Pattern-in-the-Aspnetcore/post.md @@ -0,0 +1,277 @@ +# Repository Pattern in the ASP.NET Core + +If you’ve built a .NET app with a database, you’ve likely used Entity Framework, Dapper, or ADO.NET. They’re useful tools; still, when they live inside your business logic or controllers, the code can become harder to keep tidy and to test. + +That’s where the **Repository Pattern** comes in. + +At its core, the Repository Pattern acts as a **middle layer between your domain and data access logic**. It abstracts the way you store and retrieve data, giving your application a clean separation of concerns: + +* **Separation of Concerns:** Business logic doesn’t depend on the database. +* **Easier Testing:** You can replace the repository with a fake or mock during unit tests. +* **Flexibility:** You can switch data sources (e.g., from SQL to MongoDB) without touching business logic. + +Let’s see how this works with a simple example. + +## A Simple Example with Product Repository + +Imagine we’re building a small e-commerce app. We’ll start by defining a repository interface for managing products. + +You can find the complete sample code in this GitHub repository: + +https://github.com/m-aliozkaya/RepositoryPattern + +### Domain model and context + +We start with a single entity and a matching `DbContext`. + +`Product.cs` + +```csharp +using System.ComponentModel.DataAnnotations; + +namespace RepositoryPattern.Web.Models; + +public class Product +{ + public int Id { get; set; } + + [Required, StringLength(64)] + public string Name { get; set; } = string.Empty; + + [Range(0, double.MaxValue)] + public decimal Price { get; set; } + + [StringLength(256)] + public string? Description { get; set; } + + public int Stock { get; set; } +} +``` + +`"AppDbContext.cs` + +```csharp +using Microsoft.EntityFrameworkCore; +using RepositoryPattern.Web.Models; + +namespace RepositoryPattern.Web.Data; + +public class AppDbContext(DbContextOptions options) : DbContext(options) +{ + public DbSet Products => Set(); +} +``` + +### Generic repository contract and base class + +All entities share the same CRUD needs, so we define a generic interface and an EF Core implementation. + +`Repositories/IRepository.cs` + +```csharp +using System.Linq.Expressions; + +namespace RepositoryPattern.Web.Repositories; + +public interface IRepository where TEntity : class +{ + Task GetByIdAsync(int id, CancellationToken cancellationToken = default); + Task> GetAllAsync(CancellationToken cancellationToken = default); + Task> GetListAsync(Expression> predicate, CancellationToken cancellationToken = default); + Task AddAsync(TEntity entity, CancellationToken cancellationToken = default); + Task UpdateAsync(TEntity entity, CancellationToken cancellationToken = default); + Task DeleteAsync(int id, CancellationToken cancellationToken = default); +} +``` + +`Repositories/EfRepository.cs` + +```csharp +using Microsoft.EntityFrameworkCore; +using RepositoryPattern.Web.Data; + +namespace RepositoryPattern.Web.Repositories; + +public class EfRepository(AppDbContext context) : IRepository + where TEntity : class +{ + protected readonly AppDbContext Context = context; + + public virtual async Task GetByIdAsync(int id, CancellationToken cancellationToken = default) + => await Context.Set().FindAsync([id], cancellationToken); + + public virtual async Task> GetAllAsync(CancellationToken cancellationToken = default) + => await Context.Set().AsNoTracking().ToListAsync(cancellationToken); + + public virtual async Task> GetListAsync( + System.Linq.Expressions.Expression> predicate, + CancellationToken cancellationToken = default) + => await Context.Set() + .AsNoTracking() + .Where(predicate) + .ToListAsync(cancellationToken); + + public virtual async Task AddAsync(TEntity entity, CancellationToken cancellationToken = default) + { + await Context.Set().AddAsync(entity, cancellationToken); + await Context.SaveChangesAsync(cancellationToken); + } + + public virtual async Task UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) + { + Context.Set().Update(entity); + await Context.SaveChangesAsync(cancellationToken); + } + + public virtual async Task DeleteAsync(int id, CancellationToken cancellationToken = default) + { + var entity = await GetByIdAsync(id, cancellationToken); + if (entity is null) + { + return; + } + + Context.Set().Remove(entity); + await Context.SaveChangesAsync(cancellationToken); + } +} +``` + +Reads use `AsNoTracking()` to avoid tracking overhead, while write methods call `SaveChangesAsync` to keep the sample straightforward. + +### Product-specific repository + +Products need one extra query: list the items that are almost out of stock. We extend the generic repository with a dedicated interface and implementation. + +`Repositories/IProductRepository.cs` + +```csharp +using RepositoryPattern.Web.Models; + +namespace RepositoryPattern.Web.Repositories; + +public interface IProductRepository : IRepository +{ + Task> GetLowStockProductsAsync(int threshold, CancellationToken cancellationToken = default); +} +``` + +`Repositories/ProductRepository.cs` + +```csharp +using Microsoft.EntityFrameworkCore; +using RepositoryPattern.Web.Data; +using RepositoryPattern.Web.Models; + +namespace RepositoryPattern.Web.Repositories; + +public class ProductRepository(AppDbContext context) : EfRepository(context), IProductRepository +{ + public Task> GetLowStockProductsAsync(int threshold, CancellationToken cancellationToken = default) => + Context.Products + .AsNoTracking() + .Where(product => product.Stock <= threshold) + .OrderBy(product => product.Stock) + .ToListAsync(cancellationToken); +} +``` + +### 🧩 A Note on Unit of Work + +The Repository Pattern is often used together with the **Unit of Work** pattern to manage transactions efficiently. + +> 💡 *If you want to dive deeper into the Unit of Work pattern, check out our separate blog post dedicated to that topic. https://abp.io/community/articles/lv4v2tyf + +### Service layer and controller + +Controllers depend on a service, and the service depends on the repository. That keeps HTTP logic and data logic separate. + +`Services/ProductService.cs` + +```csharp +using RepositoryPattern.Web.Models; +using RepositoryPattern.Web.Repositories; + +namespace RepositoryPattern.Web.Services; + +public class ProductService(IProductRepository productRepository) +{ + private readonly IProductRepository _productRepository = productRepository; + + public Task> GetProductsAsync(CancellationToken cancellationToken = default) => + _productRepository.GetAllAsync(cancellationToken); + + public Task> GetLowStockAsync(int threshold, CancellationToken cancellationToken = default) => + _productRepository.GetLowStockProductsAsync(threshold, cancellationToken); + + public Task GetByIdAsync(int id, CancellationToken cancellationToken = default) => + _productRepository.GetByIdAsync(id, cancellationToken); + + public Task CreateAsync(Product product, CancellationToken cancellationToken = default) => + _productRepository.AddAsync(product, cancellationToken); + + public Task UpdateAsync(Product product, CancellationToken cancellationToken = default) => + _productRepository.UpdateAsync(product, cancellationToken); + + public Task DeleteAsync(int id, CancellationToken cancellationToken = default) => + _productRepository.DeleteAsync(id, cancellationToken); +} +``` + +`Controllers/ProductsController.cs` + +```csharp +using Microsoft.AspNetCore.Mvc; +using RepositoryPattern.Web.Models; +using RepositoryPattern.Web.Services; + +namespace RepositoryPattern.Web.Controllers; + +public class ProductsController(ProductService productService) : Controller +{ + private readonly ProductService _productService = productService; + + public async Task Index(CancellationToken cancellationToken) + { + const int lowStockThreshold = 5; + var products = await _productService.GetProductsAsync(cancellationToken); + var lowStock = await _productService.GetLowStockAsync(lowStockThreshold, cancellationToken); + + return View(new ProductListViewModel(products, lowStock, lowStockThreshold)); + } + + // remaining CRUD actions call through ProductService in the same way +} +``` + +The controller never reaches for `AppDbContext`. Every operation travels through the service, which keeps tests simple and makes future refactors easier. + +### Dependency registration and seeding + +The last step is wiring everything up in `Program.cs`. + +```csharp +builder.Services.AddDbContext(options => + options.UseInMemoryDatabase("ProductsDb")); +builder.Services.AddScoped(typeof(IRepository<>), typeof(EfRepository<>)); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +``` + +The sample also seeds three products so the list page shows data on first run. + +Run the site with: + +```powershell +dotnet run --project RepositoryPattern.Web +``` + +## How ABP approaches the same idea + +ABP includes generic repositories by default (`IRepository`), so you often skip writing the implementation layer shown above. You inject the interface into an application service, call methods like `InsertAsync` or `CountAsync`, and ABP’s Unit of Work handles the transaction. When you need custom queries, you can still derive from `EfCoreRepository` and add them. + +For more details, check out the official ABP documentation on repositories: https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories + +### Closing note + +This setup keeps data access tidy without being heavy. Start with the generic repository, add small extensions per entity, pass everything through services, and register the dependencies once. Whether you hand-code it or let ABP supply the repository, the structure stays the same and your controllers remain clean. diff --git a/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/POST.md b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/POST.md new file mode 100644 index 0000000000..2d39bac91a --- /dev/null +++ b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/POST.md @@ -0,0 +1,302 @@ +# Where and How to Store Your BLOB Objects in .NET? + +When building modern web applications, managing [BLOBs (Binary Large Objects)](https://cloud.google.com/discover/what-is-binary-large-object-storage) such as images, videos, documents, or any other file types is a common requirement. Whether you're developing a CMS, an e-commerce platform, or almost any other kind of application, you'll eventually ask yourself: **"Where should I store these files?"** + +In this article, we'll explore different approaches to storing BLOBs in .NET applications and demonstrate how the ABP Framework simplifies this process with its flexible [BLOB Storing infrastructure](https://abp.io/docs/latest/framework/infrastructure/blob-storing). + +ABP Provides [multiple storage providers](https://abp.io/docs/latest/framework/infrastructure/blob-storing#blob-storage-providers) such as Azure, AWS, Google, Minio, Bunny etc. But for the simplicity of this article, we will only focus on the **Database Provider**, showing you how to store BLOBs in database tables step-by-step. + +## Understanding BLOB Storage Options + +Before diving into implementation details, let's understand the common approaches for storing BLOBs in .NET applications. Mainly, there are three main approaches: + +1. Database Storage +2. File System Storage +3. Cloud Storage + +### 1. Database Storage + +The first approach is to store BLOBs directly in the database alongside your relational data (_you can also store them separately_). This approach uses columns with types like `VARBINARY(MAX)` in SQL Server or `BYTEA` in PostgreSQL. + +**Pros:** +- ✅ Transactional consistency between files and related data +- ✅ Simplified backup and restore operations (everything in one place) +- ✅ No additional file system permissions or management needed + +**Cons:** +- ❌ Database size can grow significantly with large files +- ❌ Potential performance impact on database operations +- ❌ May require additional database tuning and optimization +- ❌ Increased backup size and duration + +### 2. File System Storage + +The second obvious approach is to store BLOBs as physical files in the server's file system. This approach is simple and easy to implement. Also, it's possible to use these two approaches together and keep the metadata and file references in the database. + +**Pros:** +- ✅ Better performance for large files +- ✅ Reduced database size and improved database performance +- ✅ Easier to leverage CDNs and file servers +- ✅ Simple to implement file system-level operations (compression, deduplication) + +**Cons:** +- ❌ Requires separate backup strategy for files +- ❌ Need to manage file system permissions +- ❌ Potential synchronization issues in distributed environments +- ❌ More complex cleanup operations for orphaned files + +### 3. Cloud Storage (Azure, AWS S3, etc.) + +The third approach can be using cloud storage services for scalability and global distribution. This approach is powerful and scalable. But it's also more complex to implement and manage. + +**Best for:** +- Large-scale applications +- Multi-region deployments +- Content delivery requirements + +## ABP Framework's BLOB Storage Infrastructure + +The ABP Framework provides an abstraction layer over different storage providers, allowing you to switch between them with minimal code changes. This is achieved through the **IBlobContainer** (and `IBlobContainer`) service and various provider implementations. + +> ABP provides several built-in providers, which you can see the full list [here](https://abp.io/docs/latest/framework/infrastructure/blob-storing#blob-storage-providers). + +Let's see how to use the Database provider in your application step by step. + +### Demo: Storing BLOBs in Database in an ABP-Based Application + +In this demo, we'll walk through a practical example of storing BLOBs in a database using ABP's BLOB Storing infrastructure. We'll focus on the backend implementation using the `IBlobContainer` service and examine the database structure that ABP creates automatically. The UI framework choice doesn't matter for this demonstration, as we're concentrating on the core BLOB storage functionality. + +If you don't have an ABP application yet, create one using the ABP CLI: + +```bash +abp new BlobStoringDemo +``` + +This command generates a new ABP layered application named `BlobStoringDemo` with **MVC** as the default UI and **SQL Server** as the default database provider. + +#### Understanding the Database Provider Setup + +When you create a layered ABP application, it automatically includes the BLOB Storing infrastructure with the Database Provider pre-configured. You can verify this by examining the module dependencies in your `*Domain`, `*DomainShared`, and `*EntityFrameworkCore` modules: + +```csharp +[DependsOn( + //... + typeof(BlobStoringDatabaseDomainModule) // <-- This is the Database Provider + )] +public class BlobStoringDemoDomainModule : AbpModule +{ + //... +} +``` + +Since the Database Provider is already included through module dependencies, no additional configuration is required to start using it. The provider is ready to use out of the box. + +However, if you're working with multiple BLOB storage providers or want to explicitly configure the Database Provider, you can add the following configuration to your `*EntityFrameworkCore` module's `ConfigureServices` method: + +```csharp +Configure(options => +{ + options.Containers.ConfigureDefault(container => + { + container.UseDatabase(); + }); +}); +``` + +> **Note:** This explicit configuration is optional when using only one BLOB provider (Database Provider in this case), but becomes necessary when managing multiple providers or custom container configurations. + +#### Running Database Migrations + +Now, let's apply the database migrations to create the necessary BLOB storage tables. Run the `DbMigrator` project: + +```bash +cd src/BlobStoringDemo.DbMigrator +dotnet run +``` + +Once the migration completes successfully, open your database management tool and you'll see two new tables: + +![](blob-tables.png) + +**Understanding the BLOB Storage Tables:** + +- **`AbpBlobContainers`**: Stores metadata about BLOB containers, including container names, tenant information, and any custom properties. + +- **`AbpBlobs`**: Stores the actual BLOB content (the binary data) along with references to their parent containers. Each BLOB is associated with a container through a foreign key relationship. + +When you save a BLOB, ABP automatically handles the database operations: the binary content goes into `AbpBlobs`, while the container configuration and metadata are managed in `AbpBlobContainers`. + +#### Creating a File Management Service + +Let's implement a practical application service that demonstrates common BLOB operations. Create a new application service class: + +```csharp +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.BlobStoring; + +namespace BlobStoringDemo +{ + public class FileAppService : ApplicationService, IFileAppService + { + private readonly IBlobContainer _blobContainer; + + public FileAppService(IBlobContainer blobContainer) + { + _blobContainer = blobContainer; + } + + public async Task SaveFileAsync(string fileName, byte[] fileContent) + { + // Save the file + await _blobContainer.SaveAsync(fileName, fileContent); + } + + public async Task GetFileAsync(string fileName) + { + // Get the file + return await _blobContainer.GetAllBytesAsync(fileName); + } + + public async Task FileExistsAsync(string fileName) + { + // Check if file exists + return await _blobContainer.ExistsAsync(fileName); + } + + public async Task DeleteFileAsync(string fileName) + { + // Delete the file + await _blobContainer.DeleteAsync(fileName); + } + } +} +``` + +Here, we are doing the followings: + +- Injecting the `IBlobContainer` service. +- Saving the BLOB data to the database with the `SaveAsync` method. (_it allows you to use byte arrays or streams_) +- Retrieving the BLOB data from the database with the `GetAllBytesAsync` method. +- Checking if the BLOB exists with the `ExistsAsync` method. +- Deleting the BLOB data from the database with the `DeleteAsync` method. + +With this service in place, you can now manage BLOBs throughout your application without worrying about the underlying storage implementation. Simply inject `IFileAppService` wherever you need file operations, and ABP handles all the provider-specific details behind the scenes. + +> Also, it's good to highlight that, the beauty of this approach is **provider independence**: you can start with database storage and later switch to Azure Blob Storage, AWS S3, or any other provider without modifying a single line of your application code. We'll explore this powerful feature in the next section. + +### Switching Between Providers + +One of the biggest advantages of using ABP's BLOB Storage system is the ability to switch providers without changing your application code. + +For example, you might start with the [File System provider](https://abp.io/docs/latest/framework/infrastructure/blob-storing/file-system) during development and switch to [Azure Blob Storage](https://abp.io/docs/latest/framework/infrastructure/blob-storing/azure) for production: + +**Development:** +```csharp +Configure(options => +{ + options.Containers.ConfigureDefault(container => + { + container.UseFileSystem(fileSystem => + { + fileSystem.BasePath = Path.Combine( + hostingEnvironment.ContentRootPath, + "Documents" + ); + }); + }); +}); +``` + +**Production:** +```csharp +Configure(options => +{ + options.Containers.ConfigureDefault(container => + { + container.UseAzure(azure => + { + azure.ConnectionString = "your azure connection string"; + azure.ContainerName = "your azure container name"; + azure.CreateContainerIfNotExists = true; + }); + }); +}); +``` + +**Your application code remains unchanged!** You just need to install the appropriate package and update the configuration. You can even use pragmas (for example: `#if !DEBUG`) to switch the provider at runtime (or use similar techniques). + +### Using Named BLOB Containers + +ABP allows you to define multiple BLOB containers with different configurations. This is useful when you need to store different types of files using different providers. Here are the steps to implement it: + +#### Step 1: Define a BLOB Container + +```csharp +[BlobContainerName("profile-pictures")] +public class ProfilePictureContainer +{ +} + +[BlobContainerName("documents")] +public class DocumentContainer +{ +} +``` + +#### Step 2: Configure Different Providers for Each Container + +```csharp +Configure(options => +{ + // Profile pictures stored in database + options.Containers.Configure(container => + { + container.UseDatabase(); + }); + + // Documents stored in file system + options.Containers.Configure(container => + { + container.UseFileSystem(fileSystem => + { + fileSystem.BasePath = Path.Combine( + hostingEnvironment.ContentRootPath, + "Documents" + ); + }); + }); +}); +``` + +#### Step 3: Use the Named Containers + +Once you have defined the BLOB Containers, you can use the `IBlobContainer` service to access the BLOB containers: + +```csharp +public class ProfileService : ApplicationService +{ + private readonly IBlobContainer _profilePictureContainer; + + public ProfileService(IBlobContainer profilePictureContainer) + { + _profilePictureContainer = profilePictureContainer; + } + + public async Task UpdateProfilePictureAsync(Guid userId, byte[] picture) + { + var blobName = $"{userId}.jpg"; + await _profilePictureContainer.SaveAsync(blobName, picture); + } +} +``` + +With this approach, your documents and profile pictures are stored in different containers and different providers. This is useful when you need to store different types of files using different providers and need scalability and performance. + +## Conclusion + +Managing BLOBs effectively is crucial for modern applications, and choosing the right storage approach depends on your specific needs. + +ABP's BLOB Storing infrastructure provides a powerful abstraction that lets you start with one provider and switch to another as your requirements evolve, all without changing your application code. + +Whether you're storing files in a database, file system, or cloud storage, ABP's BLOB Storing system provides a flexible and powerful way to manage your files. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/blob-tables.png b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/blob-tables.png new file mode 100644 index 0000000000..01ec3cfa08 Binary files /dev/null and b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/blob-tables.png differ diff --git a/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/cover-image.png b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/cover-image.png new file mode 100644 index 0000000000..b79b298b25 Binary files /dev/null and b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/article.md b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/article.md new file mode 100644 index 0000000000..57660aa038 --- /dev/null +++ b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/article.md @@ -0,0 +1,371 @@ +# Why Do You Need Distributed Locking in ASP.NET Core + +## Introduction + +In modern distributed systems, synchronizing access to common resources among numerous instances is a critical problem. Whenever lots of servers or processes concurrently attempt to update the same resource simultaneously, race conditions can lead to data corruption, redundant work, and inconsistent state. Throughout the implementation of the ABP framework, we encountered and overcame this exact same problem with assistance from a stable distributed locking mechanism. In this post, we will present our experience and learnings when implementing this solution, so you can understand when and why you would need distributed locking in your ASP.NET Core applications. + +## Problem + +Suppose you are running an e-commerce application deployed on multiple servers for high availability. A customer places an order, which kicks off a background job that reserves inventory and charges payment. If not properly synchronized, the following is what can happen: + +### Race Conditions in Multi-Instance Deployments + +When your ASP.NET Core application is scaled horizontally with multiple instances, each instance works independently. If two instances simultaneously perform the same operation—like deducting inventory, generating invoice numbers, or processing a refund—you can end up with: + +- **Duplicate operations**: The same payment processed twice +- **Data inconsistency**: Inventory count becomes negative or incorrect +- **Lost updates**: One instance's changes overwrite another's +- **Sequential ID conflicts**: Two instances generate the same invoice number + +### Background Job Processing + +Background work libraries like Quartz.NET or Hangfire usually run on multiple workers. Without distributed locking: + +- Multiple workers can choose the same task +- Long-running processes can be executed parallel when they should be executed in a sequence +- Jobs that depend on exclusive resource access can corrupt shared data + +### Cache Invalidation and Refresh + +When distributed caching is employed, there can be multiple instances that simultaneously identify a cache miss and attempt to rebuild the cache, leading to: + +- High database load owing to concurrent rebuild cache requests +- Race conditions under which older data overrides newer data +- wasted computational resources + +### Rate Limiting and Throttling + +Enforcing rate limits across multiple instances of the application requires coordination. If there is no distributed locking, each instance has its own limits, and global rate limits cannot be enforced properly. + +The root issue is simple: **the default C# locking APIs (lock, SemaphoreSlim, Monitor) work within a process in isolation**. They will not assist with distributed cases where coordination must take place across servers, containers, or cloud instances. + +## Solutions + +Several approaches exist for implementing distributed locking in ASP.NET Core applications. Let's explore the most common solutions, their trade-offs, and why we chose our approach for ABP. + +### 1. Database-Based Locking + +Using your existing database to place locks by inserting or updating rows with distinctive values. + +**Pros:** +- No additional infrastructure required +- Works with any relational database +- Transactions provide ACID guarantees + +**Cons:** +- Database round-trip performance overhead +- Can lead to database contention under high load +- Must be controlled to prevent orphaned locks +- Not suited for high-frequency locking scenarios + +**When to use:** Small-scale applications where you do not wish to add additional infrastructure, and lock operations are low frequency. + +### 2. Redis-Based Locking + +Redis has atomic operations that make it excellent at distributed locking, using commands such as `SET NX` (set if not exists) with expiration. +**Pros:** + +- Low latency and high performance +- Expiration prevents lost locks built-in +- Well-established with tested patterns (Redlock algorithm) +- Works well for high-throughput use cases +**Cons:** + +- Requires Redis infrastructure +- Network partitions might be an issue +- One Redis instance is a single point of failure (although Redis Cluster reduces it) +**Resources:** + +- [Redis Distributed Locks Documentation](https://redis.io/docs/manual/patterns/distributed-locks/) +- [Redlock Algorithm](https://redis.io/topics/distlock) +**When to use:** Production applications with multiple instances where performance is critical, especially if you are already using Redis as a caching layer. + +### 3. Azure Blob Storage Leases + +Azure Blob Storage offers lease functionality which can be utilized for distributed locks. + +**Pros:** +- Part of Azure, no extra infrastructure +- Lease expiration automatically +- Low-frequency locks are economically viable + +**Cons:** +- Azure-specific, not portable +- Latency greater than Redis +- Azure cloud-only projects + +**When to use:** Azure-native applications with low-locking frequency where you need to minimize moving parts. + +### 4. etcd or ZooKeeper + +Distributed coordination services designed from scratch to accommodate consensus and locking. + +**Pros:** +- Designed for distributed coordination +- Strong consistency guaranteed +- Robust against network partitions + +**Cons:** +- Difficulty in setting up the infrastructure +- Excess baggage for most applications +- Steep learning curve + +**Use when:** Large distributed systems with complex coordination require more than basic locking. + + +### Our Choice: Abstraction with Multiple Implementations + +For ABP, we chose to use an **abstraction layer** with support for multibackend. This provides flexibility to the developers so that they can choose the best implementation depending on their infrastructure. Our default implementations include support for: + +- **Redis** (recommended for most scenarios) +- **Database-based locking** (for less complicated configurations) +- In-memory single-instance and development locks + +We started with Redis because it offers the best tradeoff between ease of operation, reliability, and performance for distributed cases. But abstraction prevents applications from becoming technology-dependent, and it's easier to start simple and expand as needed. + +## Implementation + +Let's implement a simplified distributed locking mechanism using Redis and StackExchange.Redis. This example shows the core concepts without ABP's framework complexity. + +First, install the required package: + +```bash +dotnet add package StackExchange.Redis +``` + +Here's a basic distributed lock implementation: + +```csharp +public interface IDistributedLock +{ + Task TryAcquireAsync( + string resource, + TimeSpan expirationTime, + CancellationToken cancellationToken = default); +} + +public class RedisDistributedLock : IDistributedLock +{ + private readonly IConnectionMultiplexer _redis; + private readonly ILogger _logger; + + public RedisDistributedLock( + IConnectionMultiplexer redis, + ILogger logger) + { + _redis = redis; + _logger = logger; + } + + public async Task TryAcquireAsync( + string resource, + TimeSpan expirationTime, + CancellationToken cancellationToken = default) + { + var db = _redis.GetDatabase(); + var lockKey = $"lock:{resource}"; + var lockValue = Guid.NewGuid().ToString(); + + // Try to acquire the lock using SET NX with expiration + var acquired = await db.StringSetAsync( + lockKey, + lockValue, + expirationTime, + When.NotExists); + + if (!acquired) + { + _logger.LogDebug( + "Failed to acquire lock for resource: {Resource}", + resource); + return null; + } + + _logger.LogDebug( + "Lock acquired for resource: {Resource}", + resource); + + return new RedisLockHandle(db, lockKey, lockValue, _logger); + } + + private class RedisLockHandle : IDisposable + { + private readonly IDatabase _db; + private readonly string _lockKey; + private readonly string _lockValue; + private readonly ILogger _logger; + private bool _disposed; + + public RedisLockHandle( + IDatabase db, + string lockKey, + string lockValue, + ILogger logger) + { + _db = db; + _lockKey = lockKey; + _lockValue = lockValue; + _logger = logger; + } + + public void Dispose() + { + if (_disposed) return; + + try + { + // Only delete if we still own the lock + var script = @" + if redis.call('get', KEYS[1]) == ARGV[1] then + return redis.call('del', KEYS[1]) + else + return 0 + end"; + + _db.ScriptEvaluate( + script, + new RedisKey[] { _lockKey }, + new RedisValue[] { _lockValue }); + + _logger.LogDebug("Lock released for key: {LockKey}", _lockKey); + } + catch (Exception ex) + { + _logger.LogError( + ex, + "Error releasing lock for key: {LockKey}", + _lockKey); + } + finally + { + _disposed = true; + } + } + } +} +``` + +Register the service in your `Program.cs`: + +```csharp +builder.Services.AddSingleton(sp => +{ + var configuration = ConfigurationOptions.Parse("localhost:6379"); + return ConnectionMultiplexer.Connect(configuration); +}); + +builder.Services.AddSingleton(); +``` + +Now you can use distributed locking in your services: + +```csharp +public class OrderService +{ + private readonly IDistributedLock _distributedLock; + private readonly ILogger _logger; + + public OrderService( + IDistributedLock distributedLock, + ILogger logger) + { + _distributedLock = distributedLock; + _logger = logger; + } + + public async Task ProcessOrderAsync(string orderId) + { + var lockResource = $"order:{orderId}"; + + // Try to acquire the lock with 30-second expiration + await using var lockHandle = await _distributedLock.TryAcquireAsync( + lockResource, + TimeSpan.FromSeconds(30)); + + if (lockHandle == null) + { + _logger.LogWarning( + "Could not acquire lock for order {OrderId}. " + + "Another process might be processing it.", + orderId); + return; + } + + // Critical section - only one instance will execute this + _logger.LogInformation("Processing order {OrderId}", orderId); + + // Your order processing logic here + await Task.Delay(1000); // Simulating work + + _logger.LogInformation( + "Order {OrderId} processed successfully", + orderId); + + // Lock is automatically released when lockHandle is disposed + } +} +``` + +### Key Implementation Details + +**Lock Key Uniqueness**: Use hierarchical, descriptive keys (`order:12345`, `inventory:product-456`) to avoid collisions. + +**Lock Value**: We use a single distinct GUID as the lock value. This ensures only the lock owner can release it, excluding unintentional deletion by expired locks or other operations. + +**Automatic Expiration**: Always provide an expiration time to prevent deadlocks when a process halts with an outstanding lock. + +**Lua Script for Release**: Releasing uses a Lua script to atomically check ownership and delete the key. This prevents releasing a lock that has already timed out and is reacquired by another process. + +**Disposal Pattern**: With `IDisposable` and `await using`, one ensures that the lock is released regardless of the exception that occurs. + +### Handling Lock Acquisition Failures + +Depending on your use case, you have several options when lock acquisition fails: + +```csharp +// Option 1: Return early (shown above) +if (lockHandle == null) +{ + return; +} + +// Option 2: Retry with timeout +var retryCount = 0; +var maxRetries = 3; +IDisposable? lockHandle = null; + +while (lockHandle == null && retryCount < maxRetries) +{ + lockHandle = await _distributedLock.TryAcquireAsync( + lockResource, + TimeSpan.FromSeconds(30)); + + if (lockHandle == null) + { + retryCount++; + await Task.Delay(TimeSpan.FromMilliseconds(100 * retryCount)); + } +} + +if (lockHandle == null) +{ + throw new InvalidOperationException("Could not acquire lock after retries"); +} + +// Option 3: Queue for later processing +if (lockHandle == null) +{ + await _queueService.EnqueueForLaterAsync(orderId); + return; +} +``` + +This is a good foundation for distributed locking in ASP.NET Core applications. It addresses the most common scenarios and edge cases, but production can call for more sophisticated features like lock re-renewal for long-running operations or more sophisticated retry logic. + +## Conclusion + +Distributed locking is a necessity for data consistency and prevention of race conditions in new, scalable ASP.NET Core applications. As we've discussed, the problem becomes unavoidable as soon as you move beyond single-instance deployments to horizontally scaled multi-server, container, or background job worker deployments. + +We examined several of them, from database-level locks to Redis, Azure Blob Storage leases, and coordination services. Each has its place, but Redis-based locking offers the best balance of performance, reliability, and ease in most situations. The example implementation we provided shows how to implement a well-crafted distributed locking mechanism with minimal dependence on other libraries. + +Whether you implement your own solution or utilize a framework like ABP, familiarity with the concepts of distributed locking will help you build more stable and scalable applications. We hope by sharing our experience, we can keep you from falling into typical pitfalls and have distributed locking properly implemented on your own projects. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/cover.png b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/cover.png new file mode 100644 index 0000000000..a8bb941717 Binary files /dev/null and b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/cover.png differ diff --git a/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/Post.md b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/Post.md new file mode 100644 index 0000000000..678adc1ba5 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/Post.md @@ -0,0 +1,108 @@ +# You May Have Trouble with GUIDs: Generating Sequential GUIDs in .NET + + +If you’ve ever shoved a bunch of `Guid.NewGuid()` values into a SQL Server table with a clustered index on the PK, you’ve probably felt the pain: **Index fragmentation so bad you could use it as modern art.** Inserts slow down, page splits go wild, and your DBA starts sending you passive-aggressive Slack messages. + +And yet… we keep doing it. Why? Because GUIDs are _easy_. They’re globally unique, they don’t need a round trip to the DB, and they make distributed systems happy. But here’s the catch: **random GUIDs are absolute chaos for ordered indexes**. + +## The Problem with Vanilla GUIDs + +* **Randomness kills order** — clustered indexes thrive on sequential inserts; random GUIDs force constant reordering. + +* **Performance hit** — every insert can trigger page splits and index reshuffling. + +* **Storage bloat** — fragmentation means wasted space and slower reads. + +Sure, you could switch to int or long identity columns, but then you lose the distributed generation magic and security benefits (predictable IDs are guessable). + +## Sequential GUIDs to the Rescue + +Sequential GUIDs keep the uniqueness but add a predictable ordering component, usually by embedding a timestamp in part of the GUID. This means: + +* Inserts happen at the “end” of the index, not all over the place. + +* Fragmentation drops dramatically. + +* You still get globally unique IDs without DB trips. + +Think of it as **GUIDs with manners**. + +## ABP Framework’s Secret Sauce + + +Here’s where ABP Framework flexes: it **uses sequential GUIDs by default** for entity IDs. No ceremony, no “remember to call this helper method”, it’s baked in. + +Under the hood: + +* ABP ships with IGuidGenerator (default: SequentialGuidGenerator). + +* It picks the right sequential strategy for your DB provider: + + * **SequentialAtEnd** → SQL Server + + * **SequentialAsString** → MySQL/PostgreSQL + + * **SequentialAsBinary** → Oracle + +* EF Core integration packages auto-configure this, so you rarely need to touch it. + +Example in ABP: + +```csharp +public class MyProductService : ITransientDependency +{ + private readonly IRepository _productRepository; + private readonly IGuidGenerator _guidGenerator; + + + public MyProductService( + IRepository productRepository, + IGuidGenerator guidGenerator) + { + _productRepository = productRepository; + _guidGenerator = guidGenerator; + } + + + public async Task CreateAsync(string productName) + { + var product = new Product(_guidGenerator.Create(), productName); + await _productRepository.InsertAsync(product); + } +} +``` + +No `Guid.NewGuid()` here, `_guidGenerator.Create()` gives you a sequential GUID every time. + +## Benefits of Sequential GUIDs + +Let’s say you’re inserting 1M rows into a table with a clustered primary key: + +* **Random GUIDs** → fragmentation ~99%, insert throughput tanks. + +* **Sequential GUIDs** → fragmentation stays low, inserts fly. + +In high-volume systems, this difference is **not** academic, it’s the difference between smooth scaling and spending weekends rebuilding indexes. + +## When to Use Sequential GUIDs + +* **Distributed systems** that still want DB-friendly inserts. + +* **High-write workloads** with clustered indexes on GUID PKs. + +* **Multi-tenant apps** where IDs need to be unique across tenants. + +## When Random GUIDs Still Make Sense + +* Security through obscurity, if you don’t want IDs to hint at creation order. + +* Non-indexed identifiers, fragmentation isn’t a concern. + +## The Final Take + +ABP’s default sequential GUID generation is one of those “**small but huge**” features. It’s the kind of thing you don’t notice until you benchmark, and then you wonder why you ever lived without it. + +## Links +You may want to check the following references to learn more about sequential GUIDs: + +- [ABP Framework Documentation: Sequential GUIDs](https://docs.abp.io/en/abp/latest/Guid-Generation) \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/cover-image.png b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/cover-image.png new file mode 100644 index 0000000000..e2a1fdc9bb Binary files /dev/null and b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-10-03-Native-AOT/Cover.png b/docs/en/Community-Articles/2025-10-03-Native-AOT/Cover.png new file mode 100644 index 0000000000..ed5653d015 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-03-Native-AOT/Cover.png differ diff --git a/docs/en/Community-Articles/2025-10-03-Native-AOT/Post.md b/docs/en/Community-Articles/2025-10-03-Native-AOT/Post.md new file mode 100644 index 0000000000..84d5a7435e --- /dev/null +++ b/docs/en/Community-Articles/2025-10-03-Native-AOT/Post.md @@ -0,0 +1,72 @@ +# Native AOT: How to Fasten Startup Time and Memory Footprint + +So since .NET 8 there's been one feature that’s quietly a game-changer for performance nerds is **Native AOT** (Ahead-of-Time compilation). If you’ve ever fought with sluggish cold starts (especially in containerized or serverless environments), or dealt with memory pressure from bloated apps, Native AOT might just be your new best friend. + +------ + +## What is Native AOT? + +Normally, .NET apps ship as IL (*Intermediate Language*) and JIT-compile at runtime. That’s flexible, but it takes longer startup time and memory. +Native AOT flips the script: your app gets compiled straight into a platform-specific binary *before it ever runs*. + +As a result; + +- No JIT overhead at startup. +- Smaller memory footprint (no JIT engine or IL sitting around). +- Faster startup (especially noticeable in microservices, functions, or CLI tools). + +------ + +## Advantages of AOT + +- **Broader support** → More workloads and libraries now play nice witt.h AOT. +- **Smaller output sizes** → Trimmed down runtime dependencies. +- **Better diagnostics** → Easier to figure out why your build blew up (because yes, AOT can be picky). +- **ASP.NET Core AOT** → Minimal APIs and gRPC services actually *benefit massively* here. Cold starts are crazy fast. + +------ + +## Why you should care + +If you’re building: + +- **Serverless apps (AWS Lambda, Azure Functions, GCP Cloud Run)** → Startup time matters a LOT. +- **Microservices** → Lightweight services scale better when they use less memory per pod. +- **CLI tools** → No one likes waiting half a second for a tool to boot. AOT makes them feel “native” (because they literally are). + +And yeah, you *can* get Go-like startup performance in .NET now. + +------ + +## The trade-offs (because nothing’s free) + +Native AOT isn’t a silver bullet: + +- Build times are longer (the compiler does all the heavy lifting upfront). +- Less runtime flexibility (no reflection-based magic, dynamic codegen, or IL rewriting). +- Debugging can be trickier. + +Basically: if you rely heavily on reflection-heavy libs or dynamic runtime stuff, expect pain. + +------ + +## Quick demo (conceptual) + +```bash +# Regular publish +dotnet publish -c Release + +# Native AOT publish +dotnet publish -c Release -r win-x64 -p:PublishAot=true +``` + +Boom. You get a native executable. On Linux, drop it into a container and watch that startup time drop like a rock. + +------ + +### Conclusion + +- Native AOT in .NET 8 = faster cold starts + lower memory usage. +- Perfect for microservices, serverless, and CLI apps. +- Comes with trade-offs (longer builds, less dynamic flexibility). +- If performance is critical, it’s absolutely worth testing. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/form.png b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/form.png new file mode 100644 index 0000000000..e84188c60d Binary files /dev/null and b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/form.png differ diff --git a/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/post.md b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/post.md new file mode 100644 index 0000000000..5674ab422a --- /dev/null +++ b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/post.md @@ -0,0 +1,561 @@ +# Building Dynamic Forms in Angular for Enterprise Applications + +## Introduction + +Dynamic forms are useful for enterprise applications where form structures need to be flexible, configurable, and generated at runtime based on business requirements. This approach allows developers to create forms from configuration objects rather than hardcoding them, enabling greater flexibility and maintainability. + +## Benefits + +1. **Flexibility**: Forms can be easily modified without changing the code. +2. **Reusability**: Form components can be shared across components. +3. **Maintainability**: Changes to form structures can be managed through configuration files or databases. +4. **Scalability**: New form fields and types can be added without significant code changes. +4. **User Experience**: Dynamic forms can adapt to user roles and permissions, providing a tailored experience. + +## Architecture + +### 1. Defining Form Configuration Models + +We will define form configuration model as a first step. This models stores field types, labels, validation rules, and other metadata. + +#### 1.1. Form Field Configuration +Form field configuration interface represents individual form fields and contains properties like type, label, validation rules and conditional logic. +```typescript +export interface FormFieldConfig { + key: string; + value?: any; + type: 'text' | 'email' | 'number' | 'select' | 'checkbox' | 'date' | 'textarea'; + label: string; + placeholder?: string; + required?: boolean; + disabled?: boolean; + options?: { key: string; value: any }[]; + validators?: ValidatorConfig[]; // Custom validators + conditionalLogic?: ConditionalRule[]; // For showing/hiding fields based on other field values + order?: number; // For ordering fields in the form + gridSize?: number; // For layout purposes, e.g., Bootstrap grid size (1-12) +} +``` +#### 1.2. Validator Configuration + +Validator configuration interface defines validation rules for form fields. +```typescript +export interface ValidatorConfig { + type: 'required' | 'email' | 'minLength' | 'maxLength' | 'pattern' | 'custom'; + value?: any; + message: string; +} +``` + +#### 1.3. Conditional Logic + +Conditional logic interface defines rules for showing/hiding or enabling/disabling fields based on other field values. +```typescript +export interface ConditionalRule { + dependsOn: string; + condition: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan'; + value: any; + action: 'show' | 'hide' | 'enable' | 'disable'; +} +``` + +### 2. Dynamic Form Service + +We will create dynamic form service to handle form creation and validation processes. + +```typescript +@Injectable({ + providedIn: 'root' +}) +export class DynamicFormService { + + // Create form group based on fields + createFormGroup(fields: FormFieldConfig[]): FormGroup { + const group: any = {}; + + fields.forEach(field => { + const validators = this.buildValidators(field.validators || []); + const initialValue = this.getInitialValue(field); + + group[field.key] = new FormControl({ + value: initialValue, + disabled: field.disabled || false + }, validators); + }); + + return new FormGroup(group); + } + + // Returns an array of form field validators based on the validator configurations + private buildValidators(validatorConfigs: ValidatorConfig[]): ValidatorFn[] { + return validatorConfigs.map(config => { + switch (config.type) { + case 'required': + return Validators.required; + case 'email': + return Validators.email; + case 'minLength': + return Validators.minLength(config.value); + case 'maxLength': + return Validators.maxLength(config.value); + case 'pattern': + return Validators.pattern(config.value); + default: + return Validators.nullValidator; + } + }); + } + + private getInitialValue(field: FormFieldConfig): any { + switch (field.type) { + case 'checkbox': + return false; + case 'number': + return 0; + default: + return ''; + } + } +} + +``` + +### 3. Dynamic Form Component + +The main component that renders the form based on the configuration it receives as input. +```typescript +@Component({ + selector: 'app-dynamic-form', + template: ` +
+ @for (field of sortedFields; track field.key) { +
+
+ + +
+
+ } +
+ + +
+
+ `, + styles: [` + .dynamic-form { + display: flex; + gap: 0.5rem; + flex-direction: column; + } + .form-actions { + display: flex; + justify-content: flex-end; + gap: 0.5rem; + } + `], + imports: [ReactiveFormsModule, CommonModule, DynamicFormFieldComponent], +}) +export class DynamicFormComponent implements OnInit { + fields = input([]); + submitButtonText = input('Submit'); + formSubmit = output(); + formCancel = output(); + private dynamicFormService = inject(DynamicFormService); + + dynamicForm!: FormGroup; + isSubmitting = false; + fieldVisibility: { [key: string]: boolean } = {}; + + ngOnInit() { + this.dynamicForm = this.dynamicFormService.createFormGroup(this.fields()); + this.initializeFieldVisibility(); + this.setupConditionalLogic(); + } + + get sortedFields(): FormFieldConfig[] { + return this.fields().sort((a, b) => (a.order || 0) - (b.order || 0)); + } + + onSubmit() { + if (this.dynamicForm.valid) { + this.isSubmitting = true; + this.formSubmit.emit(this.dynamicForm.value); + } else { + this.markAllFieldsAsTouched(); + } + } + + onCancel() { + this.formCancel.emit(); + } + + onFieldChange(event: { fieldKey: string; value: any }) { + this.evaluateConditionalLogic(event.fieldKey); + } + + isFieldVisible(field: FormFieldConfig): boolean { + return this.fieldVisibility[field.key] !== false; + } + + private initializeFieldVisibility() { + this.fields().forEach(field => { + this.fieldVisibility[field.key] = !field.conditionalLogic?.length; + }); + } + + private setupConditionalLogic() { + this.fields().forEach(field => { + if (field.conditionalLogic) { + field.conditionalLogic.forEach(rule => { + const dependentControl = this.dynamicForm.get(rule.dependsOn); + if (dependentControl) { + dependentControl.valueChanges.subscribe(() => { + this.evaluateConditionalLogic(field.key); + }); + } + }); + } + }); + } + + private evaluateConditionalLogic(fieldKey: string) { + const field = this.fields().find(f => f.key === fieldKey); + if (!field?.conditionalLogic) return; + + field.conditionalLogic.forEach(rule => { + const dependentValue = this.dynamicForm.get(rule.dependsOn)?.value; + const conditionMet = this.evaluateCondition(dependentValue, rule.condition, rule.value); + + this.applyConditionalAction(fieldKey, rule.action, conditionMet); + }); + } + + private evaluateCondition(fieldValue: any, condition: string, ruleValue: any): boolean { + switch (condition) { + case 'equals': + return fieldValue === ruleValue; + case 'notEquals': + return fieldValue !== ruleValue; + case 'contains': + return fieldValue && fieldValue.includes && fieldValue.includes(ruleValue); + case 'greaterThan': + return Number(fieldValue) > Number(ruleValue); + case 'lessThan': + return Number(fieldValue) < Number(ruleValue); + default: + return false; + } + } + + private applyConditionalAction(fieldKey: string, action: string, shouldApply: boolean) { + const control = this.dynamicForm.get(fieldKey); + + switch (action) { + case 'show': + this.fieldVisibility[fieldKey] = shouldApply; + break; + case 'hide': + this.fieldVisibility[fieldKey] = !shouldApply; + break; + case 'enable': + if (control) { + shouldApply ? control.enable() : control.disable(); + } + break; + case 'disable': + if (control) { + shouldApply ? control.disable() : control.enable(); + } + break; + } + } + + private markAllFieldsAsTouched() { + Object.keys(this.dynamicForm.controls).forEach(key => { + this.dynamicForm.get(key)?.markAsTouched(); + }); + } +} +``` + +### 4. Dynamic Form Field Component + +This component renders individual form fields, handling different types and validation messages based on the configuration. +```typescript +@Component({ + selector: 'app-dynamic-form-field', + template: ` + @if (isVisible) { +
+ + @if (field.type === 'text') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'select') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'checkbox') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'email') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'textarea') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } +
+ + } + `, + imports: [ReactiveFormsModule], +}) +export class DynamicFormFieldComponent implements OnInit { + @Input() field!: FormFieldConfig; + @Input() form!: FormGroup; + @Input() isVisible: boolean = true; + @Output() fieldChange = new EventEmitter<{ fieldKey: string; value: any }>(); + + ngOnInit() { + const control = this.form.get(this.field.key); + if (control) { + control.valueChanges.subscribe(value => { + this.fieldChange.emit({ fieldKey: this.field.key, value }); + }); + } + } + + isFieldInvalid(): boolean { + const control = this.form.get(this.field.key); + return !!(control && control.invalid && (control.dirty || control.touched)); + } + + getErrorMessage(): string { + const control = this.form.get(this.field.key); + if (!control || !control.errors) return ''; + + const validators = this.field.validators || []; + + for (const validator of validators) { + if (control.errors[validator.type]) { + return validator.message; + } + } + + // Fallback error messages + if (control.errors['required']) return `${this.field.label} is required`; + if (control.errors['email']) return 'Please enter a valid email address'; + if (control.errors['minlength']) return `Minimum length is ${control.errors['minlength'].requiredLength}`; + if (control.errors['maxlength']) return `Maximum length is ${control.errors['maxlength'].requiredLength}`; + + return 'Invalid input'; + } +} + +``` + +### 5. Usage Example + +```typescript + +@Component({ + selector: 'app-home', + template: ` +
+
+ + +
+
+ `, + imports: [DynamicFormComponent] +}) +export class HomeComponent { + @Input() title: string = 'Home Component'; + formFields: FormFieldConfig[] = [ + { + key: 'firstName', + type: 'text', + label: 'First Name', + placeholder: 'Enter first name', + required: true, + validators: [ + { type: 'required', message: 'First name is required' }, + { type: 'minLength', value: 2, message: 'Minimum 2 characters required' } + ], + gridSize: 12, + order: 1 + }, + { + key: 'lastName', + type: 'text', + label: 'Last Name', + placeholder: 'Enter last name', + required: true, + validators: [ + { type: 'required', message: 'Last name is required' } + ], + gridSize: 12, + order: 2 + }, + { + key: 'email', + type: 'email', + label: 'Email Address', + placeholder: 'Enter email', + required: true, + validators: [ + { type: 'required', message: 'Email is required' }, + { type: 'email', message: 'Please enter a valid email' } + ], + order: 3 + }, + { + key: 'userType', + type: 'select', + label: 'User Type', + required: true, + options: [ + { key: 'admin', value: 'Administrator' }, + { key: 'user', value: 'Regular User' }, + { key: 'guest', value: 'Guest User' } + ], + validators: [ + { type: 'required', message: 'Please select user type' } + ], + order: 4 + }, + { + key: 'adminNotes', + type: 'textarea', + label: 'Admin Notes', + placeholder: 'Enter admin-specific notes', + conditionalLogic: [ + { + dependsOn: 'userType', + condition: 'equals', + value: 'admin', + action: 'show' + } + ], + order: 5 + } + ]; + + onSubmit(formData: any) { + console.log('Form submitted:', formData); + // Handle form submission + } + + onCancel() { + console.log('Form cancelled'); + // Handle form cancellation + } +} + + +``` + +## Result + +![example_form](./form.png) + +## Conclusion + +These kinds of components are essential for large applications because they allow for rapid development and easy maintenance. By defining forms through configuration, developers can quickly adapt to changing requirements without extensive code changes. This approach also promotes consistency across the application, as the same form components can be reused in different contexts. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-07-Building-Scalable-Angular-Apps-with-Reusable-UI-Components/post.md b/docs/en/Community-Articles/2025-10-07-Building-Scalable-Angular-Apps-with-Reusable-UI-Components/post.md new file mode 100644 index 0000000000..870703d12b --- /dev/null +++ b/docs/en/Community-Articles/2025-10-07-Building-Scalable-Angular-Apps-with-Reusable-UI-Components/post.md @@ -0,0 +1,660 @@ +# Building Scalable Angular Apps with Reusable UI Components + +Frontend development keeps evolving at an incredible pace, and with every new update, our implementation standards improve as well. But even as tools and frameworks change, the core principles stay the same, and one of the most important is reusability. + +Reusability means building components and utilities that can be used in multiple places instead of using the same logic repeatedly. This approach not only saves time but also keeps your code clean, consistent, and easier to maintain as your project grows. + +Angular fully embraces this idea by offering modern features like **standalone components**, **signals**, **hybrid rendering**, and **component-level lazy loading**. + +In this article, we will explore how these features make it easier to build reusable UI components. We will also look at how to style them and organize them into shared libraries for scalable, long-term development. + +--- + +## 🧩 Breaking Down Components for True Reusability + +The first approach to make an Angular component reusable is to use standalone components. As this feature has been supported for a long time, it is now the default behavior for the latest Angular versions. Keeping that in mind, we can ensure reusability by separating a big component into smaller ones to make the small pieces usable across the application. + +Here is a quick example: + +Imagine you start with a single `UserProfileComponent` that does everything including displaying user info, recent posts, a list of friends, and even handling profile editing. + +```ts +// 📖 Compact user profile component +import { Component } from "@angular/core"; + +@Component({ + selector: "app-user-profile", + template: ` +
+
+ User avatar +

{{ user.name }}

+ +
+ +
+

Recent Posts

+
    + @for (post of user.posts; track post) { +
  • {{ post }}
  • + } +
+
+ +
+

Friends

+
    + @for (friend of user.friends; track friend) { +
  • {{ friend }}
  • + } +
+
+
+ `, +}) +export class UserProfileComponent { + user = { + name: "Jane Doe", + avatar: "/assets/avatar.png", + posts: ["Angular Tips", "Reusable Components FTW!"], + friends: ["John", "Mary", "Steve"], + }; + + editProfile() { + console.log("Editing profile..."); + } +} +``` + +Instead of this, you can create small components like these: + +- `user-avatar.component.ts` +- `user-posts.component.ts` +- `user-friends.component.ts` + +```ts +// 🧩 user-avatar.component.ts +import { Component, input } from "@angular/core"; + +@Component({ + selector: "app-user-avatar", + template: ` +
+ User avatar +

{{ name() }}

+
+ `, +}) +export class UserAvatarComponent { + name = input.required(); + avatar = input.required(); +} +``` + +```ts +// 🧩 user-posts.component.ts +import { Component, input } from "@angular/core"; + +@Component({ + selector: "app-user-posts", + template: ` +
+

Recent Posts

+
    + @for (post of posts(); track post) { +
  • {{ post }}
  • + } +
+
+ `, +}) +export class UserPostsComponent { + posts = input([]); +} +``` + +```ts +// 🧩 user-friends.component.ts +import { Component, input, output } from "@angular/core"; + +@Component({ + selector: "app-user-friends", + template: ` +
+

Friends

+
    + @for (friend of friends(); track friend) { +
  • {{ friend }}
  • + } +
+
+ `, +}) +export class UserFriendsComponent { + friends = input([]); + friendSelected = output(); + + selectFriend(friend: string) { + this.friendSelected.emit(friend); + } +} +``` + +Then, you can use them in a container component like this + +```ts +// 🧩 new user profile components that uses other user components +import { Component } from "@angular/core"; +import { signal } from "@angular/core"; +import { UserAvatarComponent } from "./user-avatar.component"; +import { UserPostsComponent } from "./user-posts.component"; +import { UserFriendsComponent } from "./user-friends.component"; + +@Component({ + selector: "app-user-profile", + imports: [UserAvatarComponent, UserPostsComponent, UserFriendsComponent], + template: ` +
+ + + +
+ `, +}) +export class UserProfileComponent { + user = signal({ + name: "Jane Doe", + avatar: "/assets/avatar.png", + posts: ["Angular Tips", "Reusable Components FTW!"], + friends: ["John", "Mary", "Steve"], + }); + + onFriendSelected(friend: string) { + console.log(`Selected friend: ${friend}`); + } +} +``` + +The most common problem of creating such components is over-creating new elements when you actually do not need them. So, it is a design decision that needs to be carefully taken while building the application. If misused, it can lead to: + +- a management nightmare +- unnecessary lifecycle hook complexity +- extra indirect data flow (makes debugging harder) + +Nevertheless, this makes the app more scalable and maintainable if correctly used. Such structure will provide: + +- a clear separation of concerns as each component will maintain decided tasks +- faster feature development +- shared libraries or elements across the application + +--- + +## 🚀 Why Standalone Components Matter + +As Angular has announced standalone components starting from version 17, they have been gradually developing features that support reusability. This important feature brings a great migration for components, directives, and pipes. + +Since it allows these elements to be used directly inside an `imports` array rather than through a module structure, it reinforces reusability patterns and simplifies management. + +Back in the module-based structure, we used to create these components and declare them in modules. This still offers some reusability, as we can import the modules where needed. However, standalone components can be consumed both by other standalone components and modules. For this reason, migrating from the module-based structure to a fully standalone architecture brings many benefits for this concern. + +--- + +## 🧠 Designing Components That Scale and Reuse Well + +The first point you need to consider here is to encapsulate and isolate logic. + +For example: + +1. This counter component isolates the concept of incrementing/decrementing so the parent component will not take care of this logic except showing the result. + + ```ts + import { Component, signal } from "@angular/core"; + + @Component({ + selector: "app-counter", + template: ` + + {{ count() }} + + `, + }) + export class CounterComponent { + private count = signal(0); // internal state + + increment() { + this.count.update((v) => v + 1); + } + decrement() { + this.count.update((v) => v - 1); + } + } + ``` + +2. This component isolates the styles and makes the badge reusable. Styles in this component will not leak out to others, and global styles will not affect it. + + ```ts + import { Component, ViewEncapsulation } from "@angular/core"; + + @Component({ + selector: "app-badge", + template: `{{ label }}`, + styles: [ + ` + .badge { + background: #007bff; + color: white; + padding: 4px 8px; + border-radius: 4px; + } + `, + ], + encapsulation: ViewEncapsulation.Emulated, // default; isolates CSS + }) + export class BadgeComponent { + label = "New"; + } + ``` + +3. The search component below is a very common example since it handles a business logic exposing simple inputs/outputs + + ```ts + import { Component, input, output } from "@angular/core"; + + @Component({ + selector: "app-search-box", + template: ` + + `, + }) + export class SearchBoxComponent { + query = input(""); + changed = output(); + + onChange(event: Event) { + const value = (event.target as HTMLInputElement).value; + this.changed.emit(value); + } + } + ``` + +Encapsulation ensures that each component manages its own logic without leaking details to the outside. By keeping behavior self-contained, components become easier to understand, test, and reuse. This isolation prevents unexpected side effects, keeps your UI predictable, and allows each component to evolve independently as your application grows. + +At this point, we can also briefly mention smart and dumb components. Smart components handle business logic, while dumb components take care of displaying data and emitting user actions. + +This separation keeps your UI structure scalable. Smart components can change how data is loaded or handled without affecting presentation components, and dumb components can be reused anywhere since they just rely on inputs and outputs. + +```ts +// smart component (container) +@Component({ + selector: "app-user-profile", + imports: [UserCardComponent], + template: ``, +}) +export class UserProfileComponent { + user = signal({ name: "Jane", role: "Admin" }); + + onSelect(user: any) { + console.log("Selected user:", user); + } +} + +// dumb component (presentation) +@Component({ + selector: "app-user-card", + standalone: true, + template: ` +
+

{{ user().name }}

+

{{ user().role }}

+
+ `, +}) +export class UserCardComponent { + user = input.required<{ name: string; role: string }>(); + select = output<{ name: string; role: string }>(); +} +``` + +--- + +## 🔁 Reusing Components Across the Application + +As there are many ways of reusing a component in the project, we will go over a real-life example. + +Here are two very common ABP components that can be reused anywhere in the app: + +```ts +//... +import { ABP } from "@abp/ng.core"; + +@Component({ + selector: "abp-button", + template: ` + + `, + imports: [NgClass], +}) +export class ButtonComponent implements OnInit { + private renderer = inject(Renderer2); + + @Input() + buttonId = ""; + + @Input() + buttonClass = "btn btn-primary"; + + @Input() + buttonType = "button"; + + @Input() + formName?: string = undefined; + + @Input() + iconClass?: string; + + @Input() + loading = false; + + @Input() + disabled: boolean | undefined = false; + + @Input() + attributes?: ABP.Dictionary; + + @Output() readonly click = new EventEmitter(); + + @Output() readonly focus = new EventEmitter(); + + @Output() readonly blur = new EventEmitter(); + + @Output() readonly abpClick = new EventEmitter(); + + @Output() readonly abpFocus = new EventEmitter(); + + @Output() readonly abpBlur = new EventEmitter(); + + @ViewChild("button", { static: true }) + buttonRef!: ElementRef; + + get icon(): string { + return `${ + this.loading ? "fa fa-spinner fa-spin" : this.iconClass || "d-none" + }`; + } + + ngOnInit() { + if (this.attributes) { + Object.keys(this.attributes).forEach((key) => { + if (this.attributes?.[key]) { + this.renderer.setAttribute( + this.buttonRef.nativeElement, + key, + this.attributes[key] + ); + } + }); + } + } +} +``` + +This button component can be used by simply importing the `ButtonComponent` and using the `` tag. + +You can reach the source code [here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts). + +This modal component is also commonly used. The source code is [here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts). + +```ts +//... +export type ModalSize = "sm" | "md" | "lg" | "xl"; + +@Component({ + selector: "abp-modal", + templateUrl: "./modal.component.html", + styleUrls: ["./modal.component.scss"], + providers: [SubscriptionService], + imports: [NgTemplateOutlet], +}) +export class ModalComponent implements OnInit, OnDestroy, DismissableModal { + protected readonly confirmationService = inject(ConfirmationService); + protected readonly modal = inject(NgbModal); + protected readonly modalRefService = inject(ModalRefService); + protected readonly suppressUnsavedChangesWarningToken = inject( + SUPPRESS_UNSAVED_CHANGES_WARNING, + { + optional: true, + } + ); + protected readonly destroyRef = inject(DestroyRef); + private document = inject(DOCUMENT); + + visible = model(false); + + busy = input(false, { + transform: (value: boolean) => { + if (this.abpSubmit() && this.abpSubmit() instanceof ButtonComponent) { + this.abpSubmit().loading = value; + } + return value; + }, + }); + + options = input({ keyboard: true }); + + suppressUnsavedChangesWarning = input( + this.suppressUnsavedChangesWarningToken + ); + + modalContent = viewChild>("modalContent"); + + abpHeader = contentChild>("abpHeader"); + + abpBody = contentChild>("abpBody"); + + abpFooter = contentChild>("abpFooter"); + + abpSubmit = contentChild(ButtonComponent, { read: ButtonComponent }); + + readonly init = output(); + + readonly appear = output(); + + readonly disappear = output(); + + modalRef!: NgbModalRef; + + isConfirmationOpen = false; + + modalIdentifier = `modal-${uuid()}`; + + get modalWindowRef() { + return this.document.querySelector( + `ngb-modal-window.${this.modalIdentifier}` + ); + } + + get isFormDirty(): boolean { + return Boolean(this.modalWindowRef?.querySelector(".ng-dirty")); + } + + constructor() { + effect(() => { + this.toggle(this.visible()); + }); + } + + ngOnInit(): void { + this.modalRefService.register(this); + } + + dismiss(mode: ModalDismissMode) { + switch (mode) { + case "hard": + this.visible.set(false); + break; + case "soft": + this.close(); + break; + default: + break; + } + } + + protected toggle(value: boolean) { + this.visible.set(value); + + if (!value) { + this.modalRef?.dismiss(); + this.disappear.emit(); + return; + } + + setTimeout(() => this.listen(), 0); + this.modalRef = this.modal.open(this.modalContent(), { + size: "md", + centered: false, + keyboard: false, + scrollable: true, + beforeDismiss: () => { + if (!this.visible()) return true; + + this.close(); + return !this.visible(); + }, + ...this.options(), + windowClass: `${this.options().windowClass || ""} ${ + this.modalIdentifier + }`, + }); + + this.appear.emit(); + } + + ngOnDestroy(): void { + this.modalRefService.unregister(this); + this.toggle(false); + } + + close() { + if (this.busy()) return; + + if (this.isFormDirty && !this.suppressUnsavedChangesWarning()) { + if (this.isConfirmationOpen) return; + + this.isConfirmationOpen = true; + this.confirmationService + .warn( + "AbpUi::AreYouSureYouWantToCancelEditingWarningMessage", + "AbpUi::AreYouSure", + { + dismissible: false, + } + ) + .subscribe((status: Confirmation.Status) => { + this.isConfirmationOpen = false; + if (status === Confirmation.Status.confirm) { + this.visible.set(false); + } + }); + } else { + this.visible.set(false); + } + } + + listen() { + if (this.modalWindowRef) { + fromEvent(this.modalWindowRef, "keyup") + .pipe( + takeUntilDestroyed(this.destroyRef), + debounceTime(150), + filter( + (key: KeyboardEvent) => + key && key.key === "Escape" && this.options().keyboard + ) + ) + .subscribe(() => this.close()); + } + + fromEvent(window, "beforeunload") + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((event) => { + if (this.isFormDirty && !this.suppressUnsavedChangesWarning()) { + event.preventDefault(); + } + }); + + this.init.emit(); + } +} +``` + +This concept differs slightly from the others mentioned above since these components are introduced within a library called `theme-shared`, which you can explore [here](https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages/theme-shared). + +Using **shared libraries** for such common components is one of the most effective ways to make your app modular and maintainable. By grouping frequently used elements into a dedicated library, you create a single source of truth for your UI and logic. + +However, over-creating or prematurely abstracting small pieces of logic into separate libraries can lead to unnecessary complexity and dependency management overhead. When every feature has its own “mini-library,” updates and debugging become scattered and difficult to coordinate. + +The key is to extract shared functionality only when it is proven to be reused across multiple contexts. Start small, let patterns emerge naturally, and then move them into a shared library when the benefits of reusability outweigh the maintenance cost. + +--- + +## ⚙️ Best Practices and Common Pitfalls + +### ✅ Best Practices + +1. **Start with real reuse:** Extract components only after the pattern appears in multiple places. +2. **Keep them focused:** One clear responsibility per component—avoid “do-it-all” designs. +3. **Use standalone components:** Simplify imports and improve independence. +4. **Promote through libraries:** Move proven, stable components into shared libraries for wider use. + +### ⚠️ Common Mistakes + +1. **Premature abstraction:** Don't create components before actual reuse. +2. **Too many input/output bindings:** Overly generic components are hard to configure and maintain. +3. **Neglecting performance:** Too many micro-components can hurt performance. +4. **Ignoring accessibility and semantics:** Reusable does not mean usable—always consider ARIA roles and HTML structure. + +--- + +## 📚 Further Reading and References + +As this article has mentioned some concepts and best practices, you can explore these resources for more details: + +- [Angular Components Guide](https://angular.dev/guide/components) +- [Standalone Migration Guides](https://angular.dev/reference/migrations/standalone), [ABP Angular Standalone Applications](https://abp.io/community/articles/abp-now-supports-angular-standalone-applications-zzi2rr2z#gsc.tab=0) +- [Smart vs. Dumb Components](https://blog.angular-university.io/angular-2-smart-components-vs-presentation-components-whats-the-difference-when-to-use-each-and-why/) +- [Angular Libraries Overview](https://angular.dev/tools/libraries) + +You can also check these open-source libraries for a better understanding of reusability and modularity: + +- [Angular Components on GitHub](https://github.com/angular/components) +- [ABP NPM Libraries](https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages) + +--- + +## 🏁 Conclusion + +Reusability is one of the strongest architectural foundations for scalable Angular applications. By combining **standalone components**, **signals**, **encapsulated logic**, and **shared libraries**, you can create a modular system that grows gracefully over time. + +The goal is not just to make components reusable. It is to make them meaningful, maintainable, and consistent across your app. Build only what truly adds value, reuse intentionally, and let Angular's evolving ecosystem handle the rest. diff --git a/docs/en/Community-Articles/2025-10-09-how-to-change-logo-in-angular-abp-apps/article.md b/docs/en/Community-Articles/2025-10-09-how-to-change-logo-in-angular-abp-apps/article.md new file mode 100644 index 0000000000..59939beab1 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-09-how-to-change-logo-in-angular-abp-apps/article.md @@ -0,0 +1,289 @@ +# How to Change Logo in Angular ABP Applications + +## Introduction + +Logo application customization is one of the most common branding requirements in web applications. In ABP Framework's Angular applications, we found that developers were facing problems while they were trying to implement their application logos, especially on theme dependencies and flexibility. To overcome this, we moved the logo provider from `@volo/ngx-lepton-x.core` to `@abp/ng.theme.shared`, where it is more theme-independent and accessible. Here, we will describe our experience using this improvement and guide you on the new approach for logo configuration in ABP Angular applications. + +## Problem + +Previously, the logo configuration process in ABP Angular applications had several disadvantages: + +1. **Theme Dependency**: The `provideLogo` function was a part of the `@volo/ngx-lepton-x.core` package, so the developers had to depend on LeptonX theme packages even when they were using a different theme or wanted to extend the logo behavior. + +2. **Inflexibility**: The fact that the logo provider had to adhere to a specific theme package brought about an undesirable tight coupling of logo configuration and theme implementation. + +3. **Discoverability Issues**: Developers looking for logo configuration features would likely look in core ABP packages, but the provider was hidden in a theme-specific package, which made it harder to discover. + +4. **Migration Issues**: During theme changes or theme package updates, logo setting could get corrupted or require additional tuning. + +These made a basic operation like altering the application logo more challenging than it should be, especially for teams using custom themes or wanting to maintain theme independence. + +## Solution + +We moved the `provideLogo` function from `@volo/ngx-lepton-x.core` to `@abp/ng.theme.shared` package. This solution offers: + +- **Theme Independence**: Works with any ABP-compatible theme +- **Single Source of Truth**: Logo configuration is centralized in the environment file +- **Standard Approach**: Follows ABP's provider-based configuration pattern +- **Easy Migration**: Simple import path change for existing applications +- **Better Discoverability**: Located in a core ABP package where developers expect it + +This approach maintains ABP's philosophy of providing flexible, reusable solutions while reducing unnecessary dependencies. + +## Implementation + +Let's walk through how logo configuration works with the new approach. + +### Step 1: Configure Logo URL in Environment + +First, define your logo URL in the `environment.ts` file: + +```typescript +export const environment = { + production: false, + application: { + baseUrl: 'http://localhost:4200', + name: 'MyApplication', + logoUrl: 'https://your-domain.com/assets/logo.png', + }, + // ... other configurations +}; +``` + +The `logoUrl` property accepts any valid URL, allowing you to use: +- Absolute URLs (external images) +- Relative paths to assets folder (`/assets/logo.png`) +- Data URLs for embedded images +- CDN-hosted images + +### Step 2: Provide Logo Configuration + +In your `app.config.ts` (or `app.module.ts` for module-based apps), import and use the logo provider: + +```typescript +import { provideLogo, withEnvironmentOptions } from '@abp/ng.theme.shared'; +import { environment } from './environments/environment'; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... other providers + provideLogo(withEnvironmentOptions(environment)), + ], +}; +``` + +**Important Note**: If you're migrating from an older version where the logo provider was in `@volo/ngx-lepton-x.core`, simply update the import statement: + +```typescript +// Old (before migration) +import { provideLogo, withEnvironmentOptions } from '@volo/ngx-lepton-x.core'; + +// New (current approach) +import { provideLogo, withEnvironmentOptions } from '@abp/ng.theme.shared'; +``` + +### How It Works Under the Hood + +The `provideLogo` function registers a logo configuration service that: +1. Reads the `logoUrl` from environment configuration +2. Provides it to theme components through Angular's dependency injection +3. Allows themes to access and render the logo consistently + +The `withEnvironmentOptions` helper extracts the relevant configuration from your environment object, ensuring type safety and proper configuration structure. + +### Example: Complete Configuration + +Here's a complete example showing both environment and provider configuration: + +**environment.ts:** +```typescript +export const environment = { + production: false, + application: { + baseUrl: 'http://localhost:4200', + name: 'E-Commerce Platform', + logoUrl: 'https://cdn.example.com/brand/logo-primary.svg', + }, + oAuthConfig: { + issuer: 'https://localhost:44305', + clientId: 'MyApp_App', + // ... other OAuth settings + }, + // ... other settings +}; +``` + +**app.config.ts:** +```typescript +import { ApplicationConfig } from '@angular/core'; +import { provideRouter } from '@angular/router'; +import { provideLogo, withEnvironmentOptions } from '@abp/ng.theme.shared'; +import { environment } from './environments/environment'; +import { routes } from './app.routes'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideRouter(routes), + provideLogo(withEnvironmentOptions(environment)), + // ... other providers + ], +}; +``` + +## Advanced: Logo Component Replacement + +For more advanced customization scenarios where you need complete control over the logo component's structure, styling, or behavior, ABP provides a component replacement mechanism. This approach allows you to replace the entire logo component with your custom implementation. + +### When to Use Component Replacement + +Consider using component replacement when: +- You need custom HTML structure around the logo +- You want to add interactive elements (e.g., dropdown menu, animations) +- You need to implement complex responsive behavior +- The simple `logoUrl` configuration doesn't meet your requirements + +### How to Replace the Logo Component + +#### Step 1: Generate a New Logo Component + +Run the following command in your Angular folder to create a new component: + +```bash +ng generate component custom-logo --inline-template --inline-style +``` + +#### Step 2: Implement Your Custom Logo + +Open the generated `custom-logo.component.ts` and implement your custom logo: + +```typescript +import { Component } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +@Component({ + selector: 'app-custom-logo', + standalone: true, + imports: [RouterModule], + template: ` + + My Application Logo + + `, + styles: [` + .navbar-brand { + padding: 0.5rem 1rem; + } + + .navbar-brand img { + transition: opacity 0.3s ease; + } + + .navbar-brand:hover img { + opacity: 0.8; + } + `] +}) +export class CustomLogoComponent {} +``` + +#### Step 3: Register the Component Replacement + +Open your `app.config.ts` and register the component replacement: + +```typescript +import { ApplicationConfig } from '@angular/core'; +import { provideRouter } from '@angular/router'; +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eThemeBasicComponents } from '@abp/ng.theme.basic'; +import { CustomLogoComponent } from './custom-logo/custom-logo.component'; +import { environment } from './environments/environment'; +import { routes } from './app.routes'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideRouter(routes), + // ... other providers + { + provide: 'APP_INITIALIZER', + useFactory: (replaceableComponents: ReplaceableComponentsService) => { + return () => { + replaceableComponents.add({ + component: CustomLogoComponent, + key: eThemeBasicComponents.Logo, + }); + }; + }, + deps: [ReplaceableComponentsService], + multi: true, + }, + ], +}; +``` + +Alternatively, if you're using a module-based application, you can register it in `app.component.ts`: + +```typescript +import { Component, OnInit } from '@angular/core'; +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eThemeBasicComponents } from '@abp/ng.theme.basic'; +import { CustomLogoComponent } from './custom-logo/custom-logo.component'; + +@Component({ + selector: 'app-root', + template: '', +}) +export class AppComponent implements OnInit { + constructor(private replaceableComponents: ReplaceableComponentsService) {} + + ngOnInit() { + this.replaceableComponents.add({ + component: CustomLogoComponent, + key: eThemeBasicComponents.Logo, + }); + } +} +``` + +### Component Replacement vs Logo URL Configuration + +Here's a comparison to help you choose the right approach: + +| Feature | Logo URL Configuration | Component Replacement | +|---------|------------------------|----------------------| +| **Simplicity** | Very simple, one-line configuration | Requires creating a new component | +| **Flexibility** | Limited to image URL | Full control over HTML/CSS/behavior | +| **Use Case** | Standard logo display | Complex customizations | +| **Maintenance** | Minimal | Requires component maintenance | +| **Migration** | Easy to change | Requires code changes | +| **Recommended For** | Most applications | Advanced customization needs | + +For most applications, the simple `logoUrl` configuration in the environment file is sufficient and recommended. Use component replacement only when you need advanced customization that goes beyond a simple image. + +### Benefits of This Approach + +1. **Separation of Concerns**: Logo configuration is separate from theme implementation +2. **Environment-Based**: Different logos for development, staging, and production +3. **Type Safety**: TypeScript ensures correct configuration structure +4. **Testing**: Easy to mock and test logo configuration +5. **Consistency**: Same logo appears across all theme components automatically +6. **Flexibility**: Choose between simple configuration or full component replacement based on your needs + +## Conclusion + +In this article, we explored how ABP Framework simplified logo configuration in Angular applications by moving the logo provider from `@volo/ngx-lepton-x.core` to `@abp/ng.theme.shared`. This change eliminates unnecessary theme dependencies and makes logo customization more straightforward and theme-agnostic. + +The solution we implemented allows developers to configure their application logo simply by setting a URL in the environment file and providing the logo configuration in their application setup. For advanced scenarios requiring complete control over the logo component, ABP's component replacement mechanism provides a powerful alternative. This approach maintains flexibility while reducing complexity and improving discoverability. + +We developed this improvement while working on ABP Framework to enhance developer experience and reduce common friction points. By sharing this solution, we hope to help teams implement consistent branding across their ABP Angular applications more easily, regardless of which theme they choose to use. + +If you're using an older version of ABP with logo configuration in LeptonX packages, migrating to this new approach requires only a simple import path change, making it a smooth upgrade path for existing applications. + +## See Also + +- [Component Replacement Documentation](https://abp.io/docs/latest/framework/ui/angular/component-replacement) +- [ABP Angular UI Customization Guide](https://abp.io/docs/latest/framework/ui/angular/customization) diff --git a/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/cover.png b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/cover.png new file mode 100644 index 0000000000..2a0bcf52e9 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/cover.png differ diff --git a/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/post.md b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/post.md new file mode 100644 index 0000000000..3110a8e1be --- /dev/null +++ b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/post.md @@ -0,0 +1,267 @@ +# From Server to Browser — the Elegant Way: Angular TransferState Explained + +## Introduction + +When building Angular applications with Server‑Side Rendering (SSR), a common performance pitfall is duplicated data fetching: the server loads data to render HTML, then the browser bootstraps Angular and fetches the same data again. That’s wasteful, increases Time‑to‑Interactive, and can hammer your APIs. + +Angular’s built‑in **TransferState** lets you transfer the data fetched on the server to the browser during hydration so the client can reuse it instead of calling the API again. It’s simple, safe for serializable data, and makes SSR feel instant for users. + +This article explains what TransferState is, and how to implement it in your Angular SSR app. + +--- + +## What Is TransferState? + +TransferState is a key–value store that exists for a single SSR render. On the server, you put serializable data into the store. Angular serializes it into the HTML as a small script tag. When the browser hydrates, Angular reads that payload back and makes it available to your app. You can then consume it and skip duplicate HTTP calls. + +Key points: + +- Works only across the SSR → browser hydration boundary (not a general cache). +- Data is cleaned up after bootstrapping (no stale data). +- Stores JSON‑serializable data only (if you need to use Date/Functions/Map; serialize it). +- Data is set on the server and read on the client. + +--- + +## When Should You Use It? + +- Data fetched during SSR that is also be needed on the client. +- Data that doesn’t change between server render and immediate client hydration. +- Expensive or slow API endpoints where a second request is visibly costly. + +Avoid using it for: + +- Highly dynamic data that changes frequently. +- Sensitive data (never put secrets/tokens in TransferState). +- Large payloads (keep the serialized state small to avoid bloating HTML). + +--- + +## Prerequisites + +- An Angular app with SSR enabled (Angular ≥16: `ng add @angular/ssr`). +- `HttpClient` configured. The examples below show both manual TransferState use and the build in solutions. + +--- + +## Option A — Using TransferState Manually + +This approach gives you full control over what to cache and when. It's straightforward and works in both module‑based and standalone‑based apps. + +Service example that fetches books and uses TransferState: + +```ts +// books.service.ts +import { + Injectable, + PLATFORM_ID, + makeStateKey, + TransferState, + inject, +} from '@angular/core'; +import { isPlatformServer } from '@angular/common'; +import { HttpClient } from '@angular/common/http'; +import { Observable, of } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +export interface Book { + id: number; + name: string; + price: number; +} + +@Injectable({ providedIn: 'root' }) +export class BooksService { + BOOKS_KEY = makeStateKey('books:list'); + readonly httpClient = inject(HttpClient); + readonly transferState = inject(TransferState); + readonly platformId = inject(PLATFORM_ID); + + getBooks(): Observable { + // If browser and we have the data that already fetched on the server, use it and remove from TransferState + if (this.transferState.hasKey(this.BOOKS_KEY)) { + const cached = this.transferState.get(this.BOOKS_KEY, []); + this.transferState.remove(this.BOOKS_KEY); // remove to avoid stale reads + return of(cached); + } + + // Otherwise fetch data. If running on the server, write into TransferState + return this.httpClient.get('/api/books').pipe( + tap(list => { + if (isPlatformServer(this.platformId)) { + this.transferState.set(this.BOOKS_KEY, list); + } + }) + ); + } +} + +``` + +Use it in a component: + +```ts +// books.component.ts +import { Component, inject, OnInit } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { BooksService, Book } from './books.service'; + +@Component({ + selector: 'app-books', + imports: [CommonModule], + template: ` +

Books

+
    + @for (book of books; track book.id) { +
  • {{ book.name }} — {{ book.price | currency }}
  • + } +
+ `, +}) +export class BooksComponent implements OnInit { + private booksService = inject(BooksService); + books: Book[] = []; + + ngOnInit() { + this.booksService.getBooks().subscribe(data => (this.books = data)); + } +} + +``` + +Route resolver variant (keeps templates simple and aligns with SSR prefetching): + +```ts +// src/app/routes.ts + +export const routes: Routes = [ + { + path: 'books', + component: BooksComponent, + resolve: { + books: () => inject(BooksService).getBooks(), + }, + }, +]; +``` + +Then read `books` from the `ActivatedRoute` data in your component. + +--- + +## Option B — Using HttpInterceptor to Automate TransferState + +Like Option A, but less boilerplate. This approach uses an **HttpInterceptor** to automatically cache HTTP GET (also POST/PUT request but not recommended) responses in TransferState. You can determine which requests to cache based on URL patterns. + +Example interceptor that caches GET requests: + +```ts +import { inject, makeStateKey, PLATFORM_ID, TransferState } from '@angular/core'; +import { + HttpEvent, + HttpHandlerFn, + HttpInterceptorFn, + HttpRequest, + HttpResponse, +} from '@angular/common/http'; +import { Observable, of } from 'rxjs'; +import { isPlatformBrowser, isPlatformServer } from '@angular/common'; +import { tap } from 'rxjs/operators'; + +export const transferStateInterceptor: HttpInterceptorFn = ( + req: HttpRequest, + next: HttpHandlerFn, +): Observable> => { + const transferState = inject(TransferState); + const platformId = inject(PLATFORM_ID); + + // Only cache GET requests. You can customize this to match specific URLs if needed. + if (req.method !== 'GET') { + return next(req); + } + + // Create a unique key for this request + const stateKey = makeStateKey>(req.urlWithParams); + + // If browser, check if we have the response in TransferState + if (isPlatformBrowser(platformId)) { + const storedResponse = transferState.get>(stateKey, null); + if (storedResponse) { + transferState.remove(stateKey); // remove to avoid stale reads + return of(new HttpResponse({ body: storedResponse, status: 200 })); + } + } + + return next(req).pipe( + tap(event => { + // If server, store the response in TransferState + if (isPlatformServer(platformId) && event instanceof HttpResponse) { + transferState.set(stateKey, event.body); + } + }), + ); +}; + +``` + +Add the interceptor to your app module or bootstrap function: + +````ts + provideHttpClient(withFetch(), withInterceptors([transferStateInterceptor])) +```` + + +--- + +## Option C — Using Angular's Built-in HTTP Transfer Cache + +This is the simplest option if you want to HTTP requests that without custom logic. + +Angular docs: https://angular.dev/api/platform-browser/withHttpTransferCacheOptions + + +Usage examples: + +```ts + // Only cache GET requests that have no headers + provideClientHydration(withHttpTransferCacheOptions({})) + + // Also cache POST requests (not recommended for most cases) + provideClientHydration(withHttpTransferCacheOptions({ + includePostRequests: true + })) + + // Cache requests that have auth headers (e.g., JWT tokens) + provideClientHydration(withHttpTransferCacheOptions({ + includeRequestsWithAuthHeaders: true + })) +``` + +To see all options, check the Angular docs: https://angular.dev/api/common/http/HttpTransferCacheOptions + +## Best Practices and Pitfalls + +- Keep payloads small: only put what’s needed for initial paint. +- Serialize explicitly if needed: for Dates or complex types, convert to strings and reconstruct on the client. +- Don’t transfer secrets: never place tokens or sensitive user data in TransferState. +- Per‑request isolation: state is scoped to a single SSR request; it is not a global cache. + +--- + +## Debugging Tips + +- Log on server vs browser: use `isPlatformServer` and `isPlatformBrowser` checks to confirm where code runs. +- DevTools inspection: view the page source after SSR; you’ll see a small script tag that embeds the transfer state. +- Count requests: put a console log in your service to verify the second HTTP call is gone on the client. + +--- + +## Measurable Impact + +On content‑heavy pages, TransferState typically removes 1–3 duplicate API calls during hydration, shaving 100–500 ms from the critical path on average networks. It’s a low‑effort, high‑impact win for SSR apps. + +--- + +## Conclusion + +If you already have SSR, enabling TransferState is one of the easiest ways to make hydration feel instant. You can use it built‑in HTTP caching or manually control what to cache. Either way, it eliminates redundant data fetching, speeds up Time‑to‑Interactive, and improves user experience with minimal effort. diff --git a/docs/en/Community-Articles/2025-10-15-angular-library-linking-made-easy-paths-workspaces-and-symlinks/POST.md b/docs/en/Community-Articles/2025-10-15-angular-library-linking-made-easy-paths-workspaces-and-symlinks/POST.md new file mode 100644 index 0000000000..52601e8624 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-15-angular-library-linking-made-easy-paths-workspaces-and-symlinks/POST.md @@ -0,0 +1,244 @@ +# Angular Library Linking Made Easy: Paths, Workspaces, and Symlinks + +Managing local libraries and path references in Angular projects has evolved significantly with the introduction of the new Angular application builder. What once required manual path mappings, fragile symlinks, and `node_modules` references is now more structured, predictable, and aligned with modern TypeScript and workspace practices. This guide walks through how path mapping works, how it has changed, and the best ways to link and manage your local libraries in brand new Angular ecosystem. + +### Understanding TypeScript Path Mapping + +Path aliases is a powerful feature in TypeScript that helps developers simplify and organize their import statements. Instead of dealing with long and error-prone relative paths like `../../../components/button`, you can define a clear and descriptive alias that points directly to a specific directory or module. + +This configuration is managed through the `paths` property in the TypeScript configuration file (`tsconfig.json`), allowing you to map custom names to local folders or compiled outputs. For example: + +```json +// tsconfig.json +{ + "compilerOptions": { + "paths": { + "@my-package": ["./dist/my-package"], + "@my-second-package": ["./projects/my-second-package/src/public-api.ts"] + } + } +} +``` + +In this setup, `@my-package` serves as a shorthand reference to your locally built library. Once configured, you can import modules using `@my-package` instead of long relative paths, which greatly improves readability and maintainability across large projects. + +When working with multiple subdirectories or a more complex folder structure, you can also use wildcards to create flexible and dynamic mappings. This pattern is especially useful for modular libraries or mono-repos that contain multiple sub-packages: + +```json +// tsconfig.json +{ + "compilerOptions": { + "paths": { + "@my-package/*": ["./dist/my-package/*"] + } + } +} +``` + +With this approach, imports like `@my-package/utils` or `@my-package/components/button` will automatically resolve to the corresponding directories in your build output. This makes your codebase more maintainable, portable, and consistent. This is useful especially when collaborating across teams or working with multiple libraries in the same workspace. + +--- + +### Step-by-Step Examples of Path Configuration + +As this example provides a glimpse for the path mapping, this is not the only way for the aliases. Here are the other ways to utilize this feature. + +1. **Using `package.json` Exports for Library Mapping** + + When developing internal libraries within a mono-repo, another option is to use the `exports` field in each library’s `package.json` + + This allows Node and modern bundlers to resolve imports cleanly when consuming the library, without depending solely on TypeScript configuration. + + ```json + // dist/my-lib/package.json + { + "name": "@my-org/my-lib", + "version": "1.0.0", + "exports": { + ".": "./index.js", + "./utils": "./utils/index.ts" + } + } + ``` + + ```tsx + import { formatDate } from "@my-org/my-lib/utils"; + ``` + + This approach becomes especially powerful when publishing your libraries or integrating them into larger Angular mono-repos. Because, it aligns both runtime (Node) and compile-time (TypeScript) resolution. + +2. **Linking Local Libraries via Symlinks** + + If you want to use a local library that is not yet published to npm, you can create a symbolic link between your library’s `dist` output and your consuming app. + + This is useful when testing or developing multiple packages in parallel. + + You can create a symlink using npm or yarn: + + ```bash + # Inside your library folder + npm link + + # Inside your consuming app + npm link @my-org/my-lib + ``` + + This effectively tells Node to resolve `@my-org/my-lib` from your local file system instead of the npm registry. + + However, note that symlinks can sometimes lead to path resolution issues with certain Angular build configurations, especially before the new application builder. With the latest builder improvements, this approach is becoming more stable and predictable. + +3. **Combining Path Mapping with Workspace Configuration** + + In a structured Angular workspace, especially one created with **Nx** or **Angular CLI** using multiple projects, you can combine the approaches above. + + For instance, your `tsconfig.base.json` can define local references for in-repo libraries, while each library’s `package.json` provides external mappings for reuse outside the workspace. + + This hybrid setup ensures that: + + - The workspace remains easy to navigate and refactor locally. + - External consumers (or CI builds) can still resolve imports correctly once libraries are built. + + For larger Angular projects or mono-repos, **Workspaces** (supported by both **Yarn** and **npm**) offer a clean way to manage multiple local packages within the same repository. Workspaces automatically link internal libraries together, so you can reference them by name instead of using manual `file:` paths or complex TypeScript aliases. This approach keeps dependencies consistent, simplifies cross-project development, and scales well for enterprise or multi-package setups. + +Each of these methods has its strengths: + +- **TypeScript paths:** This is great for local development and quick imports. +- **`package.json` exports:** This is ideal for libraries meant to be distributed. +- **Symlinks:** These are convenient for local testing between projects. + +Choosing the right one, or even combining them depends on the scale of your project and whether you are building internal libraries, or a full mono-repo setup. + +--- + +### How Path References Worked Before the New Angular Application Builder + +Angular used to support path aliases to the locally installed packages by referencing to the `node_modules` folder like this: + +```json +// tsconfig.json +{ + "compilerOptions": { + "paths": { + "@angular/*": ["./node_modules/@angular/*"] + } + } +} +``` + +However, this approach is not recommended, hence not supported, by the TypeScript. You can find detailed guidance on this topic in the TypeScript documentation, which notes that paths should not reference mono-repo packages or those inside **node_modules**: [Paths should not point to monorepo packages or node_modules packages](https://www.typescriptlang.org/docs/handbook/modules/reference.html#paths-should-not-point-to-monorepo-packages-or-node_modules-packages). + +Giving a real life example would explain the situation better. Suppose that you have such structure: + +- Amain angular app that consumes several npm dependencies and holds registered local paths that reference to another library locally like this: + + ```json + // angular/tsconfig.json + { + "compileOnSave": false, + "compilerOptions": { + "paths": { + "@abp/ng.identity": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/src/public-api.ts" + ], + "@abp/ng.identity/config": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/config/src/public-api.ts" + ], + "@abp/ng.identity/proxy": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/proxy/src/public-api.ts" + ] + } + } + } + ``` + + This simply references to this package physically https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages/identity + +- This library is also using these dependencies + + ```json + // npm/ng-packs/packages/identity/package.json + { + "name": "@abp/ng.identity", + "version": "10.0.0-rc.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, + "dependencies": { + "@abp/ng.components": "~10.0.0-rc.1", + "@abp/ng.permission-management": "~10.0.0-rc.1", + "@abp/ng.theme.shared": "~10.0.0-rc.1", + "tslib": "^2.0.0" + }, + "publishConfig": { + "access": "public" + } + } + ``` + + As these libraries also have their own dependencies, the identity package needs to consume them in itself. Before the [application builder migration](https://angular.dev/tools/cli/build-system-migration), you could register the path configuration like this + + ```json + // angular/tsconfig.json + { + "compileOnSave": false, + "compilerOptions": { + "paths": { + "@angular/*": ["node_modules/@angular/*"], + "@abp/*": ["node_modules/@abp/*"], + "@swimlane/*": ["node_modules/@swimlane/*"], + "@ngx-validate/core": ["node_modules/@ngx-validate/core"], + "@ng-bootstrap/ng-bootstrap": [ + "node_modules/@ng-bootstrap/ng-bootstrap" + ], + "@abp/ng.identity": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/src/public-api.ts" + ], + "@abp/ng.identity/config": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/config/src/public-api.ts" + ], + "@abp/ng.identity/proxy": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/proxy/src/public-api.ts" + ] + } + } + } + ``` + + However, the latest builder forces more strict rules. So, it does not resolve the paths that reference to the `node_modules` causing a common DI error as mentioned here: + + - https://github.com/angular/angular-cli/issues/31395 + - https://github.com/angular/angular-cli/issues/26901 + - https://github.com/angular/angular-cli/issues/27176 + +In this case, we recommend using a symlink script. You can reach them through this example application: [🔗 Angular Sample Path Reference](https://github.com/sumeyyeKurtulus/AbpPathReferenceExamples) + +These scripts help you share dependencies from the main Angular app to local library projects via symlinks: + +- `symlink-config.ps1` centralizes which library directories to touch (e.g., ../../modules/Volo.Abp.Identity/angular/projects/identity) and which packages to link (e.g., @angular, @abp, rxjs) +- `setup-symlinks.ps1` reads that config and, for each library, creates a `node_modules` folder if needed and symlinks only the listed packages from the `node_modules` of the app to avoid duplicate installs +- `remove-symlinks.ps1` cleans up by deleting those library `node_modules` directories so they can use their own local deps again +- In `angular/package.json`, the `symlinks:setup` and `symlinks:remove` npm scripts simply run those two PowerShell scripts so you can execute them conveniently with your package manager. + +--- + +### Best Practices and Recommendations + +As we have explained each way of path mapping, this part of the article aims to summarize the best practices. Here are the points you need to consider: + +- Prefer **workspace references** for large projects and mono-repos. +- Use **TypeScript path aliases** only for local development convenience. +- Strictly avoid referencing `node_modules` directly; let the Angular builder manage package resolution. +- Maintain **consistent library structures** with clear `package.json` exports for reusable libraries. +- Automate **symlink creation/removal** if needed to reduce manual errors. + +Here is the list of common pitfalls and how you could troubleshoot them: + +- **DI errors after path configurations for typescript config**: Ensure that only one copy of each library is resolved. Avoid duplicate modules by checking `node_modules` and symlinks. +- **IDE not recognizing aliases**: Confirm that `tsconfig.json` or `tsconfig.base.json` includes the correct `paths` configuration and that your IDE is using the correct tsconfig. +- **Build errors with old paths**: Migrate paths pointing to `node_modules` to either workspace references or local library paths. +- **Symlink issues in CI/CD**: Use automated scripts to create/remove symlinks consistently; do not rely on manual linking. +- **Module resolution conflicts**: Check library dependencies for mismatched versions and align them using a package manager workspace strategy. + +As Angular’s build system continues to mature, developers are encouraged to move away from outdated path configurations and manual symlink setups. By embracing workspace references, consistent library exports, and TypeScript path mapping, teams can build scalable, maintainable applications without wrestling with complex import paths or dependency conflicts. With the right configuration, local development becomes faster, cleaner, and far more reliable. diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/POST.md b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/POST.md new file mode 100644 index 0000000000..e6c0eb4601 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/POST.md @@ -0,0 +1,88 @@ +# 5 Things You Should Keep in Mind When Deploying to a Clustered Environment + +Let’s be honest — moving from a single server to a cluster sounds simple on paper. +You just add a few more machines, right? +In practice, it’s the moment when small architectural mistakes start to grow legs. +Below are a few things that experienced engineers usually double-check before pressing that “Deploy” button. + +--- + +## 1️⃣ Managing State the Right Way + +Each request in a cluster might hit a different machine. +If your application keeps user sessions or cache in memory, that data probably won’t exist on the next node. +That’s why many teams decide to push state out of the app itself. + +![Stateless vs Stateful](stateless.png) + +**A few real-world tips:** +- Keep sessions in **Redis** or something similar instead of local memory. +- Design endpoints so they don’t rely on earlier requests. +- Don’t assume the same server will handle two requests in a row — it rarely does. + +--- + +## 2️⃣ Shared Files and Where to Put Them + +Uploading files to local disk? That’s going to hurt in a cluster. +Other nodes can’t reach those files, and you’ll spend hours wondering why images disappear. + +![Shared Storage](shared.png) + +**Better habits:** +- Push uploads to **S3**, **Azure Blob**, or **Google Cloud Storage**. +- Send logs to a shared location instead of writing to local files. +- Keep environment configs in a central place so each node starts with the same settings. + +--- + +## 3️⃣ Database Connections Aren’t Free + +Every node opens its own database connections. +Ten nodes with twenty connections each — that’s already two hundred open sessions. +The database might not love that. + +![Database Connections](database.png) + +**What helps:** +- Put a cap on your connection pools. +- Avoid keeping transactions open for too long. +- Tune indexes and queries before scaling horizontally. + +--- + +## 4️⃣ Logging and Observability Matter More Than You Think + +When something breaks in a distributed system, it’s never obvious which server was responsible. +That’s why observability isn’t optional anymore. + +![Observability](logging.png) + +**Consider this:** +- Stream logs to **ELK**, **Datadog**, or **Grafana Loki**. +- Add a **trace ID** to every incoming request and propagate it across services. +- Watch key metrics with **Prometheus** and visualize them in Grafana dashboards. + +--- + +## 5️⃣ Background Jobs and Message Queues + +If more than one node runs the same job, you might process the same data twice — or delete something by mistake. +You don’t want that kind of excitement in production. + +![Background Jobs](background.png) + +**A few precautions:** +- Use a **distributed lock** or **leader election** system. +- Make jobs **idempotent**, so running them twice doesn’t break data. +- Centralize queue consumers or use a proper task scheduler. + +--- + +## Wrapping Up + +Deploying to a cluster isn’t only about scaling up — it’s about staying stable when you do. +Systems that handle state, logging, and background work correctly tend to age gracefully. +Everything else eventually learns the hard way. + +> A cluster doesn’t fix design flaws — it magnifies them. diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/all.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/all.png new file mode 100644 index 0000000000..71cbe984c4 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/all.png differ diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/background.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/background.png new file mode 100644 index 0000000000..4d802e409d Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/background.png differ diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/cover-image.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/cover-image.png new file mode 100644 index 0000000000..be4c03fda0 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/database.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/database.png new file mode 100644 index 0000000000..4a54b6f031 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/database.png differ diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/dev-to.md b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/dev-to.md new file mode 100644 index 0000000000..d6df7eea53 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/dev-to.md @@ -0,0 +1,27 @@ +# 5 Things You Should Keep in Mind When Deploying to a Clustered Environment + +Let’s be honest — moving from a single server to a cluster sounds simple on paper. +You just add a few more machines, right? +In practice, it’s the moment when small architectural mistakes start to grow legs. +Below are a few things that experienced engineers usually double-check before pressing that “Deploy” button. + +--- + +## 1️⃣ Managing State the Right Way +--- + +## 2️⃣ Shared Files and Where to Put Them +--- + +## 3️⃣ Database Connections Aren’t Free +--- + +## 4️⃣ Logging and Observability Matter More Than You Think +--- + +## 5️⃣ Background Jobs and Message Queues +--- + +![all](all.png) + +👉 Read the full guide here: [5 Things You Should Keep in Mind When Deploying to a Clustered Environment](https://abp.io/community/articles/) \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/logging.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/logging.png new file mode 100644 index 0000000000..c3100a672a Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/logging.png differ diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/shared.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/shared.png new file mode 100644 index 0000000000..0331ce4a6a Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/shared.png differ diff --git a/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/stateless.png b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/stateless.png new file mode 100644 index 0000000000..6b12c03db8 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-5-Things-Deploy-Clustered-Environment/stateless.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/1.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/1.png new file mode 100644 index 0000000000..55d5add034 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/1.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/10.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/10.png new file mode 100644 index 0000000000..0e788ac942 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/10.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/11.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/11.png new file mode 100644 index 0000000000..86fd6a4b1f Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/11.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/11_1.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/11_1.png new file mode 100644 index 0000000000..a438e6f9d8 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/11_1.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/2.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/2.png new file mode 100644 index 0000000000..cd517ae96e Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/2.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/3.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/3.png new file mode 100644 index 0000000000..0760bc5f52 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/3.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/4.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/4.png new file mode 100644 index 0000000000..a91b301825 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/4.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/5.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/5.png new file mode 100644 index 0000000000..a1d3e366d1 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/5.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/6.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/6.png new file mode 100644 index 0000000000..6dbc4a1b31 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/6.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/7.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/7.png new file mode 100644 index 0000000000..37b364e931 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/7.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/8.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/8.png new file mode 100644 index 0000000000..4af2381387 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/8.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/9.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/9.png new file mode 100644 index 0000000000..14fe5473d7 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/9.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/Post.md b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/Post.md new file mode 100644 index 0000000000..02790fde8b --- /dev/null +++ b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/Post.md @@ -0,0 +1,251 @@ +# Optimize Your .NET App for Production (Complete Checklist) + +I see way too many .NET apps go to prod like it’s still “F5 on my laptop.” Here’s the checklist I wish someone shoved me years ago. It’s opinionated, pragmatic, copy-pasteable. + +------ + +## 1) Publish Command and CSPROJ Settings + +![Publish Command and CSPROJ Setting](1.png) + +Never go to production with debug build! See the below command which publishes properly a .NET app for production. + +```bash +dotnet publish -c Release -o out -p:PublishTrimmed=true -p:PublishSingleFile=true -p:ReadyToRun=true +``` + +`csproj` for the optimum production publish: + +```xml + + true + true + true + true + +``` + +- **PublishTrimmed** It's trimmimg assemblies. What's that!? It removes unused code from your application and its dependencies, hence it reduces the output files. + +- **PublishReadyToRun** When you normally build a .NET app, your C# code is compiled into **IL** (Intrmediate Language). When your app runs, the JIT Compiler turns that IL code into native CPU commands. But this takes much time on startup. When you enable `PublishReadyToRun`, the build process precompiles your IL into native code and it's called AOT (Ahead Of Time). Hence your app starts faster... But the downside is; the output files are now a bit bigger. Another thing; it'll compile only for a specific OS like Windows and will not run on Linux anymore. + +- **Self-contained** When you publish your .NET app this way, it ncludes the .NET runtime inside your app files. It will run even on a machine that doesn’t have .NET installed. The output size gets larger, but the runtime version is exactly what you built with. + + + +------ + +## 2) Kestrel Hosting + +![Kestrel Hosting](2.png) + +By default, ASP.NET Core app listen only `localhost`, it means it accepts requests only from inside the machine. When you deploy to Docker or Kubernetes, the container’s internal network needs to expose the app to the outside world. To do this you can set it via environment variable as below: + +```bash +ASPNETCORE_URLS=http://0.0.0.0:8080 +``` + +Also if you’re building an internall API or a containerized microservice which is not multilngual, then add also the below setting. it disables operating system's globalization to reduce image size and dependencies.. + +```bash +DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 +``` + +Clean `Program.cs` startup! +Here's a minimal `Program.cs` which includes just the essential middleware and settings: + +```csharp +var builder = WebApplication.CreateBuilder(args); + +builder.Logging.ClearProviders(); +builder.Logging.AddConsole(); + +builder.Services.AddResponseCompression(); +builder.Services.AddResponseCaching(); +builder.Services.AddHealthChecks(); + +var app = builder.Build(); + +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/error"); + app.UseHsts(); +} + +app.UseResponseCompression(); +app.UseResponseCaching(); + +app.MapHealthChecks("/health"); +app.MapGet("/error", () => Results.Problem(statusCode: 500)); + +app.Run(); +``` + + + +------ + +## 3) Garbage Collection and ThreadPool + + + +![Garbage Collection and ThreadPool](3.png) + +### GC Memory Cleanup Mode + +GC (Garbage Collection) is how .NET automatically frees memory. There are two main modes: + +- **Workstation GC:** good for desktop apps (focuses on responsiveness) +- **Server GC:** good for servers (focuses on throughput) + +The below environment variable is telling the .NET runtime to use the *Server Garbage Collector (Server GC)* instead of the *Workstation GC*. Because our ASP.NET Core app must be optmized for servers not personal computers. + +```bash +COMPlus_gcServer=1 +``` + +### GC Limit Memory Usage + +Use at max 60% of the total available memory for the managed heap (the memory that .NET’s GC controls). So if your container or VM has, let's say 4 GB of RAM, .NET will try to keep the GC heap below 2.4 GB (60% of 4 GB). Especially when you run your app in containers, don’t let the GC assume host memory: + +```bash +COMPlus_GCHeapHardLimitPercent=60 +``` + +### Thread Pool Warm-up + +When your .NET app runs, it uses a thread pool. This is for handling background work like HTTP requests, async tasks, I/O things... By default, the thread pool starts small and grows dynamically as load increases. That’s good for desktop apps but for server apps it's too slow! Because during sudden peek of traffic, the app might waste time creating threads instead of handling requests. So below code keeps at least 200 worker threads and 200 I/O completion threads ready to go even if they’re idle. + +```csharp +ThreadPool.SetMinThreads(200, 200); +``` + + + +------ + +## 4) HTTP Performance + +![HTTP Performance](4.png) + +### HTTP Response Compression + +`AddResponseCompression()` enables HTTP response compression. It shrinks your outgoing responses before sending them to the client. Making smaller payloads for faster responses and uses less bandwidth. Default compression method is `Gzip`. You can also add `Brotli` compression. `Brotli` is great for APIs returning JSON or text. If your CPU is already busy, keep the default `Gzip` method. + +```csharp +builder.Services.AddResponseCompression(options => +{ + options.Providers.Add(); + options.EnableForHttps = true; +}); +``` + + + +### HTTP Response Caching + +Use caching for GET endpoints where data doesn’t change often (e.g., configs, reference data). `ETags` and `Last-Modified` headers tell browsers or proxies skip downloading data that hasn’t changed. + +- **ETag** = a version token for your resource. +- **Last-Modified** = timestamp of last change. + +If a client sends `If-None-Match: "abc123"` and your resource’s `ETag` hasn’t changed, .NET automatically returns `304 Not Modified`. + + + +### HTTP/2 or HTTP/3 + +These newer protocols make web requests faster and smoother. It's good for microservices or frontends making many API calls. + +- **HTTP/2** : multiplexing (many requests over one TCP connection). +- **HTTP/3** : uses QUIC (UDP) for even lower latency. + +You can enable them on your reverse proxy (Nginx, Caddy, Kestrel)... +.NET supports both out of the box if your environment allows it. + + + +### Minimal Payloads with DTOs + +The best practise here is; Never send/recieve your entire database entity, use DTOs. In the DTOs include only the fields the client actually needs by doing so you will keep the responses smaller and even safer. Also, prefer `System.Text.Json` (now it’s faster than `Newtonsoft.Json`) and for very high-traffic APIs, use source generation to remove reflection overhead. + +```csharp +//define your entity DTO +[JsonSerializable(typeof(MyDto))] +internal partial class MyJsonContext : JsonSerializerContext { } + +//and simply serialize like this +var json = JsonSerializer.Serialize(dto, MyJsonContext.Default.MyDto) +``` + +------ + +## 5) Data Layer (Mostly Where Most Apps Slow Down!) + +![Data Layer](5.png) + +### Reuse `DbContext` via Factory (Pooling) + +Creating a new `DbContext` for every query is expensive! Use `IDbContextFactory`, it gives you pooled `DbContext` instances from a pool that reuses objects instead of creating them from scratch. + +```csharp +services.AddDbContextFactory(options => + options.UseSqlServer(connectionString)); +``` + +Then inject the factory: + +```csharp +using var db = _contextFactory.CreateDbContext(); +``` + +Also, ensure your database server (SQL Server, PostgreSQL....) has **connection pooling enabled**. + +------ + +### N+1 Query Problem + +The N+1 problem occurs when your app runs **one query for the main data**, then **N more queries for related entities**. That kills performance!!! + +**Bad-Practise:** + +```csharp +var users = await context.Users.Include(u => u.Orders).ToListAsync(); +``` + +**Good-Practise:** +Project to DTOs using `.Select()` so EF-Core generates a single optimized SQL query: + +```csharp +var users = await context.Users.Select(u => new UserDto + { + Id = u.Id, + Name = u.Name, + OrderCount = u.Orders.Count + }).ToListAsync(); +``` + +------ + +### **Indexes** + +Use EF Core logging, SQL Server Profiler, or `EXPLAIN` (Postgres/MySQL) to find slow queries. Add missing indexes **only** where needed. For example [at this page](https://blog.sqlauthority.com/2011/01/03/sql-server-2008-missing-index-script-download/), he wrote an SQL query which lists missing index list (also there's another version at [Microsoft Docs](https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-missing-index-details-transact-sql?view=sql-server-ver17)). This perf improvement is mostly applied after running the app for a period of time. + + + +------ + +### Migrations + +In production run migrations manually, never do it on app startup. That way you can review schema changes, back up data and avoid breaking the live DB. + + + +------ + +### Resilience with Polly + +Use [Polly](https://www.pollydocs.org/) for retries, timeouts and circuit breakers for your DB or HTTP calls. Handles short outages gracefully + +*To keep the article short and for the better readability I spitted it into 2 parts 👉 [Continue with the second part here](https://abp.io/community/articles/optimize-your-dotnet-app-for-production-for-any-.net-app-2-78xgncpi)...* + diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/Post2.md b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/Post2.md new file mode 100644 index 0000000000..8d5aca4a1a --- /dev/null +++ b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/Post2.md @@ -0,0 +1,267 @@ +*If you’ve landed directly on this article, note that it’s part-2 of the series. You can read part-1 here: [Optimize Your .NET App for Production (Part 1)](https://abp.io/community/articles/optimize-your-dotnet-app-for-production-for-any-.net-app-wa24j28e)* + +## 6) Telemetry (Logs, Metrics, Traces) + +![Telemetry](6.png) + +The below code adds `OpenTelemetry` to collect app logs, metrics, and traces in .NET. + +```csharp +builder.Services.AddOpenTelemetry() + .UseOtlpExporter() + .WithMetrics(m => m.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation()) + .WithTracing(t => t.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation()); +``` + +- `UseOtlpExporter()` Tells it where to send telemetry. Usually that’s an OTLP collector (like Grafana , Jaeger, Tempo, Azure Monitor). So you can visualize metrics and traces in dashboards. +- `WithMetrics()` means it'll collects metrics. These metrics are Request rate (RPS), Request duration (latency), GC pauses, Exceptions, HTTP client timings. +- `.WithTracing(...)` means it'll collect distributed traces. That's useful when your app calls other APIs or microservices. You can see the full request path from one service to another with timings and bottlenecks. + +### .NET Diagnostic Tools + +When your app is on-air, you should know about the below tools. You know in airplanes there's _black box recorder_ which is used to understand why the airplane crashed. For .NET below are our *black box recorders*. They capture what happened without attaching a debugger. + +| Tool | What It Does | When to Use | +| --------------------- | --------------------------------------- | ---------------------------- | +| **`dotnet-counters`** | Live metrics like CPU, GC, request rate | Monitor running apps | +| **`dotnet-trace`** | CPU sampling & performance traces | Find slow code | +| **`dotnet-gcdump`** | GC heap dumps (allocations) | Diagnose memory issues | +| **`dotnet-dump`** | Full process dumps | Investigate crashes or hangs | +| **`dotnet-monitor`** | HTTP service exposing all the above | Collect telemetry via API | + + + +------ + +## 7) Build & Run .NET App in Docker the Right Way + +![Docker](7.png) + +A multi-stage build is a Docker technique where you use one image for building your app and another smaller image for running it. Why we do multi-stage build, because the .NET SDK image is big but has all the build tools. The .NET Runtime image is small and optimized for production. You copy only the published output from the build stage into the runtime stage. + +```dockerfile +# build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +WORKDIR /src +COPY . . +RUN dotnet restore +RUN dotnet publish -c Release -o /app/out -p:PublishTrimmed=true -p:PublishSingleFile=true -p:ReadyToRun=true + +# run +FROM mcr.microsoft.com/dotnet/aspnet:9.0 +WORKDIR /app +ENV ASPNETCORE_URLS=http://+:8080 +EXPOSE 8080 +COPY --from=build /app/out . +ENTRYPOINT ["./YourApp"] # or ["dotnet","YourApp.dll"] +``` + +I'll explain what these Docker file commands; + +**Stage1: Build** + +* `FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build` + Uses the .NET SDK image including compilers and tools. The `AS build` name lets you reference this stage later. + +* `WORKDIR /src` + Sets the working directory inside the container. + +* `COPY . .` + Copies your source code into the container. + +* `RUN dotnet restore` + Restores NuGet packages. + +* `RUN dotnet publish ...` + Builds the project in **Release** mode, optimizes it for production, and outputs it to `/app/out`. + The flags; + * `PublishTrimmed=true` -> removes unused code + * `PublishSingleFile=true` -> bundles everything into one file + * `ReadyToRun=true` -> precompiles code for faster startup + +**Stage 2: Run** + +- `FROM mcr.microsoft.com/dotnet/aspnet:9.0` + Uses a lighter runtime image which no compiler, just the runtime. +- `WORKDIR /app` + Where your app will live inside the container. +- `ENV ASPNETCORE_URLS=http://+:8080` + Makes the app listen on port 8080 (and all network interfaces). +- `EXPOSE 8080` + Documents the port your container uses (for Docker/K8s networking). +- `COPY --from=build /app/out .` + Copies the published output from the **build stage** to this final image. +- `ENTRYPOINT ["./YourApp"]` + Defines the command that runs when the container starts. If you published as a single file, it’s `./YourApp`. f not, use `dotnet YourApp.dll`. + + + +------ + +## 8) Security + +![Security](8.png) + +### HTTPS Everywhere Even Behind Proxy + +Even if your app runs behind a reverse proxy like Nginx, Cloudflare or a load balancer, always enforce HTTPS. Why? Because internal traffic can still be captured if you don't use SSL and also cookies, HSTS, browser APIs require HTTPS. In .NET, you can easily enforce HTTPS like this: + +```csharp +app.UseHttpsRedirection(); +``` + + + +### Use HSTS in Production + +HSTS (HTTP Strict Transport Security) tells browsers: + +> Always use HTTPS for this domain — don’t even try HTTP again! + +Once you set, browsers cache this rule, so users can’t accidentally hit the insecure version. You can easily enforce this as below: + +```csharp +if (!app.Environment.IsDevelopment()) +{ + app.UseHsts(); +} +``` + +When you use HSTS, it sends browser this HTTP header: ` Strict-Transport-Security: max-age=31536000; includeSubDomains`. Browser will remember this setting for 1 year (31,536,000 seconds) that this site must only use HTTPS. And `includeSubDomains` option applies the rule to all subdomains as well (eg: `api.abp.io`, `cdn.abp.io`, `account.abp.io` etc..) + +### Store Secrets on Environment Variables or Secret Stores + +Never store passwords, connection strings, or API keys in your code or Git. Then where should we keep them? + +- Best/practical way is **Environment variables**. You can easily sett an environment variable in a Unix-like system as below: + + - ```bash + export ConnectionStrings__Default="Server=...;User Id=...;Password=..." + ``` + +- And you can easily access these environment variables from your .NET app like this: + + - ```csharp + var conn = builder.Configuration.GetConnectionString("Default"); + ``` + +Or **Secret stores** like: Azure Key Vault, AWS Secrets Manager, HashiCorp Vault + + + +### Add Rate-Limiting to Public Endpoints + +Don't forget there'll be not naive guys who will use your app! We've many times faced this issue in the past on our public front-facing websites. So protect your public APIs from abuse, bots, and DDoS. Use rate-limiting!!! Stop brute-force attacks, prevent your resources from exhaustion... + +In .NET, there's a built-in rate-limit feature for .NET (System.Threading.RateLimiting): + +```csharp +builder.Services.AddRateLimiter(_ => _ + .AddFixedWindowLimiter("default", options => + { + options.PermitLimit = 100; + options.Window = TimeSpan.FromMinutes(1); + })); + +app.UseRateLimiter(); +``` + +- Also there's an open-source rate-limiting library -> [github.com/stefanprodan/AspNetCoreRateLimit](https://github.com/stefanprodan/AspNetCoreRateLimit) +- Another one -> [nuget.org/packages/Polly.RateLimiting](https://www.nuget.org/packages/Polly.RateLimiting) + +### Secure Cookies + +Cookies are often good targets for attacks. You must secure them properly otherwise you can face cookie stealing or CSRF attack. + +```csharp +options.Cookie.SecurePolicy = CookieSecurePolicy.Always; +options.Cookie.SameSite = SameSiteMode.Strict; // or Lax +``` + +- **`SecurePolicy = Always`** -> only send cookies over HTTPS +- **`SameSite=Lax/Strict`** -> prevent CSRF (Cross-Site Request Forgery) + - `Strict` = safest + - `Lax` = good balance for login sessions + + + +------ + +## 9) Startup/Cold Start + +![Cold Start / Startup](9.png) + +### Keep Tiered JIT On + +The **JIT (Just-In-Time) compiler** converts your app’s Intermediate Language (IL) into native CPU instructions when the code runs. _Tiered JIT_ means the runtime uses 2 stages of compilation. Actually this setting is enabled by default in modern .NET. So just keep it on. + +1. **Tier 0 (Quick JIT):** + Fast, low-optimization compile → gets your app running ASAP. + (Used at startup.) +2. **Tier 1 (Optimized JIT):** + Later, the runtime re-compiles *hot* methods (frequently used ones) with deeper optimizations for speed. + + + +### Use PGO (Profile-Guided Optimization) + +PGO lets .NET learn from real usage of your app. It profiles which functions are used most often, then re-optimizes the build for that pattern. You can think of it as the runtime saying: + +> I’ve seen what your app actually does... I’ll rearrange and optimize code paths accordingly. + +In .NET 8+, you don’t have to manually enable PGO (Profile-Guided Optimization). The JIT collects runtime profiling data (e.g. which types are common, branch predictions) and uses it to generate more optimized code later. In .NET 9, PGO has been improved: the JIT uses PGO data for more patterns (like type checks / casts) and makes better decisions. + + + +------ + +## 10) Graceful Shutdown + +![Shutdown](10.png) + +When we break up with our lover, we often argue and regret it later. When an application breaks up with an operating system, it should be done well 😘 ... +When your app stops, maybe you deploy a new version or Kubernetes restarts a pod... the OS sends a signal called `SIGTERM` (terminate). +A **graceful shutdown** means handling that signal properly, finishing what’s running, cleaning up, and exiting cleanly (like an adult)! + +```csharp +var app = builder.Build(); +var lifetime = app.Services.GetRequiredService(); +lifetime.ApplicationStopping.Register(() => +{ + // stop accepting, finish in-flight, flush telemetry +}); +app.Run(); +``` + +On K8s, set `terminationGracePeriodSeconds` and wire **readiness**/startup probes. + +------ + +## 11) Load Test + +![Load Test](11.png) + +Sometimes arguing with our lover is good. We can see her/his face before marrying 😀 Use **k6** or **bombardier** and test with realistic payloads and prod-like limits. Don't be surprise later when your app is running on prod! These topics should be tested: `CPU %` , `Time in GC` , `LOH Allocations` , `ThreadPool Queue Length` and `Socket Exhaustion`. + +### About K6 + +- A modern load testing tool, using Go and JavaScript. + +- 29K stars on GitHub +- GitHub address: https://github.com/grafana/k6 + +### About Bombardier + +- Fast cross-platform HTTP benchmarking tool written in Go. + +- 7K stars on GitHub +- GitHub address: https://github.com/codesenberg/bombardier + +[![Bombardier vs K6](11_1.png)](https://trends.google.com/trends/explore?cat=31&q=bombardier%20%2B%20benchmarking,k6%20%2B%20benchmarking) + +## Summary + +In summary, I listed 11 items for optimizing a .NET application for production; Covering build configuration, hosting setup, runtime behavior, data access, telemetry, containerization, security, startup performance and reliability under load. By applying the checklist from Part 1 and Part 2 of this series, leveraging techniques like trimmed releases, server GC, minimal payloads, pooled `DbContexts`, OpenTelemetry, multi-stage Docker builds, HTTPS enforcement, and proper shutdown handling—you’ll improve your app’s durability, scalability and maintainability under real-world traffic and production constraints. Each item is a checkpoint and you’ll be able to deliver a robust, high-performing .NET application ready for live users. + +🎉 Want top-tier .NET performance without the headaches? Try [ABP Framework](https://abp.io?utm_source=alper-ebicoglu-performance-article) for best-performance and skip all the hustles of .NET app development. + diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/cover-2.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/cover-2.png new file mode 100644 index 0000000000..4f466fd11c Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/cover-2.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/cover.png b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/cover.png new file mode 100644 index 0000000000..f9935df03c Binary files /dev/null and b/docs/en/Community-Articles/2025-10-17-Optimize-Your-App-For-Production/cover.png differ diff --git a/docs/en/Community-Articles/2025-10-17-Top-10-Exception-Handling-Mistakes-in-DotNET/post.md b/docs/en/Community-Articles/2025-10-17-Top-10-Exception-Handling-Mistakes-in-DotNET/post.md new file mode 100644 index 0000000000..3360fd0e20 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-17-Top-10-Exception-Handling-Mistakes-in-DotNET/post.md @@ -0,0 +1,356 @@ +# 💥 Top 10 Exception Handling Mistakes in .NET (and How to Actually Fix Them) + +Every .NET developer has been there it's 3 AM, production just went down, and the logs are flooding in. +You open the error trace, only to find… nothing useful. The stack trace starts halfway through a catch block, or worse it's empty. Somewhere, an innocent-looking `throw ex;` or a swallowed background exception has just cost hours of sleep. + +Exception handling is one of those things that seems simple on the surface but can quietly undermine an entire system if done wrong. Tiny mistakes like catching `Exception`, forgetting an `await`, or rethrowing incorrectly don't just break code; they break observability. They hide root causes, produce misleading logs, and make even well-architected applications feel unpredictable. + +In this article, we'll go through the most common exception handling mistakes developers make in .NET and more importantly, how to fix them. Along the way, you'll see how small choices in your code can mean the difference between a five-minute fix and a full-blown production nightmare. + +---------- + +## 🧨 1. Catching `Exception` (and Everything Else) + +**The mistake:** + +```csharp +try +{ + // Some operation +} +catch (Exception ex) +{ + // Just to be safe +} + +``` + +**Why it's a problem:** +Catching the base `Exception` type hides all context including `OutOfMemoryException`, `StackOverflowException`, and other runtime-level issues that you should never handle manually. It also makes debugging painful since you lose the ability to treat specific failures differently. + +**The right way:** +Catch only what you can handle: + +```csharp +catch (SqlException ex) +{ + // Handle DB issues +} +catch (IOException ex) +{ + // Handle file issues +} + +``` + +If you really must catch all exceptions (e.g., at a system boundary), **log and rethrow**: + +```csharp +catch (Exception ex) +{ + _logger.LogError(ex, "Unexpected error occurred"); + throw; +} + +``` + +> 💡 **ABP Tip:** In ABP-based applications, you rarely need to catch every exception at the controller or service level. +> The framework's built-in `AbpExceptionFilter` already handles unexpected exceptions, logs them, and returns standardized JSON responses automatically keeping your controllers clean and consistent. + +---------- + +## 🕳️ 2. Swallowing Exceptions Silently + +**The mistake:** + +```csharp +try +{ + DoSomething(); +} +catch +{ + // ignore +} + +``` + +**Why it's a problem:** +Silent failures make debugging nearly impossible. You lose stack traces, error context, and sometimes even awareness that something failed at all. + +**The right way:** +Always log or rethrow, unless you have a very specific reason not to: + +```csharp +try +{ + _cache.Remove(key); +} +catch (Exception ex) +{ + _logger.LogWarning(ex, "Failed to clear cache key {Key}", key); +} + +``` + +> 💡 **ABP Tip:** Since ABP automatically logs all unhandled exceptions, it's often better to let the framework handle them. Only catch exceptions when you want to enrich logs or add custom business logic before rethrowing. + +---------- + +## 🌀 3. Using `throw ex;` Instead of `throw;` + +**The mistake:** + +```csharp +catch (Exception ex) +{ + Log(ex); + throw ex; +} + +``` + +**Why it's a problem:** +Using `throw ex;` resets the stack trace you lose where the exception actually occurred. This is one of the biggest causes of misleading production logs. + +**The right way:** + +```csharp +catch (Exception ex) +{ + Log(ex); + throw; // preserves stack trace +} + +``` + +---------- + +## ⚙️ 4. Wrapping Everything in Try/Catch + +**The mistake:** +Developers sometimes wrap _every function_ in try/catch “just to be safe.” + +**Why it's a problem:** +This clutters your code and hides the real source of problems. Exception handling should happen at **system boundaries**, not in every method. + +**The right way:** +Handle exceptions at higher levels (e.g., middleware, controllers, background jobs). Let lower layers throw naturally. + +> 💡 **ABP Tip:** The ABP Framework provides a top-level exception pipeline via filters and middleware. You can focus purely on your business logic ABP automatically translates unhandled exceptions into standardized API responses. + +---------- + +## 📉 5. Using Exceptions for Control Flow + +**The mistake:** + +```csharp +try +{ + var user = GetUserById(id); +} +catch (UserNotFoundException) +{ + user = CreateNewUser(); +} + +``` + +**Why it's a problem:** +Exceptions are expensive and should represent _unexpected_ states, not normal control flow. + +**The right way:** + +```csharp +var user = GetUserByIdOrDefault(id) ?? CreateNewUser(); + +``` + +---------- + +## 🪓 6. Forgetting to Await Async Calls + +**The mistake:** + +```csharp +try +{ + DoSomethingAsync(); // missing await! +} +catch (Exception ex) +{ + ... +} + +``` + +**Why it's a problem:** +Without `await`, the exception happens on another thread, outside your `try/catch`. It never gets caught. + +**The right way:** + +```csharp +try +{ + await DoSomethingAsync(); +} +catch (Exception ex) +{ + _logger.LogError(ex, "Error during async operation"); +} + +``` + +---------- + +## 🧵 7. Ignoring Background Task Exceptions + +**The mistake:** + +```csharp +Task.Run(() => SomeWork()); + +``` + +**Why it's a problem:** +Unobserved task exceptions can crash your process or vanish silently, depending on configuration. + +**The right way:** + +```csharp +_ = Task.Run(async () => +{ + try + { + await SomeWork(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Background task failed"); + } +}); + +``` + +---------- + +## 📦 8. Throwing Generic Exceptions + +**The mistake:** + +```csharp +throw new Exception("Something went wrong"); + +``` + +**Why it's a problem:** +Generic exceptions carry no semantic meaning. You can't catch or interpret them specifically later. + +**The right way:** +Use more descriptive types: + +```csharp +throw new InvalidOperationException("Order is already processed"); + +``` + +> 💡 **ABP Tip:** In ABP applications, you can throw a `BusinessException` or `UserFriendlyException` instead. +> These support structured data, error codes, localization, and automatic HTTP status mapping: +> +> ```csharp +> throw new BusinessException("App:010046") +> .WithData("UserName", "john"); +> +> ``` +> +> This integrates with ABP's localization system, letting your error messages be translated automatically based on the error code. + +---------- + +## 🪞 9. Losing Inner Exceptions + +**The mistake:** + +```csharp +catch (Exception ex) +{ + throw new CustomException("Failed to process order"); +} + +``` + +**Why it's a problem:** +You lose the inner exception and its stack trace the real reason behind the failure. + +**The right way:** + +```csharp +catch (Exception ex) +{ + throw new CustomException("Failed to process order", ex); +} + +``` + +> 💡 **ABP Tip:** ABP automatically preserves and logs inner exceptions (for example, inside `BusinessException` chains). You don't need to add boilerplate to capture nested errors just throw them properly. + +---------- + +## 🧭 10. Missing Global Exception Handling + +**The mistake:** +Catching exceptions manually in every controller. + +**Why it's a problem:** +It creates duplicated logic, inconsistent responses, and gaps in logging. + +**The right way:** +Use middleware or a global exception filter: + +```csharp +app.UseExceptionHandler("/error"); + +``` + +> 💡 **ABP Tip:** ABP already includes a complete global exception system that: +> +> - Logs exceptions automatically +> +> - Returns a standard `RemoteServiceErrorResponse` JSON object +> +> - Maps exceptions to correct HTTP status codes (e.g., 403 for business rules, 404 for entity not found, 400 for validation) +> +> - Allows customization through `AbpExceptionHttpStatusCodeOptions` +> You can even implement an `ExceptionSubscriber` to react to certain exceptions (e.g., send notifications or trigger audits). +> + +---------- + +## 🧩 Bonus: Validation Is Not an Exception + +**The mistake:** +Throwing exceptions for predictable user input errors. + +**The right way:** +Use proper validation instead: + +```csharp +[Required] +public string UserName { get; set; } + +``` + +> 💡 **ABP Tip:** ABP automatically throws an `AbpValidationException` when DTO validation fails. +> You don't need to handle this manually ABP formats it into a structured JSON response with `validationErrors`. + +---------- + +## 🧠 Final Thoughts + +Exception handling isn't just about preventing crashes it's about making your failures **observable, meaningful, and recoverable**. +When done right, your logs tell a story: _what happened, where, and why_. +When done wrong, you're left staring at a 3 AM mystery. + +By avoiding these common pitfalls and taking advantage of frameworks like ABP that handle the heavy lifting you'll spend less time chasing ghosts and more time building stable, predictable systems. + diff --git a/docs/en/Community-Articles/2025-10-20-The-ASP-DotNET-Core-Dependency-Injection System/post.md b/docs/en/Community-Articles/2025-10-20-The-ASP-DotNET-Core-Dependency-Injection System/post.md new file mode 100644 index 0000000000..0a3959b44f --- /dev/null +++ b/docs/en/Community-Articles/2025-10-20-The-ASP-DotNET-Core-Dependency-Injection System/post.md @@ -0,0 +1,1174 @@ +# The ASP.NET Core Dependency Injection System + +## Article Overview + +This article provides a guide to **ASP.NET Core Dependency Injection**, a fundamental element of .NET development. We'll examine the built in Inversion of Control (IoC) container, examining the critical differences between service lifecycles (scoped, singleton, or transient), and comparing constructor injection to property injection. + +You'll learn how to effectively register your services with patterns like `TryAdd` methods and the **Options Pattern**, how to adhere to established best practices like avoiding captive dependencies and asynchronous constructor logic, how to understand patterns like decorators and explicit generics, how to leverage manual scope management with `IServiceScopeFactory`, how to implement proper asynchronous disposal with `IAsyncDisposable`, and how to analyze the performance impact of your DI strategy, including the new compile time source generation features that enable native AOT support in .NET 9. Ultimately, you'll have the knowledge to create loosely coupled, maintainable, and testable applications using the advanced dependency injection patterns in .NET 9. Of course, the explanations here are general, if you'd like to delve deeper, you can check out the references section. + +## Introduction to Dependency Injection + +Dependency Injection (DI) is a design pattern used to implement Inversion of Control (IoC), in which control of object creation and binding is transferred from the object itself to another container or framework. In the context of ASP.NET Core, DI is a tool integrated into the framework for managing the lifecycle and creation of application components. + +### The Evolution from .NET Framework to .NET Core and .NET 9 + +The journey of dependency injection in the .NET ecosystem represents a sweeping architectural shift. .NET Framework applications (prior to 2016) typically relied on third party IoC containers such as + +- **Unity** (Microsoft's own container, often used in enterprise applications) +- **Autofac** (popular for its advanced features and fluent API) +- **Ninject** (known for its simplicity) +- **StructureMap** (one of the earliest .NET IoC containers) +- **Castle Windsor** (powerful but complex) + +Many legacy applications have fallen back to anti patterns like the **Service Locator pattern**, which hides dependencies and makes testing difficult. + +When ASP.NET Core was released in 2016, Microsoft made a decision to integrate dependency injection directly into the runtime. This meant: + +- **Standardization:** Creating a consistent DI approach across all .NET Core applications. +- **Performance:** Creating a lightweight, optimized container designed for workloads. +- **Simplicity:** No need to choose third party containers for basic scenarios. +- **Cloud Native Ready:** Designed for microservices, containers, and serverless architectures. + +Now, with **.NET 9**, the DI container has become even more advanced as follows: + +- **Source generated DI** for faster startup and AOT compatibility. +- **Keyed services** for advanced solution scenarios. +- **Lifetime validation** to catch common errors during development. + +Unlike .NET Framework applications, which required installing these containers as third-party packages and often present issues with consistency, in ASP.NET Core, and now in .NET 9, dependency injection is a fundamental part of the architecture. + +### Why is Dependency Injection important? + +The key benefits of adopting a DI strategy would be. + + * **Loose Coupling:** Components don't create their dependencies directly. Instead, they get them from the DI container. This means you can change the implementation of a dependency without changing the component that uses it. + * **Testability:** Once dependencies are added, you can easily replace them with mocks or mock implementations in your unit tests. This will allow you to test components in isolation. + * **Maintenance and Scalability:** A loosely coupled architecture is easier to manage, refactor, and extend. New features can be added with minimal changes to existing code. + +This article provides a guide for developers covering the basic mechanisms of Dependency Injection in .NET and the performance models available in .NET 9. + +## The Built in IoC Container in ASP.NET Core + +ASP.NET Core ships with the lightweight yet comprehensive **ASP.NET Core IoC container**. It's not designed to have all the features of third party tools, but it provides the basic functionality needed for most applications. + +The two basic interfaces representing the structure are as follows: + + * `IServiceCollection`: This is the "registration" side of the structure. When the application starts up, you add your services or dependencies to this collection. + * `IServiceProvider`: This is the "resolving" side of the structure. After the application is created, `IServiceProvider` is used to retrieve instances of registered services. + +### Comparison with Third Party Tools + +While the internal structure is sufficient for many scenarios, you can easily modify it if you need more features, such as: + + * **Automatic registration / Assembly Scan:** Automatically register types based on contracts. + * **Interception / Decorators:** Providing more support for packaging services with cross cutting concerns. + * **Child Containers:** Some tools, such as Autofac, allow you to create nested sub containers with their own lifetimes, which can be useful for isolating components in complex applications. The built in framework uses a simpler scoping mechanism. + + +## Service Lifetimes in ASP.NET Core + +When registering a service, you must specify its lifetime. The lifetime determines how long a service instance will be valid. Understanding the difference between **scoped, singleton, and transient** is important for building stable and optimized applications. + +### Transient + +A new instance of a transient service is created **each time** it is requested from the container. + + * **When to use:** For lightweight, stateless services. + * `builder.Services.AddTransient();` + +### Scoped + +A single instance of a scoped service is created once per client request (or per scope). The same instance is shared within that single request. + + * **When to use:** It is more appropriate to use it for services that need to maintain state within a single request, such as `DbContext` or Unit of Work. + * `builder.Services.AddScoped();` + +### Singleton + +A single instance of the service is created once during the entire application lifetime. + + * **When to use:** Commonly used for stateless services that are source intensive to create or need to share their state extensively, such as application configuration or caching services. + * `builder.Services.AddSingleton();` + +> **Considered Best Practice: Avoid Captive Dependencies** +> A common mistake is injecting a deep, scoped service (for example, `MyDbContext`) into a singleton service. Because the singleton service lives forever, it will keep the scoped service in the container structure for the lifetime of the application, converting it to a singleton service. This can lead to memory leaks and erratic behavior across requests. ASP.NET Core throws an exception at runtime to help you detect this during development. + +### Manual Scope Management with `IServiceScopeFactory` + +In scenarios where you need to manually create and manage scopes (background workers, singleton services, or long running tasks), you can use `IServiceScopeFactory` to create scopes. + +This would be particularly useful when properly controlling when a singleton service needs to use scoped dependencies without causing captive dependency problems. + +Within continuously running services, you must not directly inject objects that require short lifespans, such as database connections. This code example solves this problem by creating a temporary workspace for each task using a "throw away" approach. The environment and necessary services are created when the process starts, and all are automatically cleaned up when the task ends. This method utilizes sources efficiently and prevents memory leaks. + +```csharp +public class DataProcessingService +{ + private readonly IServiceScopeFactory _scopeFactory; + + public DataProcessingService(IServiceScopeFactory scopeFactory) + { + _scopeFactory = scopeFactory; + } + + public async Task ProcessDataAsync() + { + // Create a new scope for this unit of work + await using (var scope = _scopeFactory.CreateAsyncScope()) + { + var dbContext = scope.ServiceProvider.GetRequiredService(); + var repository = scope.ServiceProvider.GetRequiredService(); + + // Perform scoped work + var data = await repository.GetPendingDataAsync(); + await dbContext.SaveChangesAsync(); + } + // Scope is disposed here, releasing all scoped services + } +} +``` + +**Key Points:** +- We should use `CreateAsyncScope()` when working with asynchronous disposal. +- It would be logical to use `CreateScope()` for synchronous scenarios. +- Always destroying scopes appropriately using `using` or `await using` statements is important for scope management and optimization. + + +Here is the detailed explanation, incorporating your text and adding the requested details for property injection. + +## Constructor Injection vs. Property Injection + +There are several ways a class can receive its dependencies. The two most common patterns are **constructor** and **property** injection. + +### Constructor Injection + +With constructor injection, a class retrieves its dependencies from the container via constructor parameters. With dependency injection (DI), the container will be responsible for creating instances of these dependencies and fetching them when the class is generated. This is one of the most common and recommended approaches to **ASP.NET Core Dependency Injection**. + +```csharp +// Primary Constructors +public class OrderService(IOrderRepository orderRepository, ILogger logger) +{ + private readonly IOrderRepository _orderRepository = orderRepository; + + private readonly ILogger _logger = logger; + public async Task GetOrderAsync(int orderId) + { + _logger.LogInformation("Fetching order {OrderId}", orderId); + return await _orderRepository.GetByIdAsync(orderId); + } +} + +// Traditional Class Constructor +public class OrderService +{ + private readonly IOrderRepository _orderRepository; + private readonly ILogger _logger; + + public OrderService(IOrderRepository orderRepository, ILogger logger) + { + _orderRepository = orderRepository; + _logger = logger; + } + + public async Task GetOrderAsync(int orderId) + { + _logger.LogInformation("Fetching order {OrderId}", orderId); + return await _orderRepository.GetByIdAsync(orderId); + } +} +``` + +#### Pros: + + * **Explicit Dependencies:** The constructor's signature explicitly states all **required** dependencies. A developer will immediately see what the class needs to function when calling it. + * **Immutability:** Dependencies can be assigned to `readonly` fields so that they cannot be changed after the object is created. This will lead to more stable and predictable class behavior. + * **Availability:** The class is guaranteed to have the required dependencies when created. It will not need to perform null checks on required services. + * **Startup Validation:** If a required dependency is not registered in the DI container, the application will fail *on startup* (at runtime), making errors easy to detect early. + +> **Best Practice: Avoid Asynchronous Operations in Constructors** +> A constructor is expected to be simple and fast. We should not perform asynchronous operations (`await`) or long running tasks within a constructor. This can lead to deadlocks and unpredictable application startup behavior. Using asynchronous factory patterns or `IHostedService` for asynchronous startup logic will fix this issue in most scenarios. + + +### Property Injection + +With property injection (also known as "setter injection"), dependencies are provided through publicly settable properties on the class. The dependency is injected after the class is created. + +This pattern is less common in ASP.NET Core because the built in DI container will not support it out of the box (other third party containers like Autofac or Ninject do support it). + +Property injection is almost exclusively used for **optional dependencies**, which would be services that the class could use but doesn't need to perform its core functionality. + +```csharp +public class ProductService +{ + private readonly IProductRepository _productRepository; + + // Injected via a public property + public ILogger? Logger { get; set; } + + // Still injected via the constructor + public ProductService(IProductRepository productRepository) + { + _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository)); + } + + public async Task GetProductAsync(int productId) + { + // Must check if the optional dependency was injected before using it + Logger?.LogInformation("Fetching product {ProductId}", productId); + + return await _productRepository.GetByIdAsync(productId); + } +} +``` + +Since the built in container doesn't automatically set the `Logger` property, you would either have to use a different container or set it manually (which partially defeats the purpose of DI). This is why it's strongly discouraged for *required* dependencies. + +#### Pros: + + * **Optional Dependencies:** Can be used to provide optional services. The class can function without the dependency, but if a dependency is provided, its behavior needs to be improved. + * **Decoupling:** It can help to break up large classes or prevent over injection in the constructor (constructors with too many parameters), but this usually indicates that the class is doing too much (Single Responsibility Principle). + +#### Cons: + + * **Hidden Dependencies:** It won't be immediately obvious from the constructor what the class might depend on. Because of the way it's implemented, this means a developer will need to examine the class's properties. + * **Mutability:** This means that the dependency will not be readonly and can be changed at any time, which may lead to unforeseen situations and changes. + * **Null Check:** The class should always check if the optional dependency is `null` before using it. + * **No Container Support:** The default ASP.NET Core container will not inject properties. This makes this pattern unusable unless you use a different container or manually add dependencies. + + +## Registering Services in ASP.NET Core + +Services are registered in the DI container in `Program.cs`. This means adding the services to the `IServiceCollection`. + +### Basic and Factory based Registrations + +You can add an interface to a concrete class or use a factory based registration style for complex initialization. + +**In Program.cs** +```csharp +var builder = WebApplication.CreateBuilder(args); + +// Simple registration +builder.Services.AddScoped(); + +// Factory based registration +builder.Services.AddScoped(provider => +{ + // Resolve other service +    var logger = provider.GetRequiredService>(); + var someValue = "CalculatedOrRetrievedValue"; +     + // Manually build with dependencies +    return new SomeComplexService(logger, someValue); +}); +``` + +### Conditional `TryAdd` Registrations + +When developing reusable libraries or building dependent applications, you may want to register a service only if another application has not already registered it, and you may want to check for it. The `TryAdd` method is used for this scenario. + +**Available Methods:** +- `TryAddSingleton()` Adds the singleton if it is not already registered +- `TryAddScoped()` Adds scoped if not already registered. +- `TryAddTransient()` Adds a transient if not already registered. +- `TryAddEnumerable()` Adds to a service collection (for `IEnumerable` resolution). + +```csharp +builder.Services.AddSingleton(); + +builder.Services.TryAddSingleton(); + +// CustomLogger is used because it was registered first +// TryAdd* only adds if the service type isn't already registered +``` + +### The Options Pattern (`IOptions`, `IOptionsSnapshot`, `IOptionsMonitor`) + +The **Options Pattern** is the recommended way to add configuration to your services. It provides type safe access to configuration sections and integrates with DI. + +**Three different options:** + +1. **`IOptions`** Singleton, will be loaded once at startup. +2. **`IOptionsSnapshot`** Scoped, will be reloaded per request. (useful for multi tenant scenarios.) +3. **`IOptionsMonitor`** Individually triggered changes will be reloaded when the configuration changes. + +```csharp +public class ApiSettings +{ + public string BaseUrl { get; set; } = string.Empty; + public string ApiKey { get; set; } = string.Empty; + public int TimeoutSeconds { get; set; } = 30; +} +``` + +**In appsettings.json** +```json +{ + "ExternalApi": { + "BaseUrl": "https://api.example.com", + "ApiKey": "your-api-key", + "TimeoutSeconds": 60 + } +} +``` + +**Inject and use in a service** +```csharp +public class ExternalApiClient +{ + private readonly ApiSettings _settings; + private readonly ILogger _logger; + private readonly HttpClient _httpClient; + + // Use IOptions for singleton services + public ExternalApiClient( + IOptions options, + ILogger logger, + HttpClient httpClient) + { + _settings = options.Value; + _logger = logger; + _httpClient = httpClient; + + _httpClient.BaseAddress = new Uri(_settings.BaseUrl); + _httpClient.DefaultRequestHeaders.Add("X-API-Key", _settings.ApiKey); + _httpClient.Timeout = TimeSpan.FromSeconds(_settings.TimeoutSeconds); + } + + public async Task FetchDataAsync() + { + return await _httpClient.GetStringAsync("/data"); + } +} + +public class DynamicConfigService +{ + private readonly IOptionsMonitor _optionsMonitor; + + public DynamicConfigService(IOptionsMonitor optionsMonitor) + { + _optionsMonitor = optionsMonitor; + + _optionsMonitor.OnChange(settings => + { + Console.WriteLine($"Configuration changed! New URL: {settings.BaseUrl}"); + }); + } + + public ApiSettings GetCurrentSettings() => _optionsMonitor.CurrentValue; +} +``` + +**In Program.cs** +```csharp + +builder.Services.Configure(builder.Configuration.GetSection("ExternalApi")); +builder.Services.AddHttpClient(); +``` + +**When to use each:** +- **`IOptions`:** Used for settings that do not change during runtime. +- **`IOptionsSnapshot`:** Used in scoped services where the configuration may differ per request. +- **`IOptionsMonitor`:** Used when you need to react to configuration changes without restarting the application. + +### Automating Registration with Assembly Scanning + +In large projects, manually registering each service can be time consuming and error prone. While the built in container doesn't offer native assembly scanning, you can use reflection based utilities or third party libraries like **Scrutor** to automate service registration based on conventions. + +**Example: Using Scrutor** + +```csharp +using Scrutor; + +var builder = WebApplication.CreateBuilder(args); + +// It will scan the services according to the contract and automatically register them. +builder.Services.Scan(scan => scan + .FromAssemblyOf() // Scan the current assembly + .AddClasses(classes => classes.Where(type => + type.Name.EndsWith("Service"))) // Find all classes ending with "Service" + .AsImplementedInterfaces() // Register them by their interfaces + .WithScopedLifetime()); // Use scoped lifetime + +// More specific scanning +builder.Services.Scan(scan => scan + .FromAssemblies(typeof(IRepository<>).Assembly) + .AddClasses(classes => classes.AssignableTo(typeof(IRepository<>))) + .AsImplementedInterfaces() + .WithTransientLifetime()); +``` + +**Example: Custom reflection based scanning (without external library).** + +```csharp +namespace MyApp.Services; + +using System.Reflection; + +public static class ServiceCollectionExtensions +{ + public static IServiceCollection AddApplicationServices(this IServiceCollection services) + { + var assembly = Assembly.GetExecutingAssembly(); + + // Find all classes implementing IService marker interface + var serviceTypes = assembly.GetTypes() + .Where(t => t is { IsClass: true, IsAbstract: false } + && t.GetInterfaces().Any(i => i.Name == "IService")); + + foreach (var serviceType in serviceTypes) + { + var interfaceType = serviceType.GetInterfaces() + .FirstOrDefault(i => i.Name == $"I{serviceType.Name}"); + + if (interfaceType != null) + { + services.AddScoped(interfaceType, serviceType); + } + } + + return services; + } +} + +// Usage in Program.cs +builder.Services.AddApplicationServices(); +``` + +**Best Practices:** +- Using assembly scanning will be easier in large projects where many services are used in accordance with the rules. +- Your naming conventions should be clearly documented (for example, all classes ending in "Service" are automatically registered). +- In performance critical scenarios, the assembly scan should be performed carefully to avoid potential problems, as this may result in startup costs. +- For true reflection overhead in .NET 9, consider using source generators. + + +## Best Practices and Common Mistakes + +### Design for Explicit Dependencies + +This principle states that parent modules should not depend directly on lower level modules (such as services for data access, sending email, or specific API clients). Instead, both should depend on abstractions (interfaces). + +This reverses the normal flow of dependencies, decoupling your code and making it more flexible and testable. + +#### Example + +##### Bad: Violates DIP (Tight Coupling) + +Here, the top level `NotificationService` depends directly on the low level, concrete `EmailSender` class. + +```csharp +// Low level service +public class EmailSender +{ + public void SendEmail(string message) + { + Console.WriteLine($"Sending email: {message}"); + } +} + +// High level service +public class NotificationService +{ + // A direct dependency on a CONCRETE class + private readonly EmailSender _emailSender; + + public NotificationService() + { + // The top level class is responsible for creating its own dependencies. + _emailSender = new EmailSender(); + } + + public void NotifyUser(string message) + { + _emailSender.SendEmail(message); + } +} +``` + +**Problems:** + +1. **Difficult to Test:** You will not be able to test `NotificationService` without sending an email. +2. **Not Flexible:** But what if you want to send an SMS instead? You will need to modify the `NotificationService` class. + +##### Good: Following DIP (Loose Coupling) + +Here both classes depend on the `IMessageSender` interface. + +```csharp +// The Abstraction (Interface) +public interface IMessageSender +{ + void Send(string message); +} + +// Low level service (depends on the abstraction) +public class EmailSender : IMessageSender +{ + public void Send(string message) + { + Console.WriteLine($"Sending email: {message}"); + } +} + +// Another low level service +public class SmsSender : IMessageSender +{ + public void Send(string message) + { + Console.WriteLine($"Sending SMS: {message}"); + } +} + +// High level service (also depends on the abstraction) +public class NotificationService +{ + // Dependency is on the Interface, not a concrete class + private readonly IMessageSender _messageSender; + + // The dependency is injected via the constructor + public NotificationService(IMessageSender messageSender) + { + _messageSender = messageSender; + } + + public void NotifyUser(string message) + { + _messageSender.Send(message); + } +} +``` + +**Benefits:** + + * **Flexible:** `NotificationService` doesn't care whether it is `EmailSender` or `SmsSender`. The DI container can be configured to provide both because it is dependent on an interface. + * **Testable:** You can create a `MockMessageSender` class that implements `IMessageSender` to use in your unit tests without sending a real message and perform your operations without needing any real information. + +### Service Disposal and `IAsyncDisposable` + +If your service contains disposable sources (such as network connections or file streams), it must implement `IDisposable` or `IAsyncDisposable`. The DI container will automatically call `Dispose` or `DisposeAsync` for you at the end of the service's lifetime. This is an important behavior to prevent source issues. + +In .NET 9, asynchronous disposal is the preferred model for services that perform I/O operations during cleanup. The container manages both asynchronous and synchronous disposal operations in a controlled manner. + +In this example, `MyNetworkService` gets `HttpClient` via DI (which it will not dispose of) but also creates its own `FileStream` resource, which it is responsible for disposing of asynchronously. + +```csharp +public class MyNetworkService : IAsyncDisposable +{ +    private readonly HttpClient _httpClient; + +    private readonly FileStream _logStream; + private bool _disposed = false; + +    public MyNetworkService(HttpClient httpClient) +    { + _httpClient = httpClient; + + _logStream = new FileStream($"log_{Guid.NewGuid()}.txt", + FileMode.CreateNew, FileAccess.Write, FileShare.None, + 4096, useAsync: true); +    } + +    public async Task FetchDataAsync() +    { + var data = await _httpClient.GetStringAsync("https://api.example.com/data"); + await _logStream.WriteAsync(System.Text.Encoding.UTF8.GetBytes(data)); +        return data; +    } + +    // The container calls this automatically when the scope ends +    public async ValueTask DisposeAsync() +    { + if (_disposed) + { + return; + } + +        // Asynchronous cleanup for resources WE OWN + // We do NOT dispose of _httpClient here. +        await _logStream.FlushAsync(); + await _logStream.DisposeAsync(); +        + _disposed = true; +        GC.SuppressFinalize(this); +    } +} +``` + +**Using `await using` for Manual disposal:** + +When you manually create service instances outside of the DI container, you should use the `await using` syntax to ensure proper asynchronous disposal. + +```csharp +// Assume HttpClient is coming from somewhere +public async Task ProcessDataAsync(HttpClient httpClient) +{ + await using var service = new MyNetworkService(httpClient); + await service.FetchDataAsync(); + // DisposeAsync() is called automatically here +} +``` + +**Best Practices:** +- If your cleanup operation involves asynchronous operations (file I/O, database connections, network calls), it would be more appropriate to implement `IAsyncDisposable`. +- If your service can be used in both synchronous and asynchronous contexts, you can implement both `IDisposable` and `IAsyncDisposable`. +- The DI container will call `DisposeAsync()` if present; otherwise it will fallback to `Dispose()`. +- It is recommended to always call `GC.SuppressFinalize(this)` at the end of your disposal method to avoid unnecessary terminations. + +### Handling Circular Dependencies +A circular dependency occurs when Service A depends on Service B, and Service B, in turn, depends on Service A. The ASP.NET Core container automatically detects this situation during object resolution (at parse time) and throws an `InvalidOperationException` to prevent a stack overflow, usually with a message detailing the dependency loop. + +To resolve this, you must refactor your design to break the circular reference. The most common solution is to introduce a new intermediary abstraction (like an interface) that one of the services can depend on, breaking the direct loop. + +**You Should Avoid Asynchronous Logic in Constructors** +- Constructors must be fast and synchronous. You should not perform `await` or long running operations. +- Asynchronous operation in constructors can lead to deadlocks and unpredictable initialization behavior. + +For asynchronous initialization you should use `IHostedService`, factory patterns or lazy initialization. + +```csharp +// Bad: Async work in constructor +public class BadService +{ + public BadService(IDataService dataService) + { + // This will deadlock or fail! + var data = dataService.GetDataAsync().Result; + } +} + +// Good: Use IHostedService for async initialization +public class GoodInitializationService : IHostedService +{ + private readonly IDataService _dataService; + + public GoodInitializationService(IDataService dataService) + { + _dataService = dataService; + } + + public async Task StartAsync(CancellationToken cancellationToken) + { + // Proper async initialization + var data = await _dataService.GetDataAsync(); + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; +} +``` + +**Captive Dependency Issues** +- It is created by injecting a shorter lived service (Scoped) into a longer lived service (Singleton). +- The scoped service becomes "captive" and lives as long as the singleton service, which can lead to stale data and memory leaks. +- The container's **ValidateScopes** option will detect this at runtime. + +```csharp +// Bad: Scoped service captured by singleton +builder.Services.AddSingleton(); // Holds DbContext forever! +builder.Services.AddScoped(); + +// Good: Use IServiceScopeFactory in singletons +public class MySingletonService +{ + private readonly IServiceScopeFactory _scopeFactory; + + public MySingletonService(IServiceScopeFactory scopeFactory) + { + _scopeFactory = scopeFactory; + } + + public async Task DoWorkAsync() + { + await using var scope = _scopeFactory.CreateAsyncScope(); + var dbContext = scope.ServiceProvider.GetRequiredService(); + // Use dbContext safely within this scope + } +} +``` + +**Avoiding Static Shared State in Singleton Services** +- Singleton services should be stateless or have thread safe state management. +- Avoid using static fields or shared mutable states that can cause race conditions. + +For immutable objects, the `ConcurrentDictionary` or appropriate locking mechanisms must be used. + +```csharp +// Bad: Shared mutable state in singleton +public class BadCacheService +{ + private Dictionary _cache = new(); // Not thread safe! + + public void Add(string key, string value) => _cache[key] = value; +} + +// Good: Thread safe state management +public class GoodCacheService +{ + private readonly ConcurrentDictionary _cache = new(); + + public void Add(string key, string value) => _cache[key] = value; +} +``` + +### Testing, Isolation, and Readability + +One of the primary goals of DI is testability. In integration tests, you can use the WebApplicationFactory to override service registrations with mock applications. + +```csharp +await using var application = new WebApplicationFactory() + .WithWebHostBuilder(builder => + { + builder.ConfigureTestServices(services => + { + services.AddScoped(); + }); + }); +``` + +## Performance Considerations + +The performance of **Dependency injection** in ASP.NET Core is adequate for most applications, but it's worth being aware of the mechanics. + +### Resolution Cost, Service Graph Caching, and Object Pooling + + * **Service Graph Caching:** When a service graph is first parsed, the container creates and caches an execution plan. This plan includes the entire dependency tree and how each object will be created. Subsequent solutions will use this cached plan, making them extremely fast. + * **Transient and Singleton Resolving:** Transient services have a slightly higher creation cost because a new instance is created each time. However, this cost is generally negligible unless you are resolving thousands of transient services per request. + * **Object Pool:** For high performance scenarios, it would be beneficial for performance management to consider using `ObjectPool` from `Microsoft.Extensions.ObjectPool` to reuse expensive objects instead of creating new transient instances. + +### Benchmarking DI Performance + +Here is an example of a minimum benchmark comparing transient and singleton resolution times using `BenchmarkDotNet`. + +```csharp +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Running; +using Microsoft.Extensions.DependencyInjection; + +public class DependencyInjectionBenchmark +{ + private ServiceProvider _serviceProvider = null!; + + [GlobalSetup] + public void Setup() + { + var services = new ServiceCollection(); + services.AddTransient(); + services.AddSingleton(); + services.AddScoped(); + _serviceProvider = services.BuildServiceProvider(); + } + + [Benchmark] + public ITransientService ResolveTransient() + { + return _serviceProvider.GetRequiredService(); + } + + [Benchmark] + public ISingletonService ResolveSingleton() + { + return _serviceProvider.GetRequiredService(); + } + + [Benchmark] + public IScopedService ResolveScoped() + { + using var scope = _serviceProvider.CreateScope(); + return scope.ServiceProvider.GetRequiredService(); + } +} + +public interface ITransientService { } +public class TransientService : ITransientService { } +public interface ISingletonService { } +public class SingletonService : ISingletonService { } +public interface IScopedService { } +public class ScopedService : IScopedService { } + +// Results: +// | Method | Mean | Error | StdDev | +// |----------------- |----------:|---------:|---------:| +// | ResolveSingleton | 3.5 ns | 0.02 ns | 0.02 ns | ← Fastest (cached instance) +// | ResolveTransient | 45.2 ns | 0.31 ns | 0.29 ns | ← Allocation overhead +// | ResolveScoped | 78.4 ns | 0.52 ns | 0.48 ns | ← Scope creation + resolution +``` + +**Key Points:** +- Singleton resolution is almost instantaneous (cached instance invocation). +- Transient solution requires cost but is still fast. +- Scoped solution includes the overhead of creating scope. + +For most applications, these differences are not noticeable. It should only be optimized if profiling reveals that DI is a bottleneck. + + +### Startup Time and Compile Time DI + +Application startup time is the primary driver of performance. .NET uses **Source Generated Dependency Injection** to move dependency graph resolution from runtime to compile time. + +**Benefits:** + - **Faster Startup:** There is no runtime reflection to create the service graph. + - **Reduced Memory Usage:** It produces smaller runtime. + - **AOT Friendly:** Provides support for Native AOT compilation, which is critical for cloud native and containerized applications. + - **Compile Time Validation:** Allows catching missing service records at compile time rather than runtime. + +**How to Enable** + +**1. For Core Dependency Injection (DI) Generation** + +This is used as the main constructor that creates the optimized service provider for `AddScoped`, `AddSingleton`, etc. + + * **Activation** This will be automatically enabled when you publish with native AOT. + * **Project file** + ```xml + +     true + + ``` + +**2. For Configuration Binding Generation** + +This is used to bind settings from sources like `appsettings.json` to your C# classes (`Bind`, `Configure`). + + * **Project file:** + ```xml + +     true + + ``` + +**Example Code (using all generators):** + +```csharp +var builder = WebApplication.CreateBuilder(args); + +// This call is optimized by 'EnableConfigurationBindingGenerator' +builder.Services.Configure(builder.Configuration.GetSection("MyOptions")); + +// These calls are optimized by the Core DI generator (when PublishAot=true) +builder.Services.AddScoped(); +var app = builder.Build(); +``` + +When all generators are enabled, the compiler generates optimized service registration and parsing code, eliminating the reflection overhead. + +**When to Use:** + + - Microservices and serverless functions (when it is desired to minimize cold start time). + - Native AOT scenarios (e.g. containerized applications, edge computing). + - Large applications with complex dependency graphs. + +## Advanced Dependency Injection Patterns in .NET + +### Keyed Services + +Keyed services, introduced in .NET 8, allow you to register multiple implementations of an interface and resolve a specific implementation using a key. This will be a useful feature for polymorphic scenarios where you need to choose a strategy at runtime. + +```csharp +// Registration +builder.Services.AddKeyedSingleton("email"); +builder.Services.AddKeyedSingleton("sms"); + +// Resolution in a consumer class +public class NotificationController([FromKeyedServices("email")] INotificationService emailService) +{ + // ... +} +``` + +### Open Generic Registrations + +To avoid manually registering each generic implementation (e.g., `IRepository`, `IRepository`), you can use an explicit global registration. + +```csharp +// This single line registers the Repository for any T requested via IRepository +builder.Services.AddScoped(typeof(IRepository<>), typeof(Repository<>)); +``` + +### The Decorator Pattern + +Decorators allow you to add functionality to a service without modifying it. This is a perfect example of the Open/Closed Principle. You can register a decorator that wraps the original service and adds cross cutting functionality like logging, caching, or validation. + +**Without third party libraries (manual approach):** + +```csharp +// Original service interface +public interface IOrderProcessor +{ + Task ProcessOrderAsync(Order order); +} + +// Base implementation +public class OrderProcessor : IOrderProcessor +{ + public async Task ProcessOrderAsync(Order order) + { + await Task.Delay(100); + Console.WriteLine($"Order {order.Id} processed."); + } +} + +// Logging decorator +public class LoggingOrderProcessorDecorator : IOrderProcessor +{ + private readonly IOrderProcessor _inner; + private readonly ILogger _logger; + + public LoggingOrderProcessorDecorator(IOrderProcessor inner, ILogger logger) + { + _inner = inner; + _logger = logger; + } + + public async Task ProcessOrderAsync(Order order) + { + _logger.LogInformation("Processing order {OrderId}...", order.Id); + try + { + await _inner.ProcessOrderAsync(order); + _logger.LogInformation("Order {OrderId} processed successfully.", order.Id); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to process order {OrderId}.", order.Id); + throw; + } + } +} + +// Manual registration (layering decorators) +builder.Services.AddScoped(); +builder.Services.AddScoped(provider => +{ + var baseProcessor = provider.GetRequiredService(); + var logger = provider.GetRequiredService>(); + return new LoggingOrderProcessorDecorator(baseProcessor, logger); +}); +``` + +**With Scrutor library (recommended for complex scenarios):** + +```csharp +builder.Services.AddScoped(); +builder.Services.Decorate(); +// Add more decorators +builder.Services.Decorate(); +``` + +**Middleware Integration Context** + +Decorators work in a similar way with ASP.NET Core middleware. While the middleware operates at the HTTP pipeline level, decorators operate at the service level, allowing you to apply cross cutting concerns to business logic independent of HTTP concerns. + +### Conditional Registrations + +You can conditionally register services based on runtime configuration or environment. + +```csharp +var builder = WebApplication.CreateBuilder(args); + +// You can register different applications depending on the environment +if (builder.Environment.IsDevelopment()) +{ + builder.Services.AddScoped(); +} +else +{ + builder.Services.AddScoped(); +} + +// Register based on configuration +var useRedis = builder.Configuration.GetValue("UseRedisCache"); +if (useRedis) +{ + builder.Services.AddStackExchangeRedisCache(options => { /* ... */ }); +} +else +{ + builder.Services.AddDistributedMemoryCache(); +} +``` + +### Child Containers and Nested Scopes + +While the built in ASP.NET Core container doesn't support "subcontainers" like Autofac or other third party containers, you can achieve similar isolation using scopes. + +It's important to differentiate this from the Service Locator anti pattern, which involves directly injecting IServiceProvider to manually resolve dependencies. Instead, the correct approach (especially within Singleton services) is to inject `IServiceScopeFactory`. + +**Comprehensive embedded approach** +```csharp +public class ParentService +{ +    private readonly IServiceScopeFactory _scopeFactory; + +    public ParentService(IServiceScopeFactory scopeFactory) +    { +        _scopeFactory = scopeFactory; +    } + +    public async Task DoIsolatedWorkAsync() +    { +        await using var scope = _scopeFactory.CreateAsyncScope(); + + // Resolve services from the new scope's provider +        var isolatedService = scope.ServiceProvider.GetRequiredService(); +        await isolatedService.DoWorkAsync(); + // All services resolved from 'scope.ServiceProvider' are disposed here +    } +} +``` + +**Third party containers (Autofac example)** +```csharp +// Autofac supports real subcontainers with invalid records +var childLifetimeScope = container.BeginLifetimeScope(builder => +{ + builder.RegisterType().As(); +}); +``` + +The built in container's scoping mechanism is simpler but sufficient for most scenarios. You can use third party containers only when you need advanced features like property injection, assembly scanning with rules, or complex lifetime management. + +### Testing with DI and `ConfigureTestServices` + +One of DI's greatest strengths is testability. In integration tests, you can replace real services with mock or simulated services using WebApplicationFactory and ConfigureTestServices. + +```csharp +using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +public class OrderControllerTests : IClassFixture> +{ + private readonly WebApplicationFactory _factory; + + public OrderControllerTests(WebApplicationFactory factory) + { + _factory = factory; + } + + [Fact] + public async Task ProcessOrder_ReturnsSuccess() + { + //Replace real service with mock + var client = _factory.WithWebHostBuilder(builder => + { + builder.ConfigureTestServices(services => + { + //Remove actual service + services.RemoveAll(); + + // Add mock service + services.AddScoped(); + + // Or use a mocking framework + var mockProcessor = new Mock(); + mockProcessor.Setup(x => x.ProcessOrderAsync(It.IsAny())) + .ReturnsAsync(true); + services.AddScoped(_ => mockProcessor.Object); + }); + }).CreateClient(); + + // Act + var response = await client.PostAsJsonAsync("/api/orders", new Order { Id = 1 }); + + // Assert + response.EnsureSuccessStatusCode(); + } +} +``` + +**Key Benefits:** +- You can replace expensive external dependencies with in memory mocks. +- You can test business logic in isolation. +- You can run fast and accurate tests without needing external dependencies. + +## Example: A Background Service + +A common scenario where DI lifecycle management is critical is with singletons, such as background workers or IHostedServices. You cannot directly add a scoped service like DbContext to this service. Instead, you'd be better off adding an IServiceScopeFactory to manually create scopes. + +**Hosted Service (`OrderProcessorWorker.cs`):** + +```csharp +public class OrderProcessorWorker : BackgroundService +{ + private readonly ILogger _logger; + private readonly IServiceScopeFactory _scopeFactory; + + // Inject IServiceScopeFactory, not DbContext + public OrderProcessorWorker(ILogger logger, IServiceScopeFactory scopeFactory) + { + _logger = logger; + _scopeFactory = scopeFactory; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + _logger.LogInformation("Processing new orders..."); + + // Create a new scope for this unit of work + await using (var scope = _scopeFactory.CreateAsyncScope()) + { + var orderRepository = scope.ServiceProvider.GetRequiredService(); + var newOrders = await orderRepository.GetNewOrdersAsync(); + + foreach (var order in newOrders) + { + // Process order... + } + + await orderRepository.SaveChangesAsync(); + } + + await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken); + } + } +} +``` + +**Registration (`Program.cs`):** + +```csharp +builder.Services.AddDbContext(/* ... */); +builder.Services.AddScoped(); +builder.Services.AddHostedService(); +``` + +This pattern ensures that each run of the worker uses a new `DbContext`, preventing problems such as memory leaks or stale data. + +> While this example uses a simple `Task.Delay` loop within the `BackgroundService`, a robust pattern for managing decoupled background tasks involves an in memory queue. You can learn how to build this system by following this guide: [How to Build an In Memory Background Job Queue in ASP.NET Core From Scratch](https://abp.io/community/articles/how-to-build-an-in-memory-background-job-queue-in-asp.net-core-from-scratch-pai2zmtr). + +## Conclusion + +Understanding the **ASP.NET Core Dependency Injection** framework is essential for any .NET developer. By understanding the built in IoC container, choosing the right service lifecycles, and opting for explicit constructor injection, you can create modular, testable, and maintainable applications. + +**.NET brings significant enhancements to the DI ecosystem** + +- **Source Generated DI** for faster startup and Native AOT support +- **Keyed Services** for advanced polymorphic resolution scenarios +- **Enhanced lifetime validation** catches captive dependencies at development time +- **Improved `IAsyncDisposable`** support for proper source cleanup* +- **Good integration with C# features** such as primary constructors + +By embracing these features and implementing patterns such as decorators, manual scoping with `IServiceScopeFactory`, the Option Pattern for configuration, and proper asynchronous disposal, you can solve complex architectural challenges cleanly and efficiently. + +**Key Points** + +- **Always inject dependencies via constructors** explicit, immutable, testable +- **Understanding lifetime implications** avoid dependent dependencies, you can use `IServiceScopeFactory` on singletons +- **Leverage the Option Pattern** type safe, validated configuration injection +- **You can use TryAdd methods** create mergeable records +- **Leverage DI in your tests** you can use `ConfigureTestServices` to inject mocks +- **Measure performance first; don't assume DI is a bottleneck** The internal container is efficient. Use a profiler to find real slowdowns before trying to optimize DI. +- **Consider source generation** for microservices, serverless and AOT scenarios + +The transition from legacy, fragmented DI environments to a unified, performant, and compile time optimized dependency injection system represents a significant development in the platform's history. Understanding and leveraging these capabilities is crucial for building high performance, cloud native .NET applications. + +### Further Reading + +- [ABP Dependency Injection](https://abp.io/docs/10.0/framework/fundamentals/dependency-injection) +- [Official Microsoft Docs on Dependency Injection in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) +- [Source Generators for Dependency Injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines) +- [IHttpClientFactory with .NET](https://learn.microsoft.com/en-us/dotnet/core/extensions/httpclient-factory) +- [Keyed Services DI Container](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-9.0#keyed-services) +- [Use Scoped Services Within a Scoped Service](https://learn.microsoft.com/en-us/dotnet/core/extensions/scoped-service) +- [Scrutor](https://github.com/khellang/Scrutor) diff --git a/docs/en/Community-Articles/2025-10-20-Uncovering-ABP-Hidden-Magic/Post.md b/docs/en/Community-Articles/2025-10-20-Uncovering-ABP-Hidden-Magic/Post.md new file mode 100644 index 0000000000..c19af4d7b7 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-20-Uncovering-ABP-Hidden-Magic/Post.md @@ -0,0 +1,102 @@ +# Uncovering ABP’s Hidden Magic: Supercharging ASP.NET Core Development +Experienced back-end developers often approach new frameworks with healthy skepticism. But many who try the ABP Framework quickly notice something different: things “just work” with minimal boilerplate. There’s a good reason ABP can feel magical – it silently handles a host of tedious tasks behind the scenes. In this article, we’ll explore how ABP’s out-of-the-box features and modular architecture dramatically boost productivity. We’ll compare with plain ASP.NET Core where relevant, so you can appreciate what ABP is doing for you under the hood. + +## Beyond the Basics: Why ABP Feels Magical +ABP isn’t a typical library; it’s a full application framework that goes beyond the basics. From the moment you start an ABP project, a lot is happening automatically. Have you ever built an ASP.NET Core app and spent time wiring up cross-cutting concerns like error handling, logging, security tokens, or multi-tenancy? With ABP, much of that comes pre-configured. You might find that you write just your business logic, and ABP has already enabled security, transactions, and even APIs for you by convention. This can be disorienting at first (“Where’s the code that does X?”) until you realize ABP’s design is doing it for you, in line with best practices. + +For example, ABP completely automates CSRF (anti-forgery) protection and it works out-of-the-box without any configuration. In a plain ASP.NET Core project, you’d have to add anti-forgery tokens to your views or enable a global filter and manually include the token in AJAX calls. ABP’s startup template already includes a global antiforgery filter and even sets up the client-side code to send the token on each request, without you writing a line. This kind of “invisible” setup is repeated across many areas. ABP’s philosophy is to take care of the plumbing – like unit of work, data filters, audit logging, etc. – so you can focus on the real code. It feels magical because things that would normally require explicit code or packages in ASP.NET Core are just handled. As we peel back the layers in the next sections, you’ll see how ABP pulls off these tricks. + +## Zero to Hero: Rapid Application Development with ABP +One of the most striking benefits of ABP is how quickly you can go from zero to a fully functional application – it’s a true rapid application development platform. With ASP.NET Core alone, setting up a new project with identity management, localization, an API layer, and a clean architecture can be a day’s work or more. In contrast, ABP’s startup templates give you a solution with all those pieces pre-wired. You can create a new ABP project (using the ABP CLI or ABP Studio) and run it, and you already have: user login and registration, role-based permission management, an admin UI, a REST API layer with Swagger, and a clean domain-driven code structure. It’s essentially a jump-start that takes you from zero to hero in record time. + +Rapid development is further enabled by ABP’s coding model. Define an entity and an application service, and ABP can generate the REST API endpoints for you automatically (via Conventional Controllers). You don’t need to write repetitive controllers that just call the service; ABP’s conventions map your service methods to HTTP verbs and routes by naming convention. For instance, a method name `GetListAsync()` in an `AppService` becomes an HTTP `GET` to `/api/app/your-entity` without extra attributes. The result: you implement application logic once in the application layer, and ABP instantly exposes it as an API (and even provides client proxies for UI). + +The tooling in the ABP ecosystem multiplies this productivity. The ABP Suite tool, for example, allows you to visually design entities and then generate a full-stack CRUD page for your entities in seconds, complete with UI forms, validation, DTOs, application services, and even unit tests. The generated code follows ABP’s best practices (layered architecture, proper authorization checks, etc.), so you’re not creating a maintenance headache. You get a working feature out-of-the-box and can then tweak it to your needs. All these accelerators mean you can deliver features at a higher velocity than ever, turning a blank project into a real application with minimal grunt work. + +## Modular Architecture: Building Like Digital Lego +Perhaps the greatest strength of ABP is its modular architecture. Think of modules as building blocks – “digital Lego” pieces – that you can snap together to compose your application. ABP itself is built on modules (for example, Identity, Audit Logging, Language Management, etc.), and you can develop your own modules as well. This design encourages separation of concerns and reusability. Need a certain functionality? Chances are, ABP has a module for it – just plug it in, and it works seamlessly with the others. + +With plain ASP.NET Core, setting up a modular system requires a lot of upfront design. ABP, however, “is born to be a modular application development structure”, where every feature is compatible with modular development by default. The framework ensures that each module can encapsulate its own domain, application services, database migrations, UI pages, etc., without tight coupling. For example, the ABP Identity module provides all the user and role management functionality (built atop ASP.NET Core Identity), the SaaS module provides multi-tenant management, the Audit Logging module records user activities, and so on. You can include these modules in your project, gaining enterprise-grade functionality in literally one line of configuration. As the official documentation puts it, ABP provides “a lot of re-usable application modules like payment, chat, file management, audit log reporting… All of these modules are easily installed into your solution and directly work.” This is a huge time saver – you’re not reinventing the wheel for common requirements. + +The Lego-like nature also means you can remove or swap pieces without breaking the whole. If a built-in module doesn’t meet your needs, you can extend it or replace it (we’ll talk about customization later). Modules can even be maintained as separate packages, enabling teams to develop features in isolation and share modules across projects. Ultimately, ABP’s modularity gives your architecture a level of flexibility and organization that plain ASP.NET Core doesn’t provide out-of-the-box. It’s a solid foundation for either monolithic applications or microservice systems, as you can start with a modular monolith and later split modules into services if needed. In short, ABP provides the architectural “bricks” – you design the house. + +## Out-of-the-Box Features that Save Weeks of Work +Beyond the big building blocks, ABP comes with a plethora of built-in features that operate behind the scenes to save you time. These are things that, in a non-ABP project, you would likely spend days or weeks implementing and fine-tuning – but ABP gives them to you on Day 1. Here are some of the key hidden gems ABP provides out-of-the-box: + +- CSRF Protection: As mentioned earlier, ABP automatically enables anti-forgery tokens for you. You get robust CSRF/XSRF protection by default – the server issues a token cookie and expects a header on modify requests, all handled by ABP’s infrastructure without manual setup. This means your app is defended against cross-site request forgery with essentially zero effort on your part. +- Automated Data Filtering: ABP uses data filters to transparently apply common query conditions. For example, if an entity implements `ISoftDelete`, it will not be retrieved in queries unless you explicitly ask for deleted data. ABP automatically sets `IsDeleted=true` instead of truly deleting and filters it out on queries, so you don’t accidentally show or modify soft-deleted records. Similarly, if an entity implements `IMultiTenant`, ABP will “silently in the background” filter all queries to the current tenant and fill the `TenantId` on new records – no need to manually add tenant clauses to every repository query. These filters (and others) are on by default and can be toggled when needed, giving you multi-tenancy and soft delete behavior out-of-the-box. +- Concurrency Control: In enterprise apps, it’s important to handle concurrent edits to avoid clobbering data. ABP makes this easy with an optimistic concurrency system. If you implement `IHasConcurrencyStamp` on an entity, ABP will automatically set a GUID stamp on insert and check that stamp on updates to detect conflicts, throwing an exception if the record was changed by someone else. In ASP.NET Core EF you’d set up a RowVersion or concurrency token manually – ABP’s built-in approach is a ready-to-use solution to ensure data consistency. +- Data Seeding: Most applications need initial seed data (like an admin user, initial roles, etc.). ABP provides a modular data seeding system that runs on application startup or during migration. You can implement an `IDataSeedContributor` and ABP will automatically discover and execute it as part of the seeding process. Different modules add their own seed contributors (for example, the Identity module seeds the admin user/role). This system is database-independent and even works in production deployments (the templates include a DbMigrator tool to apply migrations and seed data). It’s more flexible than EF Core’s native seeding and saves you writing custom seeding scripts. +- Audit Logging: ABP has an integrated auditing mechanism that logs details of each web request. By default, an audit log is created for each API call or MVC page hit, recording who did what and when. It captures the URL and HTTP method, execution duration, the user making the call, the parameters passed to application services, any exceptions thrown, and even entity changes saved to the database during the request. All of this is saved automatically (for example, into the AbpAuditLogs table if using EF Core). The startup templates enable auditing by default, so you have an audit trail with no extra coding. In a vanilla ASP.NET Core app, you’d have to implement your own logging to achieve this level of detail. +- Unit of Work & Transaction Management: ABP implements the Unit of Work pattern globally. When you call a repository or an application service method, ABP will automatically start a UOW (database transaction) for you if one isn’t already running. It will commit on success or roll back on error. By convention, all app service methods, controller actions, and repository methods are wrapped in a UOW – so you don’t explicitly call SaveChanges() or begin transactions in most cases. For example, if you create or update multiple entities in an app service method, they either all succeed or all fail as a unit. This behavior is there “for free”, whereas in raw ASP.NET Core you’d be writing try/catch and transaction code around such operations. (ABP even avoids opening transactions on read-only GET requests by default for performance.) +- Global Exception Handling: No need to write a global exception filter – ABP provides one. If an unhandled exception occurs in an API endpoint, ABP’s exception handling system catches it and returns a standardized error response in JSON. It also maps known exception types to appropriate HTTP status codes and can localize error messages. This means your client applications always get a clean, consistent error format (with an error code, message, validation details, etc.) instead of ugly stack traces or HTML error pages. Internally, ABP logs the error details and hides the sensitive info from the client by default. Essentially, you get production-ready error handling without writing it yourself. +- Localization & Multi-Language Support: ABP’s localization system is built on the .NET localization extension but adds convenient enhancements. It automatically determines the user’s language/culture for each request (by checking the browser or tenant settings) and you can define localization resources in JSON files easily. ABP supports database-backed translations via the Language Management module as well. From day one, your app is ready to be translated – even exception messages and validation errors are localization-friendly. The default project template sets up a default resource and uses it for all framework-provided texts, meaning things like error messages or menu items are already localized (and you can add new languages through the UI if you include the module). In short, ABP bakes in multi-lingual capabilities so you don’t have to internationalize your app from scratch. +- Background Jobs: Need to run tasks in the background (e.g. send emails, generate reports) without blocking the user? ABP has a built-in background job infrastructure. You can simply implement a job class and enqueue it via `IBackgroundJobManager`. By default, jobs are persisted and executed, and ABP has providers to integrate with popular systems like Hangfire, RabbitMQ and Quartz if you need scalability. For example, sending an email after a user registers can be offloaded to a background job with one method call. ABP will handle retries on failure and storing the job info. This saves you the effort of configuring a separate job runner or scheduler – it’s part of the framework. +- Security & Defaults: ABP comes with sensible security defaults. It’s integrated with ASP.NET Core Identity, so password policies, lockout on multiple failed logins, and other best practices are in place by default. The framework also adds standard security headers to HTTP responses (against XSS, clickjacking, etc.) through its startup configuration. Additionally, ABP’s permission system is pre-configured: every module brings its own permission definitions, and you can easily check permissions with an attribute or method call. There’s even a built-in Permission Management UI (if you include the module) where you can grant or revoke permissions per role or user at runtime. All these defaults mean a lot of the “boring” but critical security work is done for you. +- Paging & Query Limiting: ABP encourages efficient data access patterns. For list endpoints, the framework DTOs usually include paging parameters (MaxResultCount, SkipCount), and if you don't specify them, ABP will assume default values (often 10). ABP also enforces an upper limit on how many records can be requested in a single call, preventing potential performance issues from overly large queries. This protects your application from accidentally pulling thousands of records in one go. Of course, you can configure or override these limits, but the safe defaults are there to protect your application. + +That’s a long list – and it’s not even exhaustive – but the pattern is clear. ABP spares you from writing a lot of infrastructure and “glue” code. And if you do need multi-tenancy (or any of these advanced features), the time savings grow even more. These out-of-the-box capabilities let you focus on your business logic, since the baseline features are already in place. Next, let’s zoom in on a couple of these areas (like multi-tenancy and security) that typically cause headaches in pure ASP.NET Core but are a breeze with ABP. + +## Seamless Multi-Tenancy: Scaling Without the Headaches +Multi-tenant architecture – supporting multiple isolated customers (tenants) in one application – is notoriously tricky to implement from scratch. You have to partition data per tenant, ensure no cross-tenant data leaks, manage connection strings if using separate databases, and adapt authentication/authorization to be tenant-aware. ABP Framework makes multi-tenancy almost trivial in comparison. + +Out of the box, ABP supports both approaches to multi-tenancy: single database with tenant segregation and separate databases per tenant, or even a hybrid of the two. If you go the single database route, as many SaaS apps do for simplicity, ABP will ensure every entity that implements the tenant interface (`IMultiTenant`) gets a `TenantId` value and is automatically filtered. As we touched on earlier, you don’t have to manually add `.Where(t => t.TenantId == currentTenant.Id)` on every query – ABP’s data filter does that behind the scenes based on the logged-in user’s tenant. If a user from Tenant A tries to access Tenant B’s data by ID, they simply won’t find it, because the filter is in effect on all repositories. Similarly, when saving data, ABP sets the `TenantId` for you. This isolation is enforced at the ORM level by ABP’s infrastructure. + +For multiple databases, ABP’s SaaS (Software-as-a-Service) module handles tenant management. At runtime, the framework can switch the database connection string based on the tenant context. In the ABP startup template, there’s a “tenant management” UI that lets an admin add new tenants and specify their connection strings. If a connection string is provided, ABP will use that database for that tenant’s data. If not, it falls back to the default shared database. Remarkably, from a developer’s perspective, the code you write is the same in both cases – ABP abstracts the difference. In practice, you just write repository queries as usual; ABP will route those to the appropriate place and filter as needed. + +Another pain point that ABP solves is making other subsystems tenant-aware. For example, ASP.NET Core Identity (for user accounts) isn’t multi-tenant by default, and neither is Keycloak, IdentityServer or OpenIddict (for authentication). ABP takes care of configuring these to work in a tenant context. When a user logs in, they do so with a tenant domain or tenant selection, and the identity system knows about the tenant. Permissions in ABP are also tenant-scoped by default – a tenant admin can only manage roles/permissions within their tenant, for instance. ABP’s modules are built to respect tenant boundaries out-of-the-box. + +What does all this mean for you? It means you can offer a multi-tenant SaaS solution without writing the bulk of the isolation logic. Instead of spending weeks on multi-tenancy infrastructure, you essentially flip a switch in ABP (enable multi-tenancy, use the SaaS module) and focus on higher-level concerns. + +## Security That Works Without the Pain +Security is one area you do not want to get wrong. With plain ASP.NET Core, you have great tools (Identity, etc.) at your disposal, but a lot of configuration and integration work to tie them together in a full application. ABP takes the sting out of implementing security by providing a comprehensive, pre-integrated security model. + +To start, ABP’s application templates include the Identity Module, which is a ready-made integration of ASP.NET Core Identity (the membership system) with ABP’s framework. You get user and role entities extended to fit in ABP’s domain model, and a UI for user and role management. All the heavy lifting of setting up identity tables, password hashing, email confirmation, two-factor auth, etc. is done. The moment you run an ABP application, you can log in with the seeded admin account and manage users and roles through a built-in administration page. This would take significant effort to wire up yourself in a new ASP.NET Core app; ABP gives it to you out-of-the-box. + +Permission management is another boon. In an ABP solution, you don’t have to hard-code what each role can do – instead, ABP provides a declarative way to define permissions and a UI to assign those permissions to roles or users. The Permission Management module’s UI allows dynamic granting/revoking of permissions. Under the hood, ABP’s authorization system will automatically check those permissions when you annotate your application services or controllers with [Authorize] and a policy name (the policy maps to a permission). For example, you might declare a permission Inventory.DeleteProducts. In your ProductAppService’s DeleteAsync method, you add [Authorize("Inventory.DeleteProducts")]. ABP will ensure the current user has that permission (through their roles or direct assignment) before allowing the method to execute. If not, it throws a standardized authorization exception. This is standard ASP.NET Core policy-based auth, but ABP streamlines defining and managing the policies by its permission system. The result: secure by default – it’s straightforward to enforce role-based access control throughout your application, and even non-developers (with access to the admin UI) can adjust permissions as requirements evolve. + +We already discussed CSRF protection, but it’s worth reiterating in the security context: ABP saves you from common web vulnerabilities by enabling defenses by default. Anti-forgery tokens are automatic, and output encoding (to prevent XSS) is naturally handled by using Razor Pages or Angular with proper binding (framework features that ABP leverages). ABP also sets up ASP.NET Core’s Data Protection API for things like cookie encryption and CSRF token generation behind the scenes in its startup, so you get a proper cryptographic key management for free. + +Another underappreciated aspect is exception shielding. In development, you want to see detailed errors, but in production you should not reveal internal details (stack traces, etc.) to the client. ABP’s exception filter will output a generic error message to the client while logging the detailed exception on the server. This prevents information leakage that attackers could exploit, without you having to configure custom middleware or filters. + +On the topic of authentication: ABP supports modern authentication scenarios too. If you want to build a microservice or single-page app (SPA) architecture, ABP provides modules for OpenID Connect and OAuth2 protocol implementations. The ABP Commercial version even provides an OpenIddict setup out-of-the-box for issuing JWTs to SPAs or mobile apps. This means you can stand up a secure token service and resource servers with minimal configuration. With ABP, much of the configuration (clients, scopes, grants) is abstracted by the framework. + +In short, ABP’s approach to security is holistic and follows the mantra of secure by default. New ABP developers are often pleasantly surprised that they didn’t have to spend days on user auth or protecting API endpoints – it’s largely handled. Of course, you still design your authorization logic (defining who can do what), but ABP provides the scaffolding to enforce it consistently. The painful parts of security – getting the plumbing right – are taken care of, so you can focus on the policies and rules that matter for your domain. This dramatically lowers the risk of security holes compared to rolling it all yourself. + +## Customization Without Chaos +With all this magic happening automatically, you might wonder: “What if I need to do it differently? Can I customize or override ABP’s behavior?” The answer is a resounding yes. ABP is designed with extension points and configurability in mind, so you can change the defaults without hacking the framework. This is important for keeping your project maintainable – you get ABP’s benefits, but you’re not boxed in when requirements demand a change. + +One way ABP enables customization is through its powerful dependency injection system and the modular structure. Because each feature is delivered via services (interfaces and classes) in DI, you can replace almost any ABP service with your own implementation if needed. For example, if you want to change how the IdentityUserAppService (the service behind user management) works, you can create your own class inheriting or implementing the same interface, and register it with `Dependency(ReplaceServices = true)`. ABP will start using your class in place of the original. This is an elegant way to override behavior without modifying ABP’s source – keeping you on the upgrade path for new versions. ABP’s team intentionally makes most methods virtual to support overriding in derived classes. This means you can subclass an ABP application service or domain service and override just the specific method you need to change, rather than writing a whole service from scratch. + + +Beyond swapping out services, ABP offers configuration options for its features. Virtually every subsystem has an options class you can configure in your module startup. Not liking the 10-item default page size? You can change the default MaxResultCount. Want to disable a filter globally? You can toggle, say, soft-delete filtering off by default using `AbpDataFilterOptions`. Need to turn off auditing for certain operations? Configure `AbpAuditingOptions` to ignore them. These options give you a lot of control to tweak ABP’s behavior. And because they’re central configurations, you aren’t scattering magic numbers or settings throughout your code – it’s a structured approach to customization. + +Another area is UI and theming. ABP’s UI (if you use the integrated UI) is also modular and replaceable. You can override Razor components or pages from a module by simply re-declaring them in your web project. For instance, if you want to modify the login page from the Account module, you can add a Razor page with the same path in your web layer – ABP will use yours instead of the default. The documentation has guidance on how to override views, JavaScript, CSS, etc., in a safe manner for Angular, Blazor, and MVC. The LeptonX theme that ABP uses can be customized via SCSS variables or entirely new theme derivations. The key point is, you’re never stuck with the “out-of-the-box” look or logic if it doesn’t fit your needs. ABP gives you the foundation, and you’re free to build on top of it or change it. + +The best part? These customizations stay clean and organized. ABP's extension patterns prevent your project from becoming a mess of patches. When ABP releases updates, your overrides remain intact – no more copy-pasting framework code or dealing with merge conflicts. You get ABP's smart defaults plus the freedom to customize when needed. + +## Ecosystem Power: ABP’s Tools, Templates, and Integrations +ABP is more than just a runtime framework; it’s surrounded by an ecosystem of tools and libraries that amplify productivity. We’ve touched on a few (like the ABP Suite code generator), but let’s look at the broader ecosystem that comes with ABP. + +- Project Templates: ABP provides multiple startup templates (via the ABP CLI or Studio) for different architectures – from a simple monolithic web app to a layered modular monolith, or even a microservice-oriented solution with multiple projects pre-configured. These templates are not empty skeletons; they include working examples of authentication, a UI theme, navigation, and so on for your own modules. The microservice template, for instance, sets up separate identity, administration, and SaaS services with communication patterns already wired. Using these templates can save you a huge amount of setup time and ensure you follow best practices from the get-go. +- ABP CLI: The command-line tool abp is a developer’s handy companion. With it, you can generate new solutions or modules, add package references, update your ABP version, and even client proxy generations with simple commands. +- ABP Studio: It is a cross-platform desktop environment designed to make working with ABP solutions smoother and more insightful. It provides a unified UI to create, run, monitor, and manage your ABP projects – whether you're building a monolith or a microservice system. With features like a real-time Application Monitor, Solution Runner, and Kubernetes integration, it brings operational visibility and ease-of-use to development workflows. Studio also includes tools for managing modules, packages, and even launching integrated tools like ABP Suite – all from a single place. Think of it as a control center for your ABP solutions. +- ABP Suite: It is a powerful visual tool (included in PRO licenses) that helps you generate full-stack CRUD pages in minutes. Define your entities, their relationships, and hit generate – ABP Suite scaffolds everything from the database model to the HTTP APIs, application services, and UI components. It supports one-to-many and many-to-many relationships, master-detail patterns, and even lets you generate from existing database tables. Developers can customize the generated code using predefined hook points that persist across regenerations. +- 3rd-Party Integrations: Modern applications often need to integrate with messaging systems, distributed caching, search engines, etc. ABP recognizes this and provides integration packages for many common technologies. Want to use RabbitMQ for event bus or background jobs? ABP has you covered. The same goes for others: ABP has modules or packages for Redis caching, Kafka distributed event bus, SignalR real-time hubs, Twilio SMS, Stripe payments, and more. Each integration is done in a way that it feels like a natural extension of the ABP environment (for example, using the same configuration system and dependency injection). This saves you from writing repetitive integration code or dealing with each library’s nuances in every project. +- UI Themes and Multi-UI Support: ABP comes with a modern default theme (LeptonX) for web applications, and it supports Angular, MVC/Razor Pages and Blazor out-of-the-box. If you prefer Angular for frontend, ABP offers an Angular UI package that works with the same backend. There’s also support for mobile via React Native or MAUI templates. The ability to switch UI front-ends (or even support multiple simultaneously, e.g. an Angular SPA and a Blazor server app using the same API) is facilitated by ABP’s API and authentication infrastructure. This dramatically reduces the friction when setting up a new client application – you don’t have to hand-roll API clients or auth flows. +- Community and Samples: While not a tool per se, the ABP community is part of the ecosystem and adds a lot of value. There are official sample projects (like eShopOnAbp, a full microservice reference application) and many community-contributed modules on GitHub. The consistency of ABP’s structure means community modules or examples are easier to understand and plug in. Being in a community where “everyone follows similar coding styles and principles” means code and knowledge are highly transferable. Developers share open source ABP modules (for example, there are community modules for things like blob storage management, setting UI, React frontend support, etc., beyond the official ones). This network effect is an often overlooked part of the ecosystem: as ABP’s adoption grows, so do the resources you can draw on, from Q&A to reusable code. + +In summary, ABP’s ecosystem provides a full-platform experience. It’s not just the core framework, but also the tooling to work with that framework efficiently and the integrations to connect it with the wider tech world. By using ABP, you’re not piecing together disparate tools – you have a coherent set of solutions designed to work in concert. This is the kind of ecosystem that traditionally only large enterprises or opinionated tech stacks provided, but ABP makes it accessible in the .NET open-source space. It supercharges development in a way that goes beyond just writing code faster; it’s about having a robust infrastructure around your code, so you can deliver more value with less guesswork. + +## Developer Happiness: The Hidden Productivity Boost +All these features and time-savers aren’t just about checking off technical boxes – they have a profound effect on developer happiness and productivity. When a framework handles the heavy lifting and enforces good practices, developers can spend more time on interesting problems (and less on boilerplate or bug-hunting). ABP’s “hidden” features – the things that work without you even noticing – contribute to a less stressful development experience. + +Think about the common sources of frustration in back-end development: security holes that come back to bite you, race conditions or transaction bugs, deployment issues because some configuration was missed, writing the same logging or exception handling code in every project… ABP’s approach preempts many of these. There’s confidence in knowing that the framework has built-in solutions for common pitfalls. For instance, you’re less likely to have a data inconsistency bug because ABP’s unit of work ensured all your DB operations were atomic. This confidence means developers can focus on delivering features rather than constantly firefighting or re-architecting core pieces. + +Another aspect of developer happiness is consistency. ABP provides a uniform structure – every module has the same layering (Domain, Application, etc.), every web endpoint returns a standard response, and so on. Once you learn the patterns, you can navigate and contribute to any part of an ABP application with ease. New team members or even outside contributors ramp up faster because the project structure is familiar (it’s the ABP structure). This reduces the bus factor and onboarding time on teams – a source of relief for developers and managers alike. + +Moreover, by taking away a lot of the “yak shaving” (the endless setup tasks), ABP lets you as a developer spend your energy on creative problem-solving and delivering value. It’s simply more fun to develop when you can swiftly implement a feature without being bogged down in plumbing code. The positive feedback loop of having working features quickly (thanks to things like ABP Suite, or just the rapid scaffolding of ABP) can be very motivating. It feels like you have an expert co-pilot who has already wired the security system, laid out the architecture, and packed the toolkit with everything you need – so you can drive the project forward confidently. + +Finally, the community support adds to this happiness. There’s a thriving Discord server and forum where ABP developers help each other. Since ABP standardizes a lot, advice from one person’s experience often applies directly to your scenario. That sense of not being alone when you hit a snag – because others likely encountered and solved it – reduces anxiety and speeds up problem resolution. It’s the kind of developer experience where things “just work,” and when they occasionally don’t, you have a clear path to figure it out (good docs, support, community). In the daily life of a software developer, this can make a huge difference. + +In conclusion, ABP’s multitude of behind-the-scenes features are not about making the framework look impressive on paper – they’re about making you, the developer, more productive and happier in your job. By handling the boring, complex, or repetitive stuff, ABP lets you focus on building great software. It’s like having a teammate who has already done half the work before you even start coding. When you combine that with ABP’s extensibility and strong foundation, you get a framework that not only accelerates development but also encourages you to do things the right way. For experienced engineers and newcomers alike, that can indeed feel a bit like magic. But now that we’ve uncovered the “magic tricks” ABP is doing under the hood, you can fully appreciate how it all comes together – and decide if this framework’s approach aligns with your goals of building applications faster, smarter, and with fewer headaches. Chances are, once you experience the productivity boost of ABP, you won’t want to go back. Happy coding! diff --git a/docs/en/Community-Articles/2025-10-20-Uncovering-ABP-Hidden-Magic/cover-image.jpg b/docs/en/Community-Articles/2025-10-20-Uncovering-ABP-Hidden-Magic/cover-image.jpg new file mode 100644 index 0000000000..0e1d537f72 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-20-Uncovering-ABP-Hidden-Magic/cover-image.jpg differ diff --git a/docs/en/Community-Articles/2025-10-31-Exceptions-vs-Return-Codes/Cover.png b/docs/en/Community-Articles/2025-10-31-Exceptions-vs-Return-Codes/Cover.png new file mode 100644 index 0000000000..01f7ec061c Binary files /dev/null and b/docs/en/Community-Articles/2025-10-31-Exceptions-vs-Return-Codes/Cover.png differ diff --git a/docs/en/Community-Articles/2025-10-31-Exceptions-vs-Return-Codes/Post.md b/docs/en/Community-Articles/2025-10-31-Exceptions-vs-Return-Codes/Post.md new file mode 100644 index 0000000000..3cfbd146b0 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-31-Exceptions-vs-Return-Codes/Post.md @@ -0,0 +1,98 @@ +# **Return Code vs Exceptions: Which One is Better?** + +Alright, so this debate pops up every few months on dev subreddits and forums + +> *Should you use return codes or exceptions for error handling?* + +And honestly, there’s no %100 right answer here! Both have pros/cons, and depending on the language or context, one might make more sense than the other. Let’s see... + +------ + +## 1. Return Codes --- Said to be "Old School Way" --- + +Return codes (like `0` for success, `-1` for failure, etc.) are the OG method. You mostly see them everywhere in C and C++. +They’re super explicit, the function literally *returns* the result of the operation. + +### ➕ Advantages of returning codes: + +- You *always* know when something went wrong +- No hidden control flow — what you see is what you get +- Usually faster (no stack unwinding, no exception overhead) +- Easy to use in systems programming, embedded stuff, or performance-critical code + +### ➖ Disadvantages of returning codes: + +- It’s easy to forget to check the return value (and boom, silent failure 😬) +- Makes code noisy... Everry function call followed by `if (result != SUCCESS)` gets annoying +- No stack trace or context unless you manually build one + +**For example:** + +```csharp +try +{ + await SendEmailAsync(); +} +catch (Exception e) +{ + Log.Exception(e.ToString()); + return -1; +} +``` + +Looks fine… until you forget one of those `if` conditions somewhere. + +------ + +## 2. Exceptions --- The Fancy & Modern Way --- + +Exceptions came in later, mostly with higher-level languages like Java, C#, and Python. +The idea is that you *throw* an error and handle it *somewhere else*. + +### ➕ Advantages of throwing exceptions: + +- Cleaner code... You can focus on the happy path and handle errors separately +- Can carry detailed info (stack traces, messages, inner exceptions...) +- Easier to handle complex error propagation + +### ➖ Disadvantages of throwing exceptions: + +- Hidden control flow — you don’t always see what might throw +- Performance hit (esp. in tight loops or low-level systems) +- Overused in some codebases (“everything throws everything”) + +**Example:** + +```csharp +try +{ + await SendEmailAsync(); +} +catch (Exception e) +{ + Log.Exception(e.ToString()); + throw e; +} +``` + +Way cleaner, but if `SendEmailAsync()` is deep in your call stack and it fails, it can be tricky to know exactly what went wrong unless you log properly. + +------ + +### And Which One’s Better? ⚖️ + +Depends on what you’re building. + +- **Low-level systems, drivers, real-time stuff 👉 Return codes.** Performance and control matter more. +- **Application-level, business logic, or high-level APIs 👉 Exceptions.** Cleaner and easier to maintain. + +And honestly, mixing both sometimes makes sense. +For example, you can use return codes internally and exceptions at the boundary of your API to surface meaningful errors to the user. + +------ + +### Conclusion + +Return codes = simple, explicit, but messy.t +Exceptions = clean, powerful, but can bite you. +Use what fits your project and your team’s sanity level 😅. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/bento.png b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/bento.png new file mode 100644 index 0000000000..bb16a71259 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/bento.png differ diff --git a/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/dark-mode.png b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/dark-mode.png new file mode 100644 index 0000000000..612a786a71 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/dark-mode.png differ diff --git a/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/large.png b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/large.png new file mode 100644 index 0000000000..544214db08 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/large.png differ diff --git a/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/post.md b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/post.md new file mode 100644 index 0000000000..e0f9ec3b5f --- /dev/null +++ b/docs/en/Community-Articles/2025-11-05-UI-UX-Trends-That-Will-Shape-2026/post.md @@ -0,0 +1,112 @@ +# UI & UX Trends That Will Shape 2026 + +Cinematic, gamified, high-wow-factor websites with scroll-to-play videos or scroll-to-tell stories are wonderful to experience, but you won't find these trends in this article. If you're interested in design trends directly related to the software world, such as **performance**, **accessibility**, **understandability**, and **efficiency**, grab a cup of coffee and enjoy. + +As we approach the end of 2025, I'd like to share with you the most important user interface and user experience design trends that have become more of a **toolkit** than a trend, and that continue to evolve and become a part of our lives. I predict we'll see a lot of them in 2026\. + +## 1\. Simplicity and Speed ​​ + +Designing understandable and readable applications is becoming far more important than designing in line with trends and fashion. In the software and business world, preferences are shifting more and more toward the **right design** over the cool design. As designers developing a product whose direct target audience is software developers, we design our products for the designers' enjoyment, but for the **end user's ease of use**. + +Users no longer care so much about the flashiness of a website. True converts are primarily interested in your product, service, or content. What truly matters to them is how easily and quickly they can access the information they're looking for. + +More users, more sales, better promotion, and a higher conversion rate... The elements that serve these goals are optimized solutions and thoughtful details in our designs, more than visual displays. + +If the "loading" icon appears too often on your digital product, you might not be doing it right. If you fail to optimize speed, the temporary effect of visual displays won't be enough to convert potential users into customers. Remember, the moment people start waiting, you've lost at least half of them. + +## 2\. Dark Mode \- Still, and Forever +![data-model](./dark-mode.png) + +Dark Mode is no longer an option; it's a **standard**. It's become a necessity, not a choice, especially for users who spend hours staring at screens and are accustomed to dark themes in code editors and terminals. However, the approach to dark mode isn't simply about inverting colors; it's much deeper than that. The key is managing contrast and depth. + +The layer hierarchy established in a light-colored design doesn't lose its impact when switched to dark mode. The colors, shadows, highlights, and contrasting elements used to create an **easily perceivable hierarchy** should be carefully considered for each mode. Our [LeptonX theme](https://leptontheme.com/)'s Light, Dark, Semi-dark, and System modes offer valuable insights you might want to explore. + +You might also want to take a look at the dark and light modes we designed with these elements in mind in [ABP Studio](https://abp.io/get-started) and the [ABP.io Documents page](https://abp.io/docs/latest/). + +## 3\. Bento Grid \- A Timeless Trend +![data-model](./bento.png) + +People don't read your website; they **scan** it. + +Bento Grid, an indispensable trend for designers looking to manage their attention, looks set to remain a staple in 2026, just as it was in 2025\. No designer should ignore the fact that many tech giants, especially Apple and Samsung, are still using bento grids on their websites. The bento grid appears not only on websites but also in operating systems, VR headset interfaces, game console interfaces, and game designs. + +The golden rule is **contrast** and **balance**. + +The attractiveness and effectiveness of bento designs depend on certain factors you should consider when implementing them. If you ignore these rules, even with a proven method like bento, you can still alienate users. + +The bento grid is one of the best ways to display different types of content inclusively. When used correctly, it's also a great way to manipulate reading order, guiding the user's eye. Improper contrast and hierarchy can also create a negative experience. Designers should use this to guide the reader's eye: "Read here first, then read here." + +When creating a bento, you inherently have to sacrifice some of your "whitespace." This design has many elements for the user to focus on, and it actually strays from our first point, "Simplicity". Bento design, whose boundaries are drawn from the outset and independent of content, requires care not to include more or less than what is necessary. Too much content makes it boring; too little content makes it very close to meaningless. + +Bento grids should aim for a balanced design by using both simple text and sophisticated visuals. This visual can be an illustration, a video that starts playing when hovered over, a static image, or a large title. Only one or two cards on the screen at a time should have attention. + +## 4\. Larger Fonts, High Readability +![data-model](./large.png) + +Large fonts have been a trend for several years, and it seems web designers are becoming more and more bold. The increasing preference for larger fonts every year is a sign that this trend will continue into 2026\. This trend is about more than just using large font sizes in headlines. + +Creating a cohesive typographic scale and proper line height and letter spacing are critical elements to consider when creating this trend. As the font size increases, line height should decrease, and the space between letters should be narrower. + +The browser default font size, which we used to see in body text and paragraphs and has now become standard, is 16 pixels. In the last few years, we've started seeing body font sizes of 17 or 18 pixels more frequently. The increasing importance of readability every year makes this more common. Font sizes in rem values, rather than px, provide the most efficient results. + +## 5\. Micro Animations + +Unless you're a web design agency designing a website to impress potential clients, you should avoid excessive changes, including excessive image changes during scrolling, and scroll direction changes. There's still room for oversized images and scroll animations. But be sure to create the visuals yourself. + +The trend I'm talking about here is **micro animations**, not macro ones. Small movements, not large ones. + +The animation approach of 2025 is **functional** and **performance-sensitive**. + +Microanimations exist to provide immediate feedback to the user. Instant feedback, like a button's shadow increasing when hovered over, a button's slight collapse when clicked, or a "Save" icon changing to a "Confirm" icon when saving data, keeps your designs alive. + +We see the real impact of the micro-animation trend in static, non-action visuals. The use of non-button elements in your designs, accentuated by micro-movements such as scrolling or hovering, seems poised to continue to create macro effects in 2026\. + +## 6\. Real Images and Human-like Touches + +People quickly spot a fake. It's very difficult to convince a user who visits your website for the first time and doesn't trust you. **First impressions** matter. + +Real photographs, actual product screenshots, and brand-specific illustrations will continue to be among the elements we want to see in **trust-focused** designs in 2026\. + +In addition to flawless work done by AI, vivid, real-life visuals, accompanied by deliberate imperfections, hand-drawn details, or designed products that convey the message, "A human made this site\!", will continue to feel warmer and more welcoming. + +The human touch is evident not only in the visuals but also in your **content and text**. + +In 2026, you'll need more **human-like touches** that will make your design stand out among the thousands of similar websites rapidly generated by AI. + +## 7\. Accessibility \- No Longer an Option, But a Legal and Ethical Obligation + +Accessibility, once considered a nice-to-do thing in recent years, is now becoming a **necessity** in 2026 and beyond. Global regulations like the European Accessibility Act require all digital products to comply with WCAG standards. + +All design and software improvements you make to ensure end users can fully perform their tasks in your products, regardless of their temporary or permanent disabilities, should be viewed as ethical and commercial requirements, not as a requirement to comply with these standards. + +The foundation of accessibility in design is to use semantic HTML for screen readers, provide full keyboard control of all interactive elements, and clearly communicate the roles of complex components to the development team. + +## 8\. Intentional Friction + +Steve Krug, the father of UX design, started the trend of designing everything at a hyper-usable level with his book "Don't Make Me Think." As web designers, we've embraced this idea so much that all we care about is getting the user to their destination in the shortest possible scenario and as quickly as possible. This has required so many understandability measures that, after a while, it's starting to feel like fooling the user. + +In recent years, designers have started looking for ways to make things a little more challenging, rather than just getting the user to the result. + +When the end user visits your website, tries to understand exactly what it is at first glance, struggles a bit, and, after a little effort, becomes familiar with how your world works, they'll be more inclined to consider themselves a part of it. + +This has nothing to do with anti-usability. This philosophy is called Intentional Friction. + +This isn't a flaw; it's the pinnacle of error prevention. It's a step to prevent errors from occurring on autopilot and respects the user's ability to understand complex systems. Examples include reviewing the order summary or manually typing the project name when deleting a project on GitHub. + +## Bonus: Where Does Artificial Intelligence Fit In? + +Artificial intelligence will be an infrastructure in 2026, not a trend. + +As designers, we should leverage AI not to paint us a picture, but to make workflows more intelligent. In my opinion, this is the best use case for AI. + +AI can learn user behavior and adapt the interface accordingly. Real-time A/B testing can save us time by conducting a real-time content review. The ability to actively use AI in any area that allows you to accelerate your progress will take you a step further in your career. + +Since your users are always human, **don't be too eager** to incorporate AI-generated visuals into your design. Unless you're creating and selling a ready-made theme, you should **avoid** AI-generated visuals, random bento grids, and randomly generated content. + +You should definitely incorporate AI into your work for new content, new ideas, personal and professional development, and insights that will take your design a step further. But just as you don't design your website for designers to like, the same applies to AI. Humans, not robots, will experience your website. **AI-assisted**, not AI-generated, designs with a human touch are the trend I most expect seeing in 2026\. + +## Conclusion + +In the end, it's all fundamentally about respect for the user and their time. In 2026, our success as designers and developers will be measured not by how "cool" we are, but by how "efficient" and "reliable" a world we build for our users. + +Thank you for your time. diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/cover-image.png b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/cover-image.png new file mode 100644 index 0000000000..5ee2f50934 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/abp-structure.png b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/abp-structure.png new file mode 100644 index 0000000000..5c5639839c Binary files /dev/null and b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/abp-structure.png differ diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/ddd-layers.png b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/ddd-layers.png new file mode 100644 index 0000000000..7307f1cbab Binary files /dev/null and b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/ddd-layers.png differ diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/money-transfer.png b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/money-transfer.png new file mode 100644 index 0000000000..2ebf3b4fef Binary files /dev/null and b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/money-transfer.png differ diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/service-comparison.png b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/service-comparison.png new file mode 100644 index 0000000000..498a438502 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/images/service-comparison.png differ diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/post.md b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/post.md new file mode 100644 index 0000000000..7eca19a652 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/post.md @@ -0,0 +1,592 @@ +# What is That Domain Service in DDD for .NET Developers? + +When you start applying **Domain-Driven Design (DDD)** in your .NET projects, you'll quickly meet some core building blocks: **Entities**, **Value Objects**, **Aggregates**, and finally… **Domain Services**. + +But what exactly *is* a Domain Service, and when should you use one? + +Let's break it down with practical examples and ABP Framework implementation patterns. + +--- + +![Diagram showing layered architecture: UI, Application, Domain (Entities, Value Objects, Domain Services), Infrastructure boundaries](images/ddd-layers.png) + +## The Core Idea of Domain Services + +A **Domain Service** represents **a domain concept that doesn't naturally belong to a single Entity or Value Object**, but still belongs to the **domain layer** - *not* to the application or infrastructure. + +In short: + +> If your business logic doesn't fit into a single Entity, but still expresses a business rule, that's a good candidate for a Domain Service. + + + +--- + +## Example: Money Transfer Between Accounts + +Imagine a simple **banking system** where you can transfer money between accounts. + +```csharp +public class Account : AggregateRoot +{ + public decimal Balance { get; private set; } + + // Domain model should be created in a valid state. + public Account(decimal openingBalance = 0m) + { + if (openingBalance < 0) + throw new BusinessException("Opening balance cannot be negative."); + Balance = openingBalance; + } + + public void Withdraw(decimal amount) + { + if (amount <= 0) + throw new BusinessException("Withdrawal amount must be positive."); + if (Balance < amount) + throw new BusinessException("Insufficient balance."); + Balance -= amount; + } + + public void Deposit(decimal amount) + { + if (amount <= 0) + throw new BusinessException("Deposit amount must be positive."); + Balance += amount; + } +} +``` + +> In a richer domain you might introduce a `Money` value object (amount + currency + rounding rules) instead of a raw `decimal` for stronger invariants. + +--- + +## Implementing a Domain Service + +![Conceptual illustration showing how a domain service coordinates two aggregates](images/money-transfer.png) + +```csharp +public class MoneyTransferManager : DomainService +{ + public void Transfer(Account from, Account to, decimal amount) + { + if (from is null) throw new ArgumentNullException(nameof(from)); + if (to is null) throw new ArgumentNullException(nameof(to)); + if (ReferenceEquals(from, to)) + throw new BusinessException("Cannot transfer to the same account."); + if (amount <= 0) + throw new BusinessException("Transfer amount must be positive."); + + from.Withdraw(amount); + to.Deposit(amount); + } +} +``` + +> **Naming Convention**: ABP suggests using the `Manager` or `Service` suffix for domain services. We typically use `Manager` suffix (e.g., `IssueManager`, `OrderManager`). + +> **Note**: This is a synchronous domain operation. The domain service focuses purely on business rules without infrastructure concerns like database access or event publishing. For cross-cutting concerns, use Application Service layer or domain events. + +--- + +## Domain Service vs. Application Service + +Here's a quick comparison: + +![Side-by-side comparison: Domain Service (pure business rule) vs Application Service (orchestrates repositories, transactions, external systems)](images/service-comparison.png) + +| Layer | Responsibility | Example | +| ----------------------- | -------------------------------------------------------------------------------- | ---------------------------- | +| **Domain Service** | Pure business rule spanning entities/aggregates | `MoneyTransferManager` | +| **Application Service** | Orchestrates use cases, handles repositories, transactions, external systems | `BankAppService` | + +--- + +## The Application Service Layer + +An **Application Service** orchestrates the domain logic and handles infrastructure concerns: + +![ABP solution layout highlighting Domain layer (Entities, Value Objects, Domain Services) separate from Application and Infrastructure layers](images/abp-structure.png) + +```csharp +public class BankAppService : ApplicationService +{ + private readonly IRepository _accountRepository; + private readonly MoneyTransferManager _moneyTransferManager; + + public BankAppService( + IRepository accountRepository, + MoneyTransferManager moneyTransferManager) + { + _accountRepository = accountRepository; + _moneyTransferManager = moneyTransferManager; + } + + public async Task TransferAsync(Guid fromId, Guid toId, decimal amount) + { + var from = await _accountRepository.GetAsync(fromId); + var to = await _accountRepository.GetAsync(toId); + + _moneyTransferManager.Transfer(from, to, amount); + + await _accountRepository.UpdateAsync(from); + await _accountRepository.UpdateAsync(to); + } +} +``` + +> **Note**: Domain services are automatically registered to Dependency Injection with a **Transient** lifetime when inheriting from `DomainService`. + +--- + +## Benefits of ABP's DomainService Base Class + +The `DomainService` base class gives you access to: + +- **Localization** (`IStringLocalizer L`) - Multi-language support for error messages +- **Logging** (`ILogger Logger`) - Built-in logger for tracking operations +- **Local Event Bus** (`ILocalEventBus LocalEventBus`) - Publish local domain events +- **Distributed Event Bus** (`IDistributedEventBus DistributedEventBus`) - Publish distributed events +- **GUID Generator** (`IGuidGenerator GuidGenerator`) - Sequential GUID generation for better database performance +- **Clock** (`IClock Clock`) - Abstraction for date/time operations + +### Example with ABP Features + +> **Important**: While domain services *can* publish domain events using the event bus, they should remain focused on business rules. Consider whether event publishing belongs in the domain service or the application service based on your consistency boundaries. + +```csharp +public class MoneyTransferredEvent +{ + public Guid FromAccountId { get; set; } + public Guid ToAccountId { get; set; } + public decimal Amount { get; set; } +} + +public class MoneyTransferManager : DomainService +{ + public async Task TransferAsync(Account from, Account to, decimal amount) + { + if (from is null) throw new ArgumentNullException(nameof(from)); + if (to is null) throw new ArgumentNullException(nameof(to)); + if (ReferenceEquals(from, to)) + throw new BusinessException(L["SameAccountTransferNotAllowed"]); + if (amount <= 0) + throw new BusinessException(L["InvalidTransferAmount"]); + + // Log the operation + Logger.LogInformation( + "Transferring {Amount} from {From} to {To}", amount, from.Id, to.Id); + + from.Withdraw(amount); + to.Deposit(amount); + + // Publish local event for further policies (limits, notifications, audit, etc.) + await LocalEventBus.PublishAsync( + new MoneyTransferredEvent + { + FromAccountId = from.Id, + ToAccountId = to.Id, + Amount = amount + } + ); + } +} +``` + +> **Local Events**: By default, event handlers are executed within the same Unit of Work. If an event handler throws an exception, the database transaction is rolled back, ensuring consistency. + +--- + +## Best Practices + +### 1. Keep Domain Services Pure and Focused on Business Rules + +Domain services should only contain business logic. They should not be responsible for application-level concerns like database transactions, authorization, or fetching entities from a repository. + +```csharp +// Good ✅ Pure rule: receives aggregates already loaded. +public class MoneyTransferManager : DomainService +{ + public void Transfer(Account from, Account to, decimal amount) + { + // Business rules and coordination + from.Withdraw(amount); + to.Deposit(amount); + } +} + +// Bad ❌ Mixing application and domain concerns. +// This logic belongs in an Application Service. +public class MoneyTransferManager : DomainService +{ + private readonly IRepository _accountRepository; + + public MoneyTransferManager(IRepository accountRepository) + { + _accountRepository = accountRepository; + } + + public async Task TransferAsync(Guid fromId, Guid toId, decimal amount) + { + // Don't fetch entities inside a domain service. + var from = await _accountRepository.GetAsync(fromId); + var to = await _accountRepository.GetAsync(toId); + + from.Withdraw(amount); + to.Deposit(amount); + } +} +``` + +### 2. Leverage Entity Methods First + +Always prefer encapsulating business logic within an entity's methods when the logic belongs to a single aggregate. A domain service should only be used when a business rule spans multiple aggregates. + +```csharp +// Good ✅ - Internal state change belongs in the entity +public class Account : AggregateRoot +{ + public decimal Balance { get; private set; } + + public void Withdraw(decimal amount) + { + if (Balance < amount) + throw new BusinessException("Insufficient balance"); + Balance -= amount; + } +} + +// Use Domain Service only when logic spans multiple aggregates +public class MoneyTransferManager : DomainService +{ + public void Transfer(Account from, Account to, decimal amount) + { + from.Withdraw(amount); // Delegates to entity + to.Deposit(amount); // Delegates to entity + } +} +``` + +### 3. Prefer Domain Services over Anemic Entities + +Avoid placing business logic that coordinates multiple entities directly into an application service. This leads to an "Anemic Domain Model," where entities are just data bags and the business logic is scattered in application services. + +```csharp +// Bad ❌ - Business logic is in the Application Service (Anemic Domain) +public class BankAppService : ApplicationService +{ + public async Task TransferAsync(Guid fromId, Guid toId, decimal amount) + { + var from = await _accountRepository.GetAsync(fromId); + var to = await _accountRepository.GetAsync(toId); + + // This is domain logic and should be in a Domain Service + if (ReferenceEquals(from, to)) + throw new BusinessException("Cannot transfer to the same account."); + if (amount <= 0) + throw new BusinessException("Transfer amount must be positive."); + + from.Withdraw(amount); + to.Deposit(amount); + } +} +``` + +### 4. Use Meaningful Names + +ABP recommends naming domain services with a `Manager` or `Service` suffix based on the business concept they represent. + +```csharp +// Good ✅ +MoneyTransferManager +OrderManager +IssueManager +InventoryAllocationService + +// Bad ❌ +AccountHelper +OrderProcessor +``` + +--- + +## Advanced Example: Order Processing with Inventory Check + +Here's a more complex scenario showing domain service interaction with domain abstractions: + +```csharp +// Domain abstraction - defines contract but implementation is in infrastructure +public interface IInventoryChecker : IDomainService +{ + Task IsAvailableAsync(Guid productId, int quantity); +} + +public class OrderManager : DomainService +{ + private readonly IInventoryChecker _inventoryChecker; + + public OrderManager(IInventoryChecker inventoryChecker) + { + _inventoryChecker = inventoryChecker; + } + + // Validates and coordinates order processing with inventory + public async Task ProcessAsync(Order order, Inventory inventory) + { + // First pass: validate availability using domain abstraction + foreach (var item in order.Items) + { + if (!await _inventoryChecker.IsAvailableAsync(item.ProductId, item.Quantity)) + { + throw new BusinessException( + L["InsufficientInventory", item.ProductId]); + } + } + + // Second pass: perform reservations + foreach (var item in order.Items) + { + inventory.Reserve(item.ProductId, item.Quantity); + } + + order.SetStatus(OrderStatus.Processing); + } +} +``` + +> **Domain Abstractions**: The `IInventoryChecker` interface is a domain service contract. Its implementation can be in the infrastructure layer, but the contract belongs to the domain. This keeps the domain layer independent of infrastructure details while still allowing complex validations. + +> **Caution**: Always perform validation and action atomically within a single transaction to avoid race conditions (TOCTOU - Time Of Check Time Of Use). + +> **Transaction Boundaries**: When a domain service coordinates multiple aggregates, ensure the Application Service wraps the operation in a Unit of Work to maintain consistency. ABP's `[UnitOfWork]` attribute or Application Services' built-in UoW handling ensures this automatically. + +--- + +## Common Pitfalls and How to Avoid Them + +### 1. Bloated Domain Services +Don't let domain services become "god objects" that do everything. Keep them focused on a single business concept. + +```csharp +// Bad ❌ - Too many responsibilities +public class AccountManager : DomainService +{ + public void Transfer(Account from, Account to, decimal amount) { } + public void CalculateInterest(Account account) { } + public void GenerateStatement(Account account) { } + public void ValidateAddress(Account account) { } + public void SendNotification(Account account) { } +} + +// Good ✅ - Split by business concept +public class MoneyTransferManager : DomainService +{ + public void Transfer(Account from, Account to, decimal amount) { } +} + +public class InterestCalculationManager : DomainService +{ + public void Calculate(Account account) { } +} +``` + +### 2. Circular Dependencies Between Aggregates +When domain services coordinate multiple aggregates, be careful about creating circular dependencies. + +```csharp +// Consider using Domain Events instead of direct coupling +public class OrderManager : DomainService +{ + public async Task ProcessAsync(Order order) + { + order.SetStatus(OrderStatus.Processing); + + // Instead of directly modifying Customer aggregate here, + // publish an event that CustomerManager can handle + await LocalEventBus.PublishAsync(new OrderProcessedEvent + { + OrderId = order.Id, + CustomerId = order.CustomerId + }); + } +} +``` + +### 3. Confusing Domain Service with Domain Event Handlers +Domain services orchestrate business operations. Domain event handlers react to state changes. Don't mix them. + +```csharp +// Domain Service - Orchestrates business logic +public class MoneyTransferManager : DomainService +{ + public async Task TransferAsync(Account from, Account to, decimal amount) + { + from.Withdraw(amount); + to.Deposit(amount); + await LocalEventBus.PublishAsync( + new MoneyTransferredEvent + { + FromAccountId = from.Id, + ToAccountId = to.Id, + Amount = amount + } + ); + } +} + +// Domain Event Handler - Reacts to domain events +public class MoneyTransferredEventHandler : + ILocalEventHandler, + ITransientDependency +{ + public async Task HandleEventAsync(MoneyTransferredEvent eventData) + { + // Send notification, update analytics, etc. + } +} +``` + +--- + +## Testing Domain Services + +Domain services are easy to test because they have minimal dependencies: + +```csharp +public class MoneyTransferManager_Tests +{ + [Fact] + public void Should_Transfer_Money_Between_Accounts() + { + // Arrange + var fromAccount = new Account(1000m); + var toAccount = new Account(500m); + var manager = new MoneyTransferManager(); + + // Act + manager.Transfer(fromAccount, toAccount, 200m); + + // Assert + fromAccount.Balance.ShouldBe(800m); + toAccount.Balance.ShouldBe(700m); + } + + [Fact] + public void Should_Throw_When_Insufficient_Balance() + { + var fromAccount = new Account(100m); + var toAccount = new Account(500m); + var manager = new MoneyTransferManager(); + + Should.Throw(() => + manager.Transfer(fromAccount, toAccount, 200m)); + } + + [Fact] + public void Should_Throw_When_Amount_Is_NonPositive() + { + var fromAccount = new Account(100m); + var toAccount = new Account(100m); + var manager = new MoneyTransferManager(); + + Should.Throw(() => + manager.Transfer(fromAccount, toAccount, 0m)); + Should.Throw(() => + manager.Transfer(fromAccount, toAccount, -5m)); + } + + [Fact] + public void Should_Throw_When_Same_Account() + { + var account = new Account(100m); + var manager = new MoneyTransferManager(); + + Should.Throw(() => + manager.Transfer(account, account, 10m)); + } +} +``` + +### Integration Testing with ABP Test Infrastructure + +```csharp +public class MoneyTransferManager_IntegrationTests : BankingDomainTestBase +{ + private readonly MoneyTransferManager _transferManager; + private readonly IRepository _accountRepository; + + public MoneyTransferManager_IntegrationTests() + { + _transferManager = GetRequiredService(); + _accountRepository = GetRequiredService>(); + } + + [Fact] + public async Task Should_Transfer_And_Persist_Changes() + { + // Arrange + var fromAccount = new Account(1000m); + var toAccount = new Account(500m); + + await _accountRepository.InsertAsync(fromAccount); + await _accountRepository.InsertAsync(toAccount); + await UnitOfWorkManager.Current.SaveChangesAsync(); + + // Act + await _transferManager.TransferAsync(fromAccount, toAccount, 200m); + await UnitOfWorkManager.Current.SaveChangesAsync(); + + // Assert + var updatedFrom = await _accountRepository.GetAsync(fromAccount.Id); + var updatedTo = await _accountRepository.GetAsync(toAccount.Id); + + updatedFrom.Balance.ShouldBe(800m); + updatedTo.Balance.ShouldBe(700m); + } +} +``` + +--- + +## When NOT to Use a Domain Service + +Not every operation needs a domain service. Avoid over-engineering: + +1. **Simple CRUD Operations**: Use Application Services directly +2. **Single Aggregate Operations**: Use Entity methods +3. **Infrastructure Concerns**: Use Infrastructure Services +4. **Application Workflow**: Use Application Services + +```csharp +// Don't create a domain service for this ❌ +public class AccountBalanceReader : DomainService +{ + public decimal GetBalance(Account account) => account.Balance; +} + +// Just use the property directly ✅ +var balance = account.Balance; +``` + +--- + +## Summary +- **Domain Services** are domain-level, not application-level +- They encapsulate **business logic that doesn't belong to a single entity** +- They keep your **entities clean** and **business logic consistent** +- In ABP, inherit from `DomainService` to get built-in features +- Keep them **focused**, **pure**, and **testable** + +--- + +## Final Thoughts + +Next time you're writing a business rule that doesn't clearly belong to an entity, ask yourself: + +> "Is this a Domain Service?" + +If it's pure domain logic that coordinates multiple entities or implements a business rule, **put it in the domain layer** - your future self (and your team) will thank you. + +Domain Services are a powerful tool in your DDD toolkit. Use them wisely to keep your domain model clean, expressive, and maintainable. + +--- diff --git a/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/summary.md b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/summary.md new file mode 100644 index 0000000000..a047be4def --- /dev/null +++ b/docs/en/Community-Articles/2025-11-08-what-is-that-domain-service-in-ddd-for-net-developers/summary.md @@ -0,0 +1 @@ +Learn what Domain Services are in Domain-Driven Design and when to use them in .NET projects. This practical guide covers the difference between Domain and Application Services, features real-world examples including money transfers and order processing, and shows how ABP Framework's DomainService base class simplifies implementation with built-in localization, logging, and event publishing. diff --git a/docs/en/Community-Articles/2025-11-15-Announcing-SSR-Support/article.md b/docs/en/Community-Articles/2025-11-15-Announcing-SSR-Support/article.md new file mode 100644 index 0000000000..51b28ef18c --- /dev/null +++ b/docs/en/Community-Articles/2025-11-15-Announcing-SSR-Support/article.md @@ -0,0 +1,156 @@ +# Announcing Server-Side Rendering (SSR) Support for ABP Framework Angular Applications + +We are pleased to announce that **Server-Side Rendering (SSR)** has become available for ABP Framework Angular applications! This highly requested feature brings major gains in performance, SEO, and user experience to your Angular applications based on ABP Framework. + +## What is Server-Side Rendering (SSR)? + +Server-Side Rendering refers to an approach which renders your Angular application on the server as opposed to the browser. The server creates the complete HTML for a page and sends it to the client, which can then show the page to the user. This poses many advantages over traditional client-side rendering. + +## Why SSR Matters for ABP Angular Applications + +### Improved Performance +- **Quicker visualization of the first contentful paint (FCP)**: Because prerendered HTML is sent over from the server, users will see content quicker. +- **Better perceived performance**: Even on slower devices, the page will be displaying something sooner. +- **Less JavaScript parsing time**: For example, the initial page load will not require parsing and executing a large bundle of JavaScript. + +### Enhanced SEO +- **Improved indexing by search engines**: Search engine bots are able to crawl and index your content quicker. +- **Improved rankings in search**: The quicker the content loads and the easier it is to access, the better your SEO score. +- **Preview when sharing on social channels**: Rich previews with the appropriate meta tags are generated when sharing links on social platforms. + +### Better User Experience +- **Support for low bandwidth**: Users with slower Internet connections will have a better experience +- **Progressive enhancement**: Users can start accessing the content before JavaScript has loaded +- **Better accessibility**: Screen readers and other assistive technologies can access the content immediately + +## Getting Started with SSR + +### Adding SSR to an Existing Project + +You can easily add SSR support to your existing ABP Angular application using the Angular CLI with ABP schematics: + +> Adds SSR configuration to your project +```bash +ng generate @abp/ng.schematics:ssr-add +``` +> Short form +```bash +ng g @abp/ng.schematics:ssr-add +``` +If you have multiple projects in your workspace, you can specify which project to add SSR to: + +```bash +ng g @abp/ng.schematics:ssr-add --project=my-project +``` + +If you want to skip the automatic installation of dependencies: + +```bash +ng g @abp/ng.schematics:ssr-add --skip-install +``` + +## What Gets Configured + +When you add SSR to your ABP Angular project, the schematic automatically: + +1. **Installs necessary dependencies**: Adds `@angular/ssr` and related packages +2. **Creates Server Configuration**: Creates `server.ts` and related files +3. **Updates Project Structure**: + - Creates `main.server.ts` to bootstrap the server + - Adds `app.config.server.ts` for standalone apps (or `app.module.server.ts` for NgModule apps) + - Configures server routes in `app.routes.server.ts` +4. **Updates Build Configuration**: updates `angular.json` to include: + - a `serve-ssr` target for local SSR development + - a `prerender` target for static site generation + - Proper output paths for browser and server bundles + +## Supported Configurations + +The ABP SSR schematic supports both modern and legacy Angular build configurations: + +### Application Builder (Suggested) +- The new `@angular-devkit/build-angular:application` builder +- Optimized for Angular 17+ apps +- Enhanced performance and smaller bundle sizes + +### Server Builder (Legacy) +- The original `@angular-devkit/build-angular:server` builder +- Designed for legacy Angular applications +- Compatible with legacy applications + +## Running Your SSR Application + +After adding SSR to your project, you can run your application in SSR mode: + +```bash +# Development mode with SSR +ng serve + +# Or specifically target SSR development server +npm run serve:ssr + +# Build for production +npm run build:ssr + +# Preview production build +npm run serve:ssr:production +``` + +## Important Considerations + +### Browser-Only APIs +Some browser APIs are not available on the server. Use platform checks to conditionally execute code: + +```typescript +import { isPlatformBrowser } from '@angular/common'; +import { PLATFORM_ID, inject } from '@angular/core'; + +export class MyComponent { + private platformId = inject(PLATFORM_ID); + + ngOnInit() { + if (isPlatformBrowser(this.platformId)) { + // Code that uses browser-only APIs + console.log('Running in browser'); + localStorage.setItem('key', 'value'); + } + } +} +``` + +### Storage APIs +`localStorage` and `sessionStorage` are not accessible on the server. Consider using: +- Cookies for server-accessible data. +- The state transfer API for hydration. +- ABP's built-in storage abstractions. + +### Third-Party Libraries +Please ensure that any third-party libraries you use are compatible with SSR. These libraries can require: +- Dynamic imports for browser-only code. +- Platform-specific service providers. +- Custom Angular Universal integration. + +## ABP Framework Integration + +The SSR implementation is natively integrated with all of the ABP Framework features: + +- **Authentication & Authorization**: The OAuth/OpenID Connect flow functions seamlessly with ABP +- **Multi-tenancy**: Fully supports tenant resolution and switching +- **Localization**: Server-side rendering respects the locale +- **Permission Management**: Permission checks work on both server and client +- **Configuration**: The ABP configuration system is SSR-ready +## Performance Tips + +1. **Utilize State Transfer**: Send data from server to client to eliminate redundant HTTP requests +2. **Optimize Images**: Proper image loading strategies, such as lazy loading and responsive images. +3. **Cache API Responses**: At the server, implement proper caching strategies. +4. **Monitor Bundle Size**: Keep your server bundle optimized +5. **Use Prerendering**: The prerender target should be used for static content. + +## Conclusion + +Server-side rendering can be a very effective feature in improving your ABP Angular application's performance, SEO, and user experience. Our new SSR schematic will make it easier than ever to add SSR to your project. + +Try it today and let us know what you think! + +--- diff --git a/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/coverimage.png b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/coverimage.png new file mode 100644 index 0000000000..b4f2222acd Binary files /dev/null and b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/coverimage.png differ diff --git a/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/images/auth-flow.svg b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/images/auth-flow.svg new file mode 100644 index 0000000000..0ae07fec22 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/images/auth-flow.svg @@ -0,0 +1,70 @@ + + + + + API Key Authentication Flow + + + + + 1. Client Request + X-Api-Key: prefix_key + + + + + + + 2. Extract API Key + From Header/Query + + + + + + + 3. Lookup by Prefix + Cache → Database + + + + + + + 4. Verify Hash + SHA256 + Expiration + + + + + + + Valid? + + + + + Yes + + + 200 OK + ClaimsPrincipal + + + + + No + + + 401 Unauthorized + Invalid/Expired + + + + + ⚡ Cache-first strategy ensures ~95% requests skip database lookup + + + Typical response time: <5ms (cached) | <50ms (database lookup) + + diff --git a/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/post.md b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/post.md new file mode 100644 index 0000000000..87dc698b1d --- /dev/null +++ b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/post.md @@ -0,0 +1,354 @@ +# Building an API Key Management System with ABP Framework + +API keys are one of the most common authentication methods for APIs, especially for machine-to-machine communication. In this article, I'll explain what API key authentication is, when to use it, and how to implement a complete API key management system using ABP Framework. + +## What is API Key Authentication? + +An API key is a unique identifier used to authenticate requests to an API. Unlike user credentials (username/password) or OAuth tokens, API keys are designed for: + +- **Programmatic access** - Scripts, CLI tools, and automated processes +- **Service-to-service communication** - Microservices authenticating with each other +- **Third-party integrations** - External systems accessing your API +- **IoT devices** - Embedded systems with limited authentication capabilities +- **Mobile/Desktop apps** - Native applications that need persistent authentication + +## Why Use API Keys? + +While modern authentication methods like OAuth2 and JWT are excellent for user authentication, API keys offer distinct advantages in certain scenarios: + +**Simplicity**: No complex OAuth flows or token refresh mechanisms. Just include the key in your request header. + +**Long-lived**: Unlike JWT tokens that expire in minutes/hours, API keys can remain valid for months or years, making them ideal for automated systems. + +**Revocable**: You can instantly revoke a compromised key without affecting user credentials. + +**Granular Control**: Different keys for different purposes (read-only, admin, specific services). + +## Real-World Use Cases + +Here are some practical scenarios where API key authentication shines: + +### 1. Mobile Applications +Your mobile app needs to call your backend APIs. Instead of storing user credentials or managing token refresh flows, use an API key. + +```csharp +// Mobile app configuration +var apiClient = new ApiClient("https://api.yourapp.com"); +apiClient.SetApiKey("sk_mobile_prod_abc123..."); +``` + +### 2. Microservice Communication +Service A needs to call Service B's protected endpoints. + +```csharp +// Order Service calling Inventory Service +var request = new HttpRequestMessage(HttpMethod.Get, "https://inventory-service/api/products"); +request.Headers.Add("X-Api-Key", _configuration["InventoryService:ApiKey"]); +``` + +### 3. Third-Party Integrations +You're providing APIs to external partners or customers. + +```bash +# Customer's integration script +curl -H "X-Api-Key: pk_partner_xyz789..." \ + https://api.yourplatform.com/api/orders +``` + +## Implementing API Key Management in ABP Framework + +Now let's see how to build a complete API key management system using ABP Framework. I've created an open-source implementation that you can use in your projects. + +### Project Overview + +The implementation consists of: + +- **User-based API keys** - Each key belongs to a specific user +- **Permission delegation** - Keys inherit user permissions with optional restrictions +- **Secure storage** - Keys are hashed with SHA-256 +- **Prefix-based lookup** - Fast key resolution with caching +- **Web UI** - Manage keys through a user-friendly interface +- **Multi-tenancy support** - Full ABP multi-tenancy compatibility + +![API Keys Management UI](https://raw.githubusercontent.com/salihozkara/AbpApikeyManagement/refs/heads/master/docs/images/api-keys.png) + +### Architecture Overview + +The solution follows ABP's modular architecture with four main layers: + +``` +┌─────────────────────────────────────────────┐ +│ Web Layer (UI) │ +│ • Razor Pages for CRUD operations │ +│ • JavaScript for client interactions │ +└─────────────────────────────────────────────┘ + ↓ +┌─────────────────────────────────────────────┐ +│ AspNetCore Layer (Middleware) │ +│ • Authentication Handler │ +│ • API Key Resolver (Header/Query) │ +└─────────────────────────────────────────────┘ + ↓ +┌─────────────────────────────────────────────┐ +│ Application Layer (Business Logic) │ +│ • ApiKeyAppService (CRUD operations) │ +│ • DTO mappings and validations │ +└─────────────────────────────────────────────┘ + ↓ +┌─────────────────────────────────────────────┐ +│ Domain Layer (Core Business) │ +│ • ApiKey Entity & Manager │ +│ • IApiKeyRepository │ +│ • Domain services & events │ +└─────────────────────────────────────────────┘ +``` + +### Key Components + +#### 1. Domain Layer - The Core Entity + +```csharp +public class ApiKey : FullAuditedAggregateRoot, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + public virtual Guid UserId { get; protected set; } + public virtual string Name { get; protected set; } + public virtual string Prefix { get; protected set; } + public virtual string KeyHash { get; protected set; } + public virtual DateTime? ExpiresAt { get; protected set; } + public virtual bool IsActive { get; protected set; } + + // Key format: {prefix}_{key} + // Only the hash is stored, never the actual key +} +``` + +**Key Design Decisions:** + +- **Prefix-based lookup**: Keys have format `prefix_actualkey`. The prefix is indexed for fast database lookups. +- **SHA-256 hashing**: The actual key is hashed and never stored in plain text. +- **User association**: Each key belongs to a user, inheriting their permissions. +- **Soft delete**: Deleted keys are marked as deleted but not removed from database for audit purposes. + +#### 2. Authentication Flow + +Here's how authentication works when a request arrives: + +![Authentication Flow](images/auth-flow.svg) + +```csharp +// 1. Extract API key from request +var apiKey = httpContext.Request.Headers["X-Api-Key"].FirstOrDefault(); +if (string.IsNullOrEmpty(apiKey)) return AuthenticateResult.NoResult(); + +// 2. Split prefix and key +var parts = apiKey.Split('_', 2); +var prefix = parts[0]; +var key = parts[1]; + +// 3. Find key by prefix (cached) +var apiKeyEntity = await _apiKeyRepository.FindByPrefixAsync(prefix); +if (apiKeyEntity == null) return AuthenticateResult.Fail("Invalid API key"); + +// 4. Verify hash +var keyHash = HashHelper.ComputeSha256(key); +if (apiKeyEntity.KeyHash != keyHash) + return AuthenticateResult.Fail("Invalid API key"); + +// 5. Check expiration and active status +if (apiKeyEntity.ExpiresAt < DateTime.UtcNow || !apiKeyEntity.IsActive) + return AuthenticateResult.Fail("API key expired or inactive"); + +// 6. Create claims principal with user identity +var claims = new List +{ + new Claim(AbpClaimTypes.UserId, apiKeyEntity.UserId.ToString()), + new Claim(AbpClaimTypes.TenantId, apiKeyEntity.TenantId?.ToString() ?? ""), + new Claim("ApiKeyId", apiKeyEntity.Id.ToString()) +}; + +return AuthenticateResult.Success(ticket); +``` + +#### 3. Creating and Managing API Keys + +**Creating a new key:** + +![Create API Key Modal](https://raw.githubusercontent.com/salihozkara/AbpApikeyManagement/refs/heads/master/docs/images/new-api-key.png) + +```csharp +public class ApiKeyManager : DomainService +{ + public async Task<(ApiKey, string)> CreateAsync( + Guid userId, + string name, + DateTime? expiresAt = null) + { + // Generate unique prefix + var prefix = await GenerateUniquePrefixAsync(); + + // Generate secure random key + var key = GenerateSecureRandomString(32); + + // Hash the key for storage + var keyHash = HashHelper.ComputeSha256(key); + + var apiKey = new ApiKey( + GuidGenerator.Create(), + userId, + name, + prefix, + keyHash, + expiresAt, + CurrentTenant.Id + ); + + await _apiKeyRepository.InsertAsync(apiKey); + + // Return both entity and the full key (prefix_key) + // This is the ONLY time the actual key is visible + return (apiKey, $"{prefix}_{key}"); + } +} +``` + +**Important**: The actual key is returned only once during creation. After that, only the hash is stored. + +![Created Key - Copy Once](https://raw.githubusercontent.com/salihozkara/AbpApikeyManagement/refs/heads/master/docs/images/created.png) + +### Using API Keys in Your Application + +Once created, clients can use the API key to authenticate: + +**HTTP Header (Recommended):** +```bash +curl -H "X-Api-Key: sk_prod_abc123def456..." \ + https://api.example.com/api/products +``` + +**JavaScript:** +```javascript +const response = await fetch('https://api.example.com/api/products', { + headers: { + 'X-Api-Key': 'sk_prod_abc123def456...' + } +}); +``` + +**C# HttpClient:** +```csharp +var client = new HttpClient(); +client.DefaultRequestHeaders.Add("X-Api-Key", "sk_prod_abc123def456..."); +var response = await client.GetAsync("https://api.example.com/api/products"); +``` + +**Python:** +```python +import requests + +headers = {'X-Api-Key': 'sk_prod_abc123def456...'} +response = requests.get('https://api.example.com/api/products', headers=headers) +``` + +### Permission Management + +API keys inherit the user's permissions, but you can further restrict them: + +![Permission Management](https://raw.githubusercontent.com/salihozkara/AbpApikeyManagement/refs/heads/master/docs/images/permissions.png) + +This allows scenarios like: +- Read-only API key for reporting tools +- Limited scope keys for third-party integrations +- Service-specific keys with minimal permissions + +```csharp +// Check if current request is authenticated via API key +if (CurrentUser.FindClaim("ApiKeyId") != null) +{ + var apiKeyId = CurrentUser.FindClaim("ApiKeyId").Value; + // Additional API key specific logic +} +``` + +## Performance Considerations + +The implementation uses several optimizations: + +**1. Prefix-based indexing**: Database lookups are done by prefix (indexed column), not the full key hash. + +**2. Distributed caching**: API keys are cached after first lookup, dramatically reducing database queries. + +```csharp +// Cache configuration +Configure(options => +{ + options.KeyPrefix = "ApiKey:"; +}); +``` + +**3. Cache invalidation**: When a key is modified or deleted, cache is automatically invalidated. + +**Typical Performance:** +- Cached lookup: **< 5ms** +- Database lookup: **< 50ms** +- Cache hit rate: **~95%** + +## Security Best Practices + +When implementing API key authentication, follow these guidelines: + +✅ **Always use HTTPS** - Never send API keys over unencrypted connections + +✅ **Use different keys per environment** - Separate keys for dev, staging, production + +❌ **Don't log the full key** - Only log the prefix for debugging + +## Getting Started + +The complete source code is available on GitHub: + +**Repository**: [github.com/salihozkara/AbpApikeyManagement](https://github.com/salihozkara/AbpApikeyManagement) + +To integrate it into your ABP project: + +1. Clone or download the repository +2. Add project references to your solution +3. Add module dependencies to your modules +4. Run EF Core migrations to create the database tables +5. Navigate to `/ApiKeyManagement` to start managing keys + +```csharp +// In your Web module +[DependsOn(typeof(ApiKeyManagementWebModule))] +public class YourWebModule : AbpModule +{ + // ... +} + +// In your HttpApi.Host module +[DependsOn(typeof(ApiKeyManagementHttpApiModule))] +public class YourHttpApiHostModule : AbpModule +{ + // ... +} +``` + +## Conclusion + +API key authentication remains a crucial part of modern API security, especially for machine-to-machine communication. While it shouldn't replace user authentication methods like OAuth2 for user-facing applications, it's perfect for: + +- Automated scripts and tools +- Service-to-service communication +- Third-party integrations +- Long-lived access without token refresh complexity + +The implementation shown here demonstrates how ABP Framework's modular architecture, DDD principles, and built-in features (multi-tenancy, caching, permissions) can be leveraged to build a production-ready API key management system. + +The solution is open-source and ready to be integrated into your ABP projects. Feel free to explore the code, suggest improvements, or adapt it to your specific needs. + +**Resources:** +- GitHub Repository: [salihozkara/AbpApikeyManagement](https://github.com/salihozkara/AbpApikeyManagement) +- ABP Framework: [abp.io](https://abp.io) +- ABP Documentation: [docs.abp.io](https://abp.io/docs/latest) + +Happy coding! 🚀 diff --git a/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/summary.md b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/summary.md new file mode 100644 index 0000000000..4e5abcd224 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-15-building-an-api-key-management-system/summary.md @@ -0,0 +1 @@ +Learn how to implement API key authentication in ABP Framework applications. This comprehensive guide covers what API keys are, when to use them over OAuth2/JWT, real-world use cases for mobile apps and microservices, and a complete implementation with user-based key management, SHA-256 hashing, permission delegation, and built-in UI. diff --git a/docs/en/Community-Articles/2025-11-17-Angular-21-Signals/cover-image.png b/docs/en/Community-Articles/2025-11-17-Angular-21-Signals/cover-image.png new file mode 100644 index 0000000000..a37bb3d775 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-17-Angular-21-Signals/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-11-17-Angular-21-Signals/post.md b/docs/en/Community-Articles/2025-11-17-Angular-21-Signals/post.md new file mode 100644 index 0000000000..60fcc6405b --- /dev/null +++ b/docs/en/Community-Articles/2025-11-17-Angular-21-Signals/post.md @@ -0,0 +1,322 @@ +# Signal-Based Forms in Angular 21: Why You’ll Never Miss Reactive Forms Again + +Angular 21 introduces one of the most exciting developments in the modern edition of Angular: **Signal-Based Forms**. Built directly on the reactive foundation of Angular signals, this new experimental API provides a cleaner, more intuitive, strongly typed, and ergonomic approach for managing form state—without the heavy boilerplate of Reactive Forms. + +> ⚠️ **Important:** Signal Forms are *experimental*. +> Their API can change. Avoid using them in critical production scenarios unless you understand the risks. + +Despite this, Signal Forms clearly represent Angular’s future direction. +--- + +## Why Signal Forms? + +Traditionally in Angular, building forms has involved several concerns: + +- Tracking values +- Managing UI interaction states (touched, dirty) +- Handling validation +- Keeping UI and model in sync + +Reactive Forms solved many challenges but introduced their own: + +- Verbosity FormBuilder API +- Required subscriptions (valueChanges) +- Manual cleaning +- Difficult nested forms +- Weak type-safety + +**Signal Forms solve these problems through:** + +1." Automatic synchronization +2." Full type safety +3." Schema-based validation +4." Fine-grained reactivity +5." Drastically reduced boilerplate +6." Natural integration with Angular Signals + +--- + +### 1. Form Models — The Core of Signal Forms + +A **form model** is simply a writable signal holding the structure of your form data. + +```ts +import { Component, signal } from '@angular/core'; +import { form, Field } from '@angular/forms/signals'; + +@Component({ + selector: 'app-login', + imports: [Field], + template: ` + + + `, +}) +export class LoginComponent { + loginModel = signal({ + email: '', + password: '', + }); + + loginForm = form(this.loginModel); +} +``` + +Calling `form(model)` creates a **Field Tree** that maps directly to your model. + +--- + +### 2. Achieving Full Type Safety + +Although TypeScript can infer types from object literals, defining explicit interfaces provides maximum safety and better IDE support. + +```ts +interface LoginData { + email: string; + password: string; +} + +loginModel = signal({ + email: '', + password: '', +}); + +loginForm = form(loginModel); +``` + +Now: + +- `loginForm.email` → `FieldTree` +- Accessing invalid fields like `loginForm.username` results in compile-time errors + +This level of type safety surpasses Reactive Forms. + +--- + +### 3. Reading Form Values + +#### Read from the model (entire form): + +```ts +onSubmit() { + const data = this.loginModel(); + console.log(data.email, data.password); +} +``` + +#### Read from an individual field: + +```html +

Current email: {{ loginForm.email().value() }}

+``` + +Each field exposes: + +- `value()` +- `valid()` +- `errors()` +- `dirty()` +- `touched()` + +All as signals. + +--- + +### 4. Updating Form Models Programmatically + +Signal Forms allow three update methods. + +#### 1. Replace the entire model + +```ts +this.userModel.set({ + name: 'Alice', + email: 'alice@example.com', +}); +``` + +#### 2. Patch specific fields + +```ts +this.userModel.update(prev => ({ + ...prev, + email: newEmail, +})); +``` + +#### 3. Update a single field + +```ts +this.userForm.email().value.set(''); +``` + +This eliminates the need for: + +- `patchValue()` +- `setValue()` +- `formGroup.get('field')` + +--- + +### 5. Automatic Two-Way Binding With `[field]` + +The `[field]` directive enables perfect two-way data binding: + +```html + +``` + +#### How it works: + +- **User input → Field state → Model** +- **Model updates → Field state → Input UI** + +No subscriptions. +No event handlers. +No boilerplate. + +Reactive Forms could never achieve this cleanly. + +--- + +### 6. Nested Models and Arrays + +Models can contain nested object structures: + +```ts +userModel = signal({ + name: '', + address: { + street: '', + city: '', + }, +}); +``` + +Access fields easily: + +```html + +``` + +Arrays are also supported: + +```ts +orderModel = signal({ + items: [ + { product: '', quantity: 1, price: 0 } + ] +}); +``` + +Field state persists even when array items move, thanks to identity tracking. + +--- + +### 7. Schema-Based Validation + +Validation is clean and centralized: + +```ts +import { required, email } from '@angular/forms/signals'; + +const model = signal({ email: '' }); + +const formRef = form(model, { + email: [required(), email()], +}); +``` + +Field validation state is reactive: + +```ts +formRef.email().valid() +formRef.email().errors() +formRef.email().touched() +``` + +Validation no longer scatters across components. + +--- + +### 8. When Should You Use Signal Forms? + +#### New Angular 21+ apps +Signal-first architecture is the new standard. + +#### Teams wanting stronger type safety +Every field is exactly typed. + +#### Devs tired of Reactive Form boilerplate +Signal Forms drastically simplify code. + +#### Complex UI with computed reactive form state +Signals integrate perfectly. + +#### ❌ Avoid if: +- You need long-term stability +- You rely on mature Reactive Forms features +- Your app must avoid experimental APIs + +--- + +### 9. Reactive Forms vs Signal Forms + +| Feature | Reactive Forms | Signal Forms | +|--------|----------------|--------------| +| Boilerplate | High | Very low | +| Type-safety | Weak | Strong | +| Two-way binding | Manual | Automatic | +| Validation | Scattered | Centralized schema | +| Nested forms | Verbose | Natural | +| Subscriptions | Required | None | +| Change detection | Zone-heavy | Fine-grained | + +Signal Forms feel like the "modern Angular mode," while Reactive Forms increasingly feel legacy. + +--- + +### 10. Full Example: Login Form + +```ts +@Component({ + selector: 'app-login', + imports: [Field], + template: ` +
+ + + +
+ `, +}) +export class LoginComponent { + model = signal({ email: '', password: '' }); + form = form(this.model); + + submit() { + console.log(this.model()); + } +} +``` + +Minimal. Reactive. Completely type-safe. + +--- + +## **Conclusion** + +Signal Forms in Angular 21 represent a big step forward: + +- Cleaner API +- Stronger type safety +- Automatic two-way binding +- Centralized validation +- Fine-grained reactivity +- Dramatically better developer experience + + +Although these are experimental, they clearly show the future of Angular's form ecosystem. +Once you get into using Signal Forms, you may never want to use Reactive Forms again. + +--- diff --git a/docs/en/Community-Articles/2025-11-19-ABP-BLACK-FRIDAY-BLOG/post.md b/docs/en/Community-Articles/2025-11-19-ABP-BLACK-FRIDAY-BLOG/post.md new file mode 100644 index 0000000000..153470666f --- /dev/null +++ b/docs/en/Community-Articles/2025-11-19-ABP-BLACK-FRIDAY-BLOG/post.md @@ -0,0 +1,25 @@ +**ABP Black Friday Deals are Almost Here\!** + +The season of huge savings is back\! We are happy to announce **ABP Black Friday Campaign**, packed with exclusive deals that you simply won't want to miss. Whether you are ready to start building with ABP or looking to expand your existing license, this is your chance to maximize your savings\! + +**Campaign Dates: Mark Your Calendar** + +Black Friday campaign is live for one week only\! Our deals run from: **November 24th \- December 1st.** + +Don't miss this limited-time opportunity to **save up to $3,000** and take your software development to the next level. + +**What's Included in the ABP Black Friday Campaign?** + +Here’s why this campaign is the best time to buy or upgrade: + +* Open to Everyone: This campaign is available for both new and existing customers. +* Stack Your Savings: You can combine this Black Friday offer with our multi-year discounts for the greatest possible value. +* Flexible Upgrades: Planning to upgrade to a higher package? Now is the perfect time to make that move at a lower cost. +* More Developer Seats? No Problem\! Additional developer seats are also eligible under this campaign, allowing you to grow your team effortlessly and affordably. + +**Save Money Now\!** + +This campaign is your best opportunity all year to unlock advanced features, scale your team, or upgrade your plan while **saving up to $3,000.** Secure your savings before the campaign ends on December 1st\! + +[**Visit Pricing Page to Explore Offers\!**](https://abp.io/pricing) + diff --git a/docs/en/Community-Articles/2025-11-20-Whats-New-In-NET10-Libraries-Runtime/Post.md b/docs/en/Community-Articles/2025-11-20-Whats-New-In-NET10-Libraries-Runtime/Post.md new file mode 100644 index 0000000000..4346346e7e --- /dev/null +++ b/docs/en/Community-Articles/2025-11-20-Whats-New-In-NET10-Libraries-Runtime/Post.md @@ -0,0 +1,149 @@ +# What’s New in .NET 10 Libraries and Runtime? + +With .NET 10, Microsoft continues to evolve the platform toward higher performance, stronger security, and modern developer ergonomics. This release brings substantial updates across both the **.NET Libraries** and the **.NET Runtime**, making everyday development faster, safer, and more efficient. + + + +------ + +## .NET Libraries Improvements + +### 1. Post-Quantum Cryptography + +.NET 10 introduces support for new **quantum-resistant algorithms**, ML-KEM, ML-DSA, and SLH-DSA, through the `System.Security.Cryptography` namespace. + These are available when running on compatible OS versions (OpenSSL 3.5+ or Windows CNG). + +**Why it matters:** This future-proofs .NET apps against next-generation security threats, keeping them aligned with emerging FIPS standards and PQC readiness. + + + +------ + +### 2. Numeric Ordering for String Comparison + +The `StringComparer` and `HashSet` classes now support **numeric-aware string comparison** via `CompareOptions.NumericOrdering`. + This allows natural sorting of strings like `v2`, `v10`, `v100`. + +**Why it matters:** Cleaner and more intuitive sorting for version names, product codes, and other mixed string-number data. + + + +------ + +### 3. String Normalization for Spans + +Normalization APIs now support `Span` and `ReadOnlySpan`, enabling text normalization without creating new string objects. + +**Why it matters:** Lower memory allocations in text-heavy scenarios, perfect for parsers, libraries, and streaming data pipelines. + + + +------ + +### 4. UTF-8 Support for Hex String Conversion + +The `Convert` class now allows **direct UTF-8 to hex conversions**, eliminating the need for intermediate string allocations. + +**Why it matters:** Faster serialization and deserialization, especially useful in networking, cryptography, and binary protocols. + + + +------ + +### 5. Async ZIP APIs + +ZIP handling now fully supports asynchronous operations, from creation and extraction to updates, with cancellation support. + +**Why it matters:** Ideal for real-time applications, WebSocket I/O, and microservices that handle compressed data streams. + + + +------ + +### 6. ZipArchive Performance Boost + +ZIP operations are now faster and more memory-efficient thanks to parallel extraction and reduced memory pressure. + +**Why it matters:** Perfect for file-heavy workloads like installers, packaging tools, and CI/CD utilities. + +------ + + + +### 7. TLS 1.3 Support on macOS + +.NET 10 brings **TLS 1.3 client support** to macOS using Apple’s `Network.framework`, integrated with `SslStream` and `HttpClient`. + +**Why it matters:** Consistent, faster, and more secure HTTPS connections across Windows, Linux, and macOS. + + + +------ + +### 8. Telemetry Schema URLs + +`ActivitySource` and `Meter` now support **telemetry schema URLs**, aligning with OpenTelemetry standards. + +**Why it matters:** Simplifies integration with observability platforms like Grafana, Prometheus, and Application Insights. + + + +------ + +### 9. OrderedDictionary Performance Improvements + +New overloads for `TryAdd` and `TryGetValue` improve performance by returning entry indexes directly. + +**Why it matters:** Up to 20% faster JSON updates and more efficient dictionary operations, particularly in `JsonObject`. + + + +------ + +## .NET Runtime Improvements + + + +### 1. JIT Compiler Enhancements + +- **Faster Struct Handling:** The JIT now passes structs directly via CPU registers, reducing memory operations. + *→ Result: Faster execution and tighter loops.* + +- **Array Interface Devirtualization:** Loops like `foreach` over arrays are now almost as fast as `for` loops. + *→ Result: Fewer abstraction costs and better inlining.* + +- **Improved Code Layout:** A new 3-opt heuristic arranges “hot” code paths closer in memory. + *→ Result: Better branch prediction and CPU cache performance.* + +- **Smarter Inlining:** The JIT can now inline more method types (even with `try-finally`), guided by runtime profiling. + *→ Result: Reduced overhead for frequently called methods.* + + + +------ + +### 2. Stack Allocation Improvements + +.NET 10 extends stack allocation to **small arrays of both value and reference types**, with **escape analysis** ensuring safe allocation. + +**Why it matters:** Fewer heap allocations mean less GC work and faster execution, especially in high-frequency or temporary operations. + + + +------ + +### 3. ARM64 Write-Barrier Optimization + +The garbage collector’s write-barrier logic is now optimized for ARM64, cutting unnecessary memory scans. + +**Why it matters:** Up to **20% shorter GC pauses** and better overall performance on ARM-based devices and servers. + + + + + +## Summary + +.NET 10 doubles down on **performance, efficiency, and modern standards**. From quantum-ready cryptography to smarter memory management and diagnostics, this release makes .NET more ready than ever for the next generation of applications. + +Whether you’re building enterprise APIs, distributed systems, or cloud-native tools, upgrading to .NET 10 means faster code, safer systems, and better developer experience. diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/Post.md b/docs/en/Community-Articles/2025-11-21-AntiGravity/Post.md new file mode 100644 index 0000000000..d5e34e7892 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-21-AntiGravity/Post.md @@ -0,0 +1,158 @@ +# My First Look and Experience with Google AntiGravity + +## Is Google AntiGravity Going to Replace Your Main Code Editor? + +Today, I tried the new code-editor AntiGravity by Google. *"It's beyond a code-editor*" by Google 🙄 +When I first launch it, I see the UI is almost same as Cursor. They're both based on Visual Studio Code. +That's why it was not hard to find what I'm looking for. + +First of all, the main difference as I see from the Cursor is; when I type a prompt in the agent section **AntiGravity first creates a Task List** (like a road-map) and whenever it finishes a task, it checks the corresponding task. Actually Cursor has a similar functionality but AntiGravity took it one step further. + +Second thing which was good to me; AntiGravity uses [Nano Banana 🍌](https://gemini.google/tr/overview/image-generation/). This is Google's AI image generation model... Why it's important because when you create an app, you don't need to search for graphics, deal with image licenses. **AntiGravity generates images automatically and no license is required!** + +Third exciting feature for me; **AntiGravity is integrated with Google Chrome and can communicate with the running website**. When I first run my web project, it installed a browser extension which can see and interact with my website. It can see the results, click somewhere else on the page, scroll, fill up the forms, amazing 😵 + +Another feature I loved is that **you can enter a new prompt even while AntiGravity is still generating a response** 🧐. It instantly prioritizes the latest input and adjusts the ongoing process if needed. But in Cursor, if you add a prompt before the cursor finishes, it simply queues it and runs it later 😔. + +And lastly, **AntiGravity is working very good with Gemini 3**. + +Well, everything was not so perfect 😥 When I tried AntiGravity, couple of times it stucked AI generation and Agent stopped. I faced errors like this 👇 + +![Errors](errors.png) + + + +## Debugging .NET Projects via AntiGravity + +⚠ There's a crucial development issue with AntiGravity (and also for Cursor, Windsurf etc...) 🤕 you **cannot debug your .NET application with AntiGravity 🥺.** *This is Microsoft's policy!* Microsoft doesn't allow debugging for 3rd party IDEs and shows the below error... That's why I cannot say it's a downside of AntiGravity. You need to use Microsft's original VS Code, Visual Studio or Rider for debugging. But wait a while there's a workaround for this, I'll let you know in the next section. + + + +![Debugging](debug.png) + +### What does this error mean? + +AntiGravity, Cursor, Windsurf etc... are using Visual Studio Code and the C# extension for VS Code includes the Microsoft .NET Core Debugger "*vsdbg*". +VS Code is open-source but "*vsdbg*" is not open-source! It's working only with Visual Studio Code, Visual Studio and Visual Studio for Mac. This is clearly stated at [Microsoft's this link](https://github.com/dotnet/vscode-csharp/blob/main/docs/debugger/Microsoft-.NET-Core-Debugger-licensing-and-Microsoft-Visual-Studio-Code.md). + +### Ok! How to resolve debugging issue with AntiGravity? and Cursor and Windsurf... + +There's a free C# debugger extension for Visual Studio Code based IDEs that supports AntiGravity, Cursor and Windsurf. The extension name is **C#**. +You can download this free C# debugger extension at 👉 [open-vsx.org/extension/muhammad-sammy/csharp/](https://open-vsx.org/extension/muhammad-sammy/csharp/). +For AntiGravity open Extension window (*Ctrl + Shift + X*) and search for `C#`, there you'll see this extension. + +![C# Debugging Extension](csharp-debug-extension.png) + +After installing, I restarted AntiGravity and now I can see the red circle which allows me to add breakpoint on C# code. + +![Add C# Breakpoint](breakpoint.png) + +### Another Extension For Debugging .NET Apps on VS Code + +Recently I heard about DotRush extension from the folks. As they say DotRush works slightly faster and support Razor pages (.cshtml files). +Here's the link for DotRush https://github.com/JaneySprings/DotRush + +### Finding Website Running Port + +When you run the web project via C# debugger extension, normally it's not using the `launch.json` therefore the website port is not the one when you start from Visual Studio / Rider... So what's my website's port which I just run now? Normally for ASP.NET Core **the default port is 5000**. You can try navigating to http://localhost:5000/. +Alternatively you can write the below code in `Program.cs` which prints the full address of your website in the logs. +If you do the steps which I showed you, you can debug your C# application via AntiGravity and other VS Code derivatives. + +![Find Website Port](find-website-port.png) + +## How Much is AntiGravity? 💲 + +Currently there's only individual plan is available for personal accounts and that's free 👏! The contents of Team and Enterprise plans and prices are not announced yet. But **Gemini 3 is not free**! I used it with my company's Google Workspace account which we normally pay for Gemini. + +![Pricing](pricing.png) + +## More About AntiGravity + +There have been many AI assisted IDEs like [Windsurf](https://windsurf.com/), [Cursor](https://cursor.com/), [Zed](https://zed.dev/), [Replit](https://replit.com/) and [Fleet](https://www.jetbrains.com/fleet/). But this time it's different, this is backed by Google. +As you see from the below image AntiGravity, uses a standard grid layout as others based on VS Code editor. +It's very similar to Cursor, Visual Studio, Rider. + +![AntiGravity UI](anti-gravity-ui.png) + +## Supported LLMs 🧠 + +Antigravity offers the below models which supports reasoning: Gemini 3 Pro, Claude Sonnet 4.5, GPT-OSS + +![LLMs](llms.png) + +Antigravity uses other models for supportive tasks in the background: + +- **Nano banana**: This is used to generate images. +- **Gemini 2.5 Pro UI Checkpoint**: It's for the browser subagent to trigger browser action such as clicking, scrolling, or filling in input. +- **Gemini 2.5 Flash**: For checkpointing and context summarization, this is used. +- **Gemini 2.5 Flash Lite**: And when it's need to make a semantic search in your code-base, this is used. + +## AntiGravity Can See Your Website + +This makes a big difference from traditional IDEs. AntiGravity's browser agent is taking screenshots of your pages when it needs to check. This is achieved by a Chrome Extension as a tool to the agent, and you can also prompt the agent to take a screenshot of a page. It can iterate on website designs and implementations, it can perform UI Testing, it can monitor dashboards, it can automate routine tasks like rerunning CI. +This is the link for the extension 👉 [chromewebstore.google.com/detail/antigravity-browser-exten/eeijfnjmjelapkebgockoeaadonbchdd](https://chromewebstore.google.com/detail/antigravity-browser-exten/eeijfnjmjelapkebgockoeaadonbchdd). AntiGravity will install this extension automatically on the first run. + +![Browser Extension](extension.png) + +![Extension Features](extension-features.png) + +## MCP Integration + +### When Do We Need MCP in a Code Editor? + +Simply if we want to connect to a 3rd party service to complete our task we need MCP. So AntiGravity can connect to your DB and write proper SQL queries or it can pull in recent build logs from Netlify or Heroku. Also you can ask AntiGravity to to connect GitHub for finding the best authentication pattern. + +### AntiGravity Supports These MCP Servers + +Airweave, AlloyDB for PostgreSQL, Atlassian, BigQuery, Cloud SQL for PostgreSQL, Cloud SQL for MySQL, Cloud SQL for SQL Server, Dart, Dataplex, Figma Dev Mode MCP, Firebase, GitHub, Harness, Heroku, Linear, Locofy, Looker, MCP Toolbox for Databases, MongoDB, Neon, Netlify, Notion, PayPal, Perplexity Ask, Pinecone, Prisma, Redis, Sequential Thinking, SonarQube, Spanner, Stripe and Supabase. + +![MCP](mcp.png) + +## Agent Settings ⚙️ + +The major settings of Agent are: + +- **Agent Auto Fix Lints**: I enabled this setting because I want the Agent automatically fixes its own mistakes for invalid syntax, bad formatting, unused variables, unreachable code or following coding standards... It makes extra tool calls that's why little bit expensive 🥴. +- **Auto Execution**: Sometimes Agent tries to build application or writing test code and running it, in these cases it executes command. I choose "Turbo" 🤜 With this option, Agent always runs the terminal command and controls my browser. +- **Review Policy**: How much control you are giving to agent 🙎. I choose "Always Proceed" 👌 because I mostly trust AI 😀. The Agent will never ask for review. + +![Agent Settings](agent-settings.png) + +## Differences Between Cursor and AntiGravity + +While Cursor was the champion of AI code editors, **Antigravity brings a different philosophy**. + +### 1. "Agent-First 🤖" vs "You-First 🤠" + +- **Cursor:** It acts like an assistant; it predicts your next move, auto-completes your thoughts, and helps you refactor while you type. You are still the driver; Cursor just drives the car at 200 km/h. +- **Antigravity:** Antigravity is built to let you manage coding tasks. It is "Agent-First." You don't just type code; you assign tasks to autonomous agents (e.g., "Fix the bug in the login flow and verify it in the browser"). It behaves more like a junior developer that you supervise. + +### 2. The Interface + +- **Cursor:** Looks and feels exactly like **VS Code**. If you know VS Code, you know Cursor. + +- **Antigravity:** Introduces 2 major layouts: + - **Editor View:** Similar to a standard IDE + - **Manager View:** A dashboard where you see multiple "Agents" working in parallel. You can watch them plan, execute, and test tasks asynchronously. + +### 3. Verification & Trust + +- **Cursor:** You verify by reading the code diffs it suggests. +- **Antigravity:** Introduces **Artifacts**... Since the agents work autonomously, they generate proof-of-work documents, screenshots of the app running, browser logs and execution plans. So you can verify what they did without necessarily reading every line of code immediately. + +### 4. Capabilities + +- **Cursor:** Best-in-class **Autocomplete** ("Tab" feature) and **Composer** (multi-file editing). It excels at "Vibe Coding". It's getting into a flow state where the AI writes the boilerplate and you direct the logic. +- **Antigravity:** Is good at **Autonomous Execution**. It has a built-in browser and terminal that the *Agent* controls. The Agent can write code, run the server, open the browser, see the error, and fix it 😎 + +### 5. AI Models (Brains 🧠) + +- **Cursor:** Model Agnostic. You can switch between **Claude 3.5 Sonnet** *-mostly the community uses this-*, GPT-4o, and others. +- **Antigravity:** Built deeply around **Gemini 3 Pro**. It leverages Gemini's massive context window (1M+ tokens) to understand huge mono repos without needing as much "RAG" as Cursor. + + + +## Try It Yourself Now 🤝 + +If you are ready to experience the new AI code editor by Google, download and use 👇 +[**Launch Google AntiGravity**](https://antigravity.google/) \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/agent-settings.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/agent-settings.png new file mode 100644 index 0000000000..a659c244c5 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/agent-settings.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/anti-gravity-ui.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/anti-gravity-ui.png new file mode 100644 index 0000000000..885284dd56 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/anti-gravity-ui.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/breakpoint.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/breakpoint.png new file mode 100644 index 0000000000..0ef01d71a3 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/breakpoint.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/cover.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/cover.png new file mode 100644 index 0000000000..b2ec245a2f Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/cover.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/csharp-debug-extension.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/csharp-debug-extension.png new file mode 100644 index 0000000000..6807c3f6bc Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/csharp-debug-extension.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/debug.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/debug.png new file mode 100644 index 0000000000..c4674a89f3 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/debug.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/errors.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/errors.png new file mode 100644 index 0000000000..f8c2e43dac Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/errors.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/extension-features.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/extension-features.png new file mode 100644 index 0000000000..cd0b07cabf Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/extension-features.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/extension.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/extension.png new file mode 100644 index 0000000000..601a28849a Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/extension.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/find-website-port.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/find-website-port.png new file mode 100644 index 0000000000..183e8c6f5b Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/find-website-port.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/image-20251123185724281.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/image-20251123185724281.png new file mode 100644 index 0000000000..82b8f478e1 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/image-20251123185724281.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/llms.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/llms.png new file mode 100644 index 0000000000..82b8f478e1 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/llms.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/mcp.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/mcp.png new file mode 100644 index 0000000000..06a343f068 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/mcp.png differ diff --git a/docs/en/Community-Articles/2025-11-21-AntiGravity/pricing.png b/docs/en/Community-Articles/2025-11-21-AntiGravity/pricing.png new file mode 100644 index 0000000000..0b552352e3 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-21-AntiGravity/pricing.png differ diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/coverimage.png b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/coverimage.png new file mode 100644 index 0000000000..b264e259e9 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/coverimage.png differ diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/chat-history-hybrid.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/chat-history-hybrid.svg new file mode 100644 index 0000000000..ab1bb36114 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/chat-history-hybrid.svg @@ -0,0 +1,114 @@ + + + + + + + Hybrid Chat History: Truncation + RAG on History + + + + + + Full Chat History + + + (100 messages, 20K tokens) + + + + + Messages 1-10 (1 day ago) + + + Messages 11-20 (12 hours ago) + + ... + + + Messages 81-90 + + + Messages 91-100 (Last 10) + + + + + + + + + + + + Old Messages + Recent Messages + + + + + Vector DB + + + (Long-term Memory) + + + Messages 1-90 with embeddings + + + Tool: SearchChatHistory() + + + + + + Prompt (Short-term) + + + Messages 91-100 + + + Truncation (Last 10 messages) + + + Low tokens, fast + + + + + + + + + LLM + + + Short-term context + + + + Long-term memory via tool + + + access when needed + + + + + + ✅ Hybrid Approach Benefits + + + + + + Low Cost: Only last 10 messages in prompt per request (truncation) + + + + + + + High Fidelity: LLM can access old messages via SearchChatHistory tool when needed + + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/mcp-architecture.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/mcp-architecture.svg new file mode 100644 index 0000000000..ee590d27eb --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/mcp-architecture.svg @@ -0,0 +1,150 @@ + + + + + + + Model Context Protocol (MCP): Out-of-Process Tools + + + + + MCP Hosts (Clients) + + + + + + Semantic Kernel + + + (.NET Agent) + + + + + + + VS Code Copilot + + + (.vscode/mcp.json) + + + + + + + Claude Desktop + + + (Anthropic) + + + + + + + + + + + + + + + + stdio/http + + + JSON-RPC + + + + + + MCP Protocol + + + (Standardized Interface) + + + ModelContextProtocol SDK + + + + + + + + + + MCP Servers (Tools) + + + + + + filesystem.mcp.exe + + + ReadFile(), ListFiles() + + + (.NET Console App) + + + + + + + sqlserver.mcp.exe + + + ExecuteQuery(), GetSchema() + + + (.NET Console App) + + + + + + + github.mcp.js + + + CreateIssue(), GetPR() + + + (Node.js / TypeScript) + + + + + + + ✅ MCP Benefits + + + + + + Reusability: Write once, use everywhere (SK, VS Code, Claude) + + + + + + + Independence: MCP server runs separately, doesn't affect main app (out-of-process) + + + + + + + Language Agnostic: Can be written in C#, Python, Node.js, everyone speaks same protocol + + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/multilingual-rag.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/multilingual-rag.svg new file mode 100644 index 0000000000..81173091f0 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/multilingual-rag.svg @@ -0,0 +1,135 @@ + + + + + + + Multilingual RAG: Query Translation Pattern + + + + + + User Query + + + 🇹🇷 "Yazıcıyı ağa + + + nasıl bağlarım?" + + + + + + + + + + + + Tool 1 + + + + + + TranslationPlugin + + + TranslateText() + + + Target: English + + + + + + Tool 2 + + + + + RAGPlugin + + + 🇬🇧 "How do I connect + + + the printer to network?" + + + + + + Vector Search + + + + + Vector DB + + + (English Docs) + + + "Navigate to Settings + + + > Network > Wi-Fi..." + + + + + + + + Retrieved Context + + + 🇬🇧 English text + + + (Manual excerpt) + + + + + + + + + LLM (GPT-5) + + + Context: [English] + + + Generates: [Turkish Response] + + + + + + + + + Response to User + + + 🇹🇷 "Ayarlar > Ağ > + + + Wi-Fi bölümüne gidin..." + + + + + + ✅ Benefit: Single language (English) docs, multi-language query support + + + Tool Chain: TranslationPlugin → RAGPlugin → LLM Final Generation (Original language) + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/pgvector-integration.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/pgvector-integration.svg new file mode 100644 index 0000000000..2903740e57 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/pgvector-integration.svg @@ -0,0 +1,112 @@ + + + + + + + PostgreSQL + pgvector: Integrated RAG with EF Core + + + + + + .NET Application + + + (EF Core DbContext) + + + + + + + + + + + + LINQ Query + + + + + + Pgvector.EntityFrameworkCore + + + CosineDistance(), L2Distance() + + + EF Core Extensions + + + + + + SQL Query + + + + + + PostgreSQL + pgvector + + + + + + + + id + content + embedding + + + + + 1 + Contoso... + [0.2, -0.1,...] + + 2 + Revenue... + [0.5, 0.3,...] + + + + + + ✅ Benefits + + + + + + Existing SQL Knowledge: PostgreSQL is already a familiar database + + + + + + + EF Core Integration: Vector queries with LINQ (.OrderBy(), .Where()) + + + + + + + Metadata JOIN: Vector + Relational data in same query (tenant_id, user_id...) + + + + + + + ACID Compliant: Transaction support (rollback, commit) + + + + + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/rag-parent-child.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/rag-parent-child.svg new file mode 100644 index 0000000000..752c2c42b1 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/rag-parent-child.svg @@ -0,0 +1,118 @@ + + + + + + + Parent-Child RAG Pattern: Search Small, Respond Large + + + + + Original Document + + + + Parent 1 (800 token) + + + Parent 2 (800 token) + + + Parent 3... + + + + + + + + + + + + + + + + + + + Child Chunks + (In Vector DB) + + + + + Child 1.1 (100 token) [ParentID=1] + + + + + Child 1.2 (100 token) [ParentID=1] + + + + + Child 1.3 (100 token) [ParentID=1] + + + + + Child 2.1 (100 token) [ParentID=2] + + + + + Child 2.2... + + + + + User Query + "What was Contoso's + 2024 revenue?" + + + + 1. Vector Search + (On Child chunks) + + + + Best Match + Child 1.2 (Score: 0.95) + + + + + + 2. Fetch Parent via + ParentID + + + + Retrieved Parent Chunk + Parent 1 (800 tokens) + Full context + details + + + + 3. Send to LLM + + + + LLM Response + "Contoso's 2024 + revenue was $2.5 billion + as reported." + + + + + ✅ Benefit: Precise search (Child) + Rich context (Parent) = Optimal quality + + + Alternative: Only large chunks → Lower precision | Only small chunks → Insufficient context + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/reasoning-effort-diagram.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/reasoning-effort-diagram.svg new file mode 100644 index 0000000000..fc6a18d68d --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/reasoning-effort-diagram.svg @@ -0,0 +1,60 @@ + + + + + + + ReasoningEffortLevel: Cost vs Quality + + + + + + + + High + Medium + Low + + + + Quality / Cost + + + + + + Minimal + Fast + Cheap + + + + + Low + Simple Queries + + + + + Medium + Standard + + + + + High + Complex + Coding + + + + + + + + + + + Increasing Cost (Reasoning Tokens ↑) + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/svg-diagram-example.svg b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/svg-diagram-example.svg new file mode 100644 index 0000000000..6087893702 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/images/svg-diagram-example.svg @@ -0,0 +1,149 @@ + + + + + + + PostgreSQL + pgvector Architecture + + + + + + + .NET Application + + + + + + Web API / + + + Controllers + + + + + + Business Logic / + + + Services + + + + + + Data Access + + + Layer + + + + + + + + + + + + ORM + + + + + + Entity Framework + + + Core + + + DbContext + + + LINQ Queries + + + + + + Npgsql + + + + + + PostgreSQL + + + + + + Relational Tables + + + (Standard Data) + + + + + + pgvector + + + Vector Storage + + + + + + Vector Search + + + Similarity Queries + + + (<=>, <->, <#>) + + + + + + + + + + + Search Results + + + • Embeddings + + + • Similarity Score + + + • Ranked Results + + + + + + + + + + Data Flow: + + + 1. .NET → EF Core → PostgreSQL (Data Operations) + + + 2. Vector Similarity Search with pgvector + + + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/post.md b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/post.md new file mode 100644 index 0000000000..8fa2067d01 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/post.md @@ -0,0 +1,414 @@ +# Building Production-Ready LLM Applications with .NET: A Practical Guide + +Large Language Models (LLMs) have evolved rapidly, and integrating them into production .NET applications requires staying current with the latest approaches. In this article, I'll share practical tips and patterns I've learned while building LLM-powered systems, covering everything from API changes in GPT-5 to implementing efficient RAG (Retrieval Augmented Generation) architectures. + +Whether you're building a chatbot, a knowledge base assistant, or integrating AI into your enterprise applications, these production-tested insights will help you avoid common pitfalls and build more reliable systems. + +## The Temperature Paradigm Shift: GPT-5 Changes Everything + +If you've been working with GPT-4 or earlier models, you're familiar with the `temperature` and `top_p` parameters for controlling response randomness. **Here's the critical update**: GPT-5 no longer supports these parameters! + +### The Old Way (GPT-4) +```csharp +var chatRequest = new ChatOptions +{ + Temperature = 0.7, // ✅ Worked with GPT-4 + TopP = 0.9 // ✅ Worked with GPT-4 +}; +``` + +### The New Way (GPT-5) +```csharp +var chatRequest = new ChatOptions +{ + RawRepresentationFactory = (client => new ChatCompletionOptions() + { +#pragma warning disable OPENAI001 + ReasoningEffortLevel = "minimal", +#pragma warning restore OPENAI001 + }) +}; +``` + +**Why the change?** GPT-5 incorporates an internal reasoning and verification process. Instead of controlling randomness, you now specify how much computational effort the model should invest in reasoning through the problem. + +![Reasoning Effort Levels](images/reasoning-effort-diagram.svg) + +### Choosing the Right Reasoning Level + +- **Low**: Quick responses for simple queries (e.g., "What's the capital of France?") +- **Medium**: Balanced approach for most use cases +- **High**: Complex reasoning tasks (e.g., code generation, multi-step problem solving) + +> **Pro Tip**: Reasoning tokens are included in your API costs. Use "High" only when necessary to optimize your budget. + +## System Prompts: The "Lost in the Middle" Problem + +Here's a critical insight that can save you hours of debugging: **Important rules must be repeated at the END of your prompt!** + +### ❌ What Doesn't Work +``` +You are a helpful assistant. +RULE: Never share passwords or sensitive information. + +[User Input] +``` + +### ✅ What Actually Works +``` +You are a helpful assistant. +RULE: Never share passwords or sensitive information. + +[User Input] + +⚠️ REMINDER: Apply the rules above strictly, ESPECIALLY regarding passwords. +``` + +**Why?** LLMs suffer from the "Lost in the Middle" phenomenon—they pay more attention to the beginning and end of the context window. Critical instructions buried in the middle are often ignored. + +## RAG Architecture: The Parent-Child Pattern + +Retrieval Augmented Generation (RAG) is essential for grounding LLM responses in your own data. The most effective pattern I've found is the **Parent-Child approach**. + +![RAG Parent-Child Architecture](images/rag-parent-child.svg) + +### How It Works + +1. **Split documents into hierarchies**: + - **Parent chunks**: Large sections (1000-2000 tokens) for context + - **Child chunks**: Small segments (200-500 tokens) for precise retrieval + +2. **Store both in vector database** with references + +3. **Query flow**: + - Search using child chunks (higher precision) + - Return parent chunks to LLM (richer context) + +### The Overlap Strategy + +Always use overlapping chunks to prevent information loss at boundaries! + +``` +Chunk 1: Token 0-500 +Chunk 2: Token 400-900 ← 100 token overlap +Chunk 3: Token 800-1300 ← 100 token overlap +``` + +**Standard recommendation**: 10-20% overlap (for 500 tokens, use 50-100 token overlap) + +### Implementation with Semantic Kernel + +```csharp +using Microsoft.SemanticKernel.Text; + +var chunks = TextChunker.SplitPlainTextParagraphs( + documentText, + maxTokensPerParagraph: 500, + overlapTokens: 50 +); + +foreach (var chunk in chunks) +{ + var embedding = await embeddingService.GenerateEmbeddingAsync(chunk); + await vectorDb.StoreAsync(chunk, embedding); +} +``` + +## PostgreSQL + pgvector: The Pragmatic Choice + +For .NET developers, choosing a vector database can be overwhelming. After evaluating multiple options, **PostgreSQL with pgvector** is the most practical choice for most scenarios. + +![pgvector Integration](images/pgvector-integration.svg) + +### Why pgvector? + +✅ **Use existing SQL knowledge** - No new query language to learn +✅ **EF Core integration** - Works with your existing data access layer +✅ **JOIN with metadata** - Combine vector search with traditional queries +✅ **WHERE clause filtering** - Filter by tenant, user, date, etc. +✅ **ACID compliance** - Transaction support for data consistency +✅ **No separate infrastructure** - One database for everything + +### Setting Up pgvector with EF Core + +First, install the NuGet package: + +```bash +dotnet add package Pgvector.EntityFrameworkCore +``` + +Define your entity: + +```csharp +using Pgvector; +using Pgvector.EntityFrameworkCore; + +public class DocumentChunk +{ + public Guid Id { get; set; } + public string Content { get; set; } + public Vector Embedding { get; set; } // 👈 pgvector type + public Guid ParentChunkId { get; set; } + public DateTime CreatedAt { get; set; } +} +``` + +Configure in DbContext: + +```csharp +protected override void OnModelCreating(ModelBuilder builder) +{ + builder.HasPostgresExtension("vector"); + + builder.Entity() + .Property(e => e.Embedding) + .HasColumnType("vector(1536)"); // 👈 OpenAI embedding dimension + + builder.Entity() + .HasIndex(e => e.Embedding) + .HasMethod("hnsw") // 👈 Fast approximate search + .HasOperators("vector_cosine_ops"); +} +``` + +### Performing Vector Search + +```csharp +using Pgvector.EntityFrameworkCore; + +public async Task> SearchAsync(string query) +{ + // 1. Convert query to embedding + var queryVector = await _embeddingService.GetEmbeddingAsync(query); + + // 2. Search + return await _context.DocumentChunks + .OrderBy(c => c.Embedding.L2Distance(queryVector)) // 👈 Lower is better + .Take(5) + .ToListAsync(); +} +``` + +**Source**: [Pgvector.NET on GitHub](https://github.com/pgvector/pgvector-dotnet?tab=readme-ov-file#entity-framework-core) + +## Smart Tool Usage: Make RAG a Tool, Not a Tax + +A common mistake is calling RAG on every single user message. This wastes tokens and money. Instead, **make RAG a tool** and let the LLM decide when to use it. + +### ❌ Expensive Approach +```csharp +// Always call RAG, even for "Hello" +var context = await PerformRAG(userMessage); +var response = await chatClient.CompleteAsync($"{context}\n\n{userMessage}"); +``` + +### ✅ Smart Approach +```csharp +[KernelFunction] +[Description("Search the company knowledge base for information")] +public async Task SearchKnowledgeBase( + [Description("The search query")] string query) +{ + var results = await _vectorDb.SearchAsync(query); + return string.Join("\n---\n", results.Select(r => r.Content)); +} +``` + +The LLM will call `SearchKnowledgeBase` only when needed: +- "Hello" → No tool call +- "What was our 2024 revenue?" → Calls tool +- "Tell me a joke" → No tool call + +## Multilingual RAG: Query Translation Strategy + +When your documents are in one language (e.g., English) but users query in another (e.g., Turkish), you need a translation strategy. + +![Multilingual RAG Architecture](images/multilingual-rag.svg) + +### Solution Options + +**Option 1**: Use an LLM that automatically calls tools in English +- Many modern LLMs can do this if properly instructed + +**Option 2**: Tool chain approach +```csharp +[KernelFunction] +[Description("Translate text to English")] +public async Task TranslateToEnglish(string text) +{ + // Translation logic +} + +[KernelFunction] +[Description("Search knowledge base (English only)")] +public async Task SearchKnowledgeBase(string englishQuery) +{ + // Search logic +} +``` + +The LLM will: +1. Call `TranslateToEnglish("2024 geliri nedir?")` +2. Get "What was 2024 revenue?" +3. Call `SearchKnowledgeBase("What was 2024 revenue?")` +4. Return results and respond in Turkish + +## Model Context Protocol (MCP): Beyond In-Process Tools + +Microsoft and Anthropic recently released official C# SDKs for the Model Context Protocol (MCP). This is a game-changer for tool reusability. + +![MCP Architecture](images/mcp-architecture.svg) + +### MCP vs. Semantic Kernel Plugins + +| Feature | SK Plugins | MCP Servers | +|---------|-----------|-------------| +| **Process** | In-process | Out-of-process (stdio/http) | +| **Reusability** | Application-specific | Cross-application | +| **Examples** | Used within your app | VS Code Copilot, Claude Desktop | + +### Creating an MCP Server + +```csharp +using Microsoft.Extensions.Hosting; +using ModelContextProtocol.Extensions.Hosting; + +var builder = Host.CreateEmptyApplicationBuilder(settings: null); + +builder.Services.AddMcpServer() +.WithStdioServerTransport() +.WithToolsFromAssembly(); + +await builder.Build().RunAsync(); +``` + +Define your tools: + +```csharp +[McpServerToolType] +public static class FileSystemTools +{ + [McpServerTool, Description("Read a file from the file system")] + public static async Task ReadFile(string path) + { + // ⚠️ SECURITY: Always validate paths! + if (!IsPathSafe(path)) + throw new SecurityException("Invalid path"); + + return await File.ReadAllTextAsync(path); + } + + private static bool IsPathSafe(string path) + { + // Implement path traversal prevention + var fullPath = Path.GetFullPath(path); + return fullPath.StartsWith(AllowedDirectory); + } +} +``` + +Your MCP server can now be used by VS Code Copilot, Claude Desktop, or any other MCP client! + +## Chat History Management: Truncation + RAG Hybrid + +For long conversations, storing all history in the context window becomes impractical. Here's the pattern that works: + +![Chat History Hybrid Strategy](images/chat-history-hybrid.svg) + +### ❌ Lossy Approach +``` +First 50 messages → Summarize with LLM → Single summary message +``` +**Problem**: Detail loss (fidelity loss) + +### ✅ Hybrid Approach +1. **Recent messages** (last 5-10): Keep in prompt for immediate context +2. **Older messages**: Store in vector database as a tool + +```csharp +[KernelFunction] +[Description("Search conversation history for past discussions")] +public async Task SearchChatHistory( + [Description("What to search for")] string query) +{ + var relevantMessages = await _vectorDb.SearchAsync(query); + return string.Join("\n", relevantMessages.Select(m => + $"[{m.Timestamp}] {m.Role}: {m.Content}")); +} +``` + +The LLM retrieves only relevant past context when needed, avoiding summary-induced information loss. + +## RAG vs. Fine-Tuning: Choose Wisely + +A common misconception is using fine-tuning for knowledge injection. Here's when to use each: + +| Purpose | RAG | Fine-Tuning | +|---------|-----|-------------| +| **Goal** | Memory (provide facts) | Behavior (teach style) | +| **Updates** | Dynamic (add docs anytime) | Static (requires retraining) | +| **Cost** | Low dev, higher inference | High dev, lower inference | +| **Hallucination** | Reduces | Doesn't reduce | +| **Use Case** | Company docs, FAQs | Brand voice, specific format | + +**Common mistake**: "Let's fine-tune on our company documents" ❌ +**Better approach**: Use RAG! ✅ + +Fine-tuning is for teaching the model *how* to respond, not *what* to know. + +**Source**: [Oracle - RAG vs Fine-Tuning](https://www.oracle.com/artificial-intelligence/generative-ai/retrieval-augmented-generation-rag/rag-fine-tuning/) + +## Bonus: Why SVG is Superior for LLM-Generated Images + +When using LLMs to generate diagrams and visualizations, always request SVG format instead of PNG or JPG. + +### Why SVG? + +✅ **Text-based** → LLMs produce better results +✅ **Lower cost** → Fewer tokens than base64-encoded images +✅ **Editable** → Easy to modify after generation +✅ **Scalable** → Perfect quality at any size +✅ **Version control friendly** → Works great in Git + +### Example Prompt + +``` +Create an architecture diagram showing PostgreSQL with pgvector integration. +Format: SVG, 800x400 pixels. Show: .NET Application → EF Core → PostgreSQL → Vector Search. +Use arrows to connect stages. Color scheme: Blue tones. +``` + +![SVG Diagram Example](images/svg-diagram-example.svg) + +All diagrams in this article were generated as SVG, resulting in excellent quality and lower token costs! + +> **Pro Tip**: If you don't need photographs or complex renders, always choose SVG. + +## Architecture Roadmap: Putting It All Together + +Here's the recommended stack for building production LLM applications with .NET: + +1. **Orchestration**: Microsoft.Extensions.AI + Semantic Kernel (when needed) +2. **Vector Database**: PostgreSQL + Pgvector.EntityFrameworkCore +3. **RAG Pattern**: Parent-Child chunks with 10-20% overlap +4. **Tools**: MCP servers for reusability +5. **Reasoning**: ReasoningEffortLevel instead of temperature +6. **Prompting**: Critical rules at the end +7. **Cost Optimization**: Make RAG a tool, not automatic + +## Key Takeaways + +Let me summarize the most important production tips: + +1. **Temperature is gone** → Use `ReasoningEffortLevel` with GPT-5 +2. **Rules at the end** → Combat "Lost in the Middle" +3. **RAG as a tool** → Reduce costs significantly +4. **Parent-Child pattern** → Search small, respond with large +5. **Always use overlap** → 10-20% is the standard +6. **pgvector for most cases** → Unless you have billions of vectors +7. **MCP for reusability** → One codebase, works everywhere +8. **SVG for diagrams** → Better results, lower cost +9. **Hybrid chat history** → Recent in prompt, old in vector DB +10. **RAG > Fine-tuning** → For knowledge, not behavior + +Happy coding! 🚀 \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/summary.md b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/summary.md new file mode 100644 index 0000000000..fb1d41af5c --- /dev/null +++ b/docs/en/Community-Articles/2025-11-22-building-production-ready-llm-applications/summary.md @@ -0,0 +1 @@ +Learn how to build production-ready LLM applications with .NET. This comprehensive guide covers GPT-5 API changes, advanced RAG architectures with parent-child patterns, PostgreSQL pgvector integration, smart tool usage strategies, multilingual query handling, Model Context Protocol (MCP) for cross-application tool reusability, and chat history management techniques for enterprise applications. diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/POST.md b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/POST.md new file mode 100644 index 0000000000..6f8dfb96a1 --- /dev/null +++ b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/POST.md @@ -0,0 +1,60 @@ +# .NET Conf China 2025: Changing the World, Changing Ourselves - See You Again in Shanghai + +![](./images/1.png) + +.NET Conf China 2025 is an annual community event for developers, celebrating the release of .NET 10 (LTS) and the achievements of the past year in China. As an extension of .NET Conf 2025, this event brings together local tech communities, well-known companies, and open-source organizations. It has become the largest .NET online and offline conference in China, dedicated to spreading .NET technology in Chinese and fostering collaboration and exchange. + +## Event Highlights: Key Topics and Takeaways + +This year’s conference focused on three main themes: performance improvements, AI integration, and cross-platform development. Topics covered how to achieve performance gains while maintaining engineering quality, balancing between multi-platform consistency and native capabilities, and taking generative AI from “demo-level” to “production-ready.” On the community and ecosystem side, the event showcased the .NET Foundation’s and domestic and international companies’ progress in supporting architectures like ARM, LoongArch, and RISC-V. It also highlighted best practices in DevOps, observability, and engineering toolchains, creating a complete path from ideas to implementation. + +### Opening Keynote + +Scott Hanselman kicked off .NET Conf China 2025 with a video keynote, announcing that .NET 10 is now available on the official website. He framed the release around four pillars—AI, cloud-native, cross-platform, and performance—including integration with the Microsoft Agent Framework for building and orchestrating multi-agent systems in .NET/C#, industry-leading container and Kubernetes support with .NET Aspire simplifying local containerized development, a richer cross-platform desktop ecosystem (.NET MAUI, Avalonia, Uno Platform), and major performance gains such as Native AOT and single-file publishing for faster startup and easier distribution across platforms. + +He underscored China’s importance as .NET’s second-largest market, with roughly 13% of users, and noted that generative AI usage in China has doubled in 2025. The local community is seeing strong momentum around ML.NET, .NET Aspire, and the C# Dev Kit in VS Code. Reflecting on his Baby Smash game written 20 years ago, which now runs cross-platform on .NET 10, he called on developers to modernize: move existing Web, WinForms, and WPF apps to the cloud, improve performance, ship as a single executable, and weave in AI capabilities. + +On AI, he emphasized a human-centered stance: AI and agents should augment, not replace, developers. In the future, developers will orchestrate and govern agents, and human judgment will matter more than ever. He closed by thanking the open-source community for its many proposals and pull requests, stressing that .NET is an open-source platform built together by Microsoft and the community, and wishing everyone an inspiring conference and a joyful journey with .NET 10. + +![2](./images/2.png) + +### Roundtable Discussion + +The roundtable discussion, titled “Empowering with AI, Breaking Through Cross-Platform Barriers, and Ecosystem Innovation,” focused on practical implementation. It explored typical paths for large models and intelligent agents in enterprises, key considerations for choosing cross-platform UI frameworks, and the evolution of these frameworks. Panelists discussed questions like: How can AI capabilities be integrated into existing business processes instead of creating an “experimental” pipeline? How should cross-platform solutions be evaluated in terms of performance, ecosystem, and team skillsets? What are the unique opportunities for domestic ecosystems in the global tech landscape? And how can community collaboration help developers quickly adopt best practices? A shared consensus emerged: in the short term, focus on running scenarios; in the long term, return to engineering fundamentals. Both toolchains and methodologies are equally important. + +![](./images/21.png) + +### In-Depth Sessions + +The afternoon featured four breakout sessions, covering a wide range of topics with deep dives into both foundational technologies and real-world project reviews: + +- **Frontend and Cross-Platform:** Focused on the progress of Avalonia, Blazor, and WebAssembly, as well as the integrated experience of .NET Aspire in multi-service applications. Speakers shared insights on reusing core logic between desktop and web, shortening cold start times with incremental compilation and resource trimming, and performance profiling and optimization in WASM scenarios. +- **AI Agents and Enterprise Adoption:** Discussed multi-agent orchestration, the MCP plugin ecosystem, and enterprise data compliance. From common pitfalls of “demo-level” AI to the “five-step method” for moving from POC to production, the session covered use cases like knowledge retrieval, process automation, intelligent customer service, and developer assistants, emphasizing evaluation metrics, prompt engineering, and monitoring governance. +- **.NET Practices and Engineering:** Focused on the latest capabilities and performance practices of EF Core, the boundaries of NativeAOT, automated testing strategies, and observability implementation. Discussions included database migration strategies, caching and concurrency control for hot paths, end-to-end tracing, and structured logging. +- **Solutions and Case Studies:** From Clean Architecture/DDD to AI-powered business evolution, topics included application modernization, SaaS transformation, and edge-cloud collaboration in AIoT. Speakers broke down modular governance, team collaboration, and release strategies for complex systems, putting “delivering value continuously” at the center stage. + +![](./images/3.png) + +## ABP Booth Highlights: Showcases, Conversations, and Fun + +The story of ABP began with a promise to create a better starting point. From the frustration of “copy-pasting boilerplate code,” we crafted a modular, opinionated framework. We chose open source and community collaboration. We founded Volosoft to turn our vision into reality with professional tools. Today, tens of thousands of developers explore the ABP framework, and thousands of teams rely on the ABP platform to deliver production-grade .NET applications faster and more securely. + +![](./images/4.png) + +At .NET Conf China 2025, we brought our “developer platform built for developers” to every visitor. Our booth demonstrations started with “a production-ready skeleton from the start”: modular layered architecture, built-in authentication and authorization systems, multi-tenancy support, audit logging, and localization—all out of the box. On the frontend and backend, ABP offers diverse options like MVC, Blazor, and Angular, enabling teams to quickly implement solutions on familiar stacks while maintaining flexibility for future evolution. We also showcased how ABP integrates with containerization, CI/CD, and observability, emphasizing “engineering built into the framework, not reinvented by every team.” + +![](./images/42.png) + +**Interaction and Prizes:** Sharing technology should also be warm and engaging. We hosted a QR code raffle at the booth, with prizes including ABP stickers, the book *Mastering ABP Framework*, and Bluetooth headphones. Multiple rounds of raffles and group photos made the interactions more memorable. Many developers shared their ABP experiences and plans for improvement right at the booth, and a few impromptu “code walkthroughs” naturally happened. The love and joy for technology were captured in every handshake and discussion. + +![](./images/41.png) + +## Looking Ahead: Building the Ecosystem Together + +From an open-source journey to a complete development platform for the future, we’ve always believed that developers deserve a better starting point. Around performance, intelligence, and cross-platform capabilities, we will continue investing in engineering, ecosystem collaboration, and best practice sharing. We also welcome more partners to contribute through documentation and examples, share your experiences, and submit your ideas. Together, let’s make “useful infrastructure” more stable, efficient, and business-friendly. + +We look forward to exchanging ideas, sharing practices, and building the ecosystem together at the next gathering. Technology meets creativity, and the possibilities are endless. We’re on the road and waiting for you at the next event. + +See you next year at .NET Conf China 2026! + +![](./images/5.png) \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/1.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/1.png new file mode 100644 index 0000000000..beaf49b86e Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/1.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/2.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/2.png new file mode 100644 index 0000000000..a081bf99e3 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/2.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/21.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/21.png new file mode 100644 index 0000000000..345452360a Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/21.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/3.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/3.png new file mode 100644 index 0000000000..b69f36ef66 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/3.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/4.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/4.png new file mode 100644 index 0000000000..a3a2ece3e9 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/4.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/41.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/41.png new file mode 100644 index 0000000000..19143279aa Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/41.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/42.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/42.png new file mode 100644 index 0000000000..730969eb8e Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/42.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/5.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/5.png new file mode 100644 index 0000000000..f1a2a437a0 Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/5.png differ diff --git a/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/cover.png b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/cover.png new file mode 100644 index 0000000000..f0eb6cea5f Binary files /dev/null and b/docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/cover.png differ diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/cover.png b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/cover.png new file mode 100644 index 0000000000..9eee8f6d07 Binary files /dev/null and b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/cover.png differ diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/architecture-diagram.svg b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/architecture-diagram.svg new file mode 100644 index 0000000000..d0c5fd900a --- /dev/null +++ b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/architecture-diagram.svg @@ -0,0 +1,145 @@ + + + + + + + + + + AutoCache Architecture + + + + Application Service + + + BookAppService + + [Cache(typeof(Book))] + public Task<BookDto> GetAsync() + + + + Cache Interceptor + + + AutoCacheInterceptor + + • Detect [Cache] attribute + • Intercept method calls + + + + Cache Manager + + + AutoCacheManager + + • Generate cache keys + • Store/Retrieve data + + + + + + + + Distributed Cache + + + Redis / Memory + + + + Get/Set + + + + Domain Layer + + + Book Entity + + + + Event Bus + + + EntityChangedEvent + + + + Invalidation Handler + + + Clear Related Caches + + + + Cache Key Manager + + + IAutoCacheKeyManager + + + + Publish + + + Handle + + + Invalidate + + + Remove keys + + + + Cache Scopes + + • Global - Shared by all users + • CurrentUser - Per user ID + • AuthenticatedUser - Auth status + + + ① Method Call + Application service method is called + + ② Intercept + Interceptor detects [Cache] attribute + + ③ Check Cache + Manager checks distributed cache + + ④ Invalidate + Entity changes clear related caches + + + + + + Application Layer + + + Cache Components + + + Storage Layer + + + Event Handling + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/automatic-caching-flow.svg b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/automatic-caching-flow.svg new file mode 100644 index 0000000000..9ea54b1f46 --- /dev/null +++ b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/automatic-caching-flow.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + Automatic Caching Flow + + + + Client Call + GetAsync(bookId) + + + + AutoCache + Interceptor + [Cache] detected + + + + Cache + Hit? + + + + + + + + ✓ HIT + Return cached result (Fast!) + + + + ✗ MISS + + + + Execute + Actual Method + Query Database + + + + Store Result + in Cache + For future use + + + Return result + + + + + + + + Cache Hit (5-10ms) + + + Cache Miss (100-500ms) + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-invalidation-flow.svg b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-invalidation-flow.svg new file mode 100644 index 0000000000..d0281902d8 --- /dev/null +++ b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-invalidation-flow.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + Cache Invalidation Workflow + + + + 1 + + + User Action + UpdateAsync(bookId) + + + + 2 + + + Update Database + Repository.UpdateAsync() + + + + 3 + + + Publish Event + EntityChangedEvent + + + + + + + + 4 + + + Invalidation + Handler + Listen for changes + + + + Event Bus + + + + 5 + + + Wait for UoW + OnCompleted() callback + + + + + + + 6 + + + Clear Cache + + + + ✗ GetAsync(id) + ✗ GetListAsync() + ✗ Related queries + + + + INVALIDATE + + + + Redis / Distributed Cache + + + Before: + + Book:Get:123 ✓ + + + Book:List ✓ + + + After: + + Book:Get:123 + + + Book:List + + + + CLEARED + + + + Timeline + + + + Why Wait for UoW? + • Ensures transaction completes + • Prevents cache-DB inconsistency + • Handles rollback scenarios + + + Invalidation Scope + • All caches with [Cache(Book)] + • Across all scopes (Global, User) + • Entity-specific keys by ID + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-scoping-diagram.svg b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-scoping-diagram.svg new file mode 100644 index 0000000000..848d9d0c51 --- /dev/null +++ b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-scoping-diagram.svg @@ -0,0 +1,135 @@ + + + + + + + Cache Scoping Strategies + + + + Global + + + 🌍 + + Shared by all users + Ideal for public data + + + [Cache(typeof(Book), + Scope = Global)] + + + + CurrentUser + + + 👤 + + 👤 + + Per user (by ID) + User-specific data + + + [Cache(typeof(Order), + Scope = CurrentUser)] + + + + AuthenticatedUser + + + 🔐 Auth + + + Anonymous + + Auth vs Anonymous + + + Scope = + AuthenticatedUser + + + + Entity + + + ID: 1 + + + ID: 2 + + + ID: 3 + + Per entity instance + By primary key + + + [Cache(typeof(Book), + Scope = Entity)] + + + + Common Use Cases + + + + Global Scope + ✓ Product catalog + ✓ Configuration settings + ✓ Public announcements + + + + CurrentUser Scope + ✓ User profile + ✓ Shopping cart + ✓ User's order history + + + + Auth Scope + ✓ Member-only content + ✓ Navigation menus + ✓ Feature availability + + + + Entity Scope + ✓ Book details by ID + ✓ Product info by SKU + ✓ Invoice by number + + + Cache Key Structure + + + + Global: + BookService:GetList:page1:size10 + + CurrentUser: + OrderService:GetMyOrders:user:12345 + + Auth: + MenuService:GetNav:auth:true + + Entity: + BookService:Get:entity:book-guid-123 + \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/post.md b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/post.md new file mode 100644 index 0000000000..50a4aba33e --- /dev/null +++ b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/post.md @@ -0,0 +1,797 @@ +# Implement Automatic Method-Level Caching in ABP Framework + +Caching is one of the most effective ways to improve application performance, but implementing it manually for every method can be tedious and error-prone. What if you could cache method results automatically with just an attribute? In this article, we'll explore how to build an automatic method-level caching system in ABP Framework that handles cache invalidation, supports multiple scopes, and integrates seamlessly with your existing application. + +By the end of this guide, you'll understand how to implement attribute-based caching that automatically invalidates when entities change, supports user-specific and global caching scopes, and provides built-in metrics for monitoring cache performance. + +> 💡 **Complete Implementation Available**: This article is based on a working demo project. You can find the complete implementation in the [AbpAutoCacheDemo repository](https://github.com/salihozkara/AbpAutoCacheDemo), with the core AutoCache library implementation available in [this commit](https://github.com/salihozkara/AbpAutoCacheDemo/commit/946df1fc07de6eddd26eb14013a09968cd59329b). + +## What is Automatic Method-Level Caching? + +Automatic method-level caching is a technique that intercepts method calls and caches their results without requiring manual cache management code. Instead of writing cache logic in every method, you simply decorate methods with attributes that define caching behavior. + +![Automatic Caching Flow](./images/automatic-caching-flow.svg) + +The key benefits include: + +- **Reduced Boilerplate:** No repetitive cache management code in your business logic +- **Consistent Caching Strategy:** Centralized cache configuration and behavior +- **Smart Invalidation:** Automatic cache clearing when related entities change +- **Multiple Scopes:** Support for global, user-specific, and entity-specific caching +- **Built-in Monitoring:** Track cache hits, misses, and performance metrics + +## Architecture Overview + +The automatic caching system consists of several key components working together: + +![Architecture Diagram](./images/architecture-diagram.svg) + +**Core Components:** + +1. **CacheAttribute:** The attribute you apply to methods to enable automatic caching +2. **AutoCacheInterceptor:** Intercepts method calls and handles cache operations +3. **AutoCacheManager:** Manages cache storage, retrieval, and key generation +4. **IAutoCacheKeyManager:** Handles cache key mapping and invalidation +5. **AutoCacheInvalidationHandler:** Listens to entity changes and clears related caches + +This architecture leverages ABP's dynamic proxy system and event bus to provide seamless caching without modifying your business logic. + +## Prerequisites + +Before implementing automatic caching, ensure you have: + +- ABP Framework 10.0 or later +## Implementation + +> 📦 **Repository Structure**: The complete implementation is available in the [AbpAutoCacheDemo repository](https://github.com/salihozkara/AbpAutoCacheDemo). The AutoCache library is located in the `src/AutoCache` folder, making it easy to extract and reuse in your own projects. + +### Step - 1: Create the AutoCache Module + +First, let's create a separate module for our caching infrastructure. This makes it reusable across projects. + +### Step - 1: Create the AutoCache Module + +First, let's create a separate module for our caching infrastructure. This makes it reusable across projects. + +Create `AutoCache.csproj`: + +```xml + + + net10.0 + enable + + + + + + + + +``` + +Create the module class `AutoCacheModule.cs`: + +```csharp +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.Domain; +using Volo.Abp.Modularity; + +namespace AutoCache; + +[DependsOn(typeof(AbpDddDomainModule), typeof(AbpCachingStackExchangeRedisModule))] +public class AutoCacheModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + context.Services.OnRegistered(AutoCacheRegister.RegisterInterceptorIfNeeded); // 👈 Register interceptor + } +} +``` + +This module automatically registers the cache interceptor for any class that uses the `CacheAttribute`. + +### Step - 2: Define the Cache Attribute + +The `CacheAttribute` is the core of our automatic caching system. It specifies which entities affect the cache and what scope to use. + +Create `CacheAttribute.cs`: + +```csharp +using System; +using Volo.Abp.Domain.Entities; + +namespace AutoCache; + +[AttributeUsage(AttributeTargets.Method)] +public class CacheAttribute : Attribute +{ + /// + /// Entity types that affect this cache. When these entities change, the cache will be invalidated. + /// + public Type[] InvalidateOnEntities { get; set; } + + /// + /// Scope of the cache (Global, CurrentUser, AuthenticatedUser, or Entity) + /// + public AutoCacheScope Scope { get; set; } = AutoCacheScope.Global; + + /// + /// Absolute expiration time relative to now in milliseconds (0 = use default, -1 = disabled) + /// + public long AbsoluteExpirationRelativeToNow { get; set; } + + /// + /// Sliding expiration time in milliseconds (0 = use default, -1 = disabled) + /// + public long SlidingExpiration { get; set; } + + public bool ConsiderUow { get; set; } + + public string AdditionalCacheKey { get; set; } + + public CacheAttribute(params Type[] invalidateOnEntities) // 👈 Specify entities that trigger cache invalidation + { + foreach (var entityType in invalidateOnEntities) + { + ArgumentNullException.ThrowIfNull(entityType); + if (!typeof(IEntity).IsAssignableFrom(entityType)) + { + throw new ArgumentException($"Type {entityType.FullName} must implement IEntity interface."); + } + } + InvalidateOnEntities = invalidateOnEntities; + } +} +``` + +**Key Properties:** + +- **InvalidateOnEntities:** Array of entity types that, when modified, will clear this cache +- **Scope:** Determines cache visibility (Global, CurrentUser, AuthenticatedUser, Entity) +- **AbsoluteExpirationRelativeToNow / SlidingExpiration:** Control cache lifetime + +### Step - 3: Define Cache Scopes + +Cache scopes determine how cache entries are partitioned. Create `AutoCacheScope.cs`: + +```csharp +using System; + +namespace AutoCache; + +[Flags] +public enum AutoCacheScope +{ + /// + /// Cache is shared globally across all users + /// + Global, + + /// + /// Cache is scoped to the current user (based on user ID) + /// + CurrentUser, + + /// + /// Cache is scoped to authenticated vs unauthenticated users + /// + AuthenticatedUser, + + /// + /// Cache is scoped to the primary key of the entity involved + /// + Entity +} +``` + +![Cache Scoping Strategy](./images/cache-scoping-diagram.svg) + +**When to Use Each Scope:** + +- **Global:** For data that's the same for all users (e.g., configuration, public lists) +- **CurrentUser:** For user-specific data (e.g., user profile, user's orders) +- **AuthenticatedUser:** For data that differs between authenticated and anonymous users +- **Entity:** For data tied to a specific entity instance (e.g., book details by ID) + +### Step - 4: Implement the Cache Interceptor + +The interceptor is the heart of automatic caching. It intercepts method calls, checks the cache, and stores results. Create `AutoCacheInterceptor.cs`: + +```csharp +using System; +using System.Collections.Concurrent; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Volo.Abp.DynamicProxy; + +namespace AutoCache; + +public class AutoCacheInterceptor : AbpInterceptor, ITransientDependency +{ + private readonly ILogger _logger; + private readonly AutoCacheOptions _options; + private static readonly MethodInfo GetOrAddCacheAsyncMethod; + private readonly AutoCacheManager _autoCacheManager; + private static readonly ConcurrentDictionary MethodCache = new(); + + static AutoCacheInterceptor() + { + GetOrAddCacheAsyncMethod = typeof(AutoCacheInterceptor).GetMethod( + nameof(GetOrAddCacheAsync), + BindingFlags.NonPublic | BindingFlags.Instance + )!; + } + + public AutoCacheInterceptor( + ILogger logger, + IOptions options, + AutoCacheManager autoCacheManager) + { + _logger = logger; + _autoCacheManager = autoCacheManager; + _options = options.Value; + } + + public override async Task InterceptAsync(IAbpMethodInvocation invocation) + { + // Check if caching is enabled and method has [Cache] attribute + if(!_options.Enabled || + invocation.Method.GetCustomAttributes(typeof(CacheAttribute), true).FirstOrDefault() + is not CacheAttribute attribute) + { + await invocation.ProceedAsync(); // 👈 No caching, proceed normally + return; + } + + var proceeded = false; + + try + { + // Create generic method based on return type + var genericMethod = MethodCache.GetOrAdd(invocation.Method.ReturnType, t => + { + var isGenericTask = t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Task<>); + var resultType = isGenericTask ? t.GetGenericArguments()[0] : t; + return GetOrAddCacheAsyncMethod.MakeGenericMethod(resultType); + }); + + // Execute cache logic + (var result, proceeded) = await (Task<(object, bool)>)genericMethod.Invoke(this, [invocation, attribute])!; + invocation.ReturnValue = result; // 👈 Set cached or fresh result + } + catch (Exception e) + { + _logger.LogError(e, "Error occurred while caching method {MethodName}", invocation.Method.Name); + + if(e is AutoCacheExceptionWrapper exceptionWrapper) + { + if (_options.ThrowOnError) + { + throw exceptionWrapper.OriginalException; + } + + _logger.LogWarning( + "Cache operation failed, falling back to method execution for {MethodName}", + invocation.Method.Name + ); + } + + if (!proceeded && invocation.ReturnValue == null) + { + await invocation.ProceedAsync(); // 👈 Fallback to actual method execution + } + } + } + + private async Task<(object?, bool)> GetOrAddCacheAsync( + IAbpMethodInvocation invocation, + CacheAttribute attribute) + { + var proceeded = false; + var result = await _autoCacheManager.GetOrAddAsync( + invocation.TargetObject, + Factory, + invocation.Arguments, + () => new DistributedCacheEntryOptions + { + AbsoluteExpirationRelativeToNow = GetExpiration( + attribute.AbsoluteExpirationRelativeToNow, + _options.DefaultAbsoluteExpirationRelativeToNow), + SlidingExpiration = GetExpiration( + attribute.SlidingExpiration, + _options.DefaultSlidingExpiration) + }, + attribute.InvalidateOnEntities, + attribute.Scope, + attribute.ConsiderUow, + attribute.AdditionalCacheKey, + invocation.Method.Name); + + return (result, proceeded); + + async Task Factory() + { + await invocation.ProceedAsync(); // 👈 Execute actual method on cache miss + proceeded = true; + return (TResult)invocation.ReturnValue; + } + } + + private static TimeSpan? GetExpiration(long milliseconds, long defaultValue) + { + return milliseconds switch + { + 0 => defaultValue > 0 ? TimeSpan.FromMilliseconds(defaultValue) : null, + < 0 => null, + _ => TimeSpan.FromMilliseconds(milliseconds) + }; + } +} +``` + +The interceptor intelligently determines whether to serve cached data or execute the actual method. + +### Step - 5: Implement the Cache Manager + +The `AutoCacheManager` handles the actual cache operations. Create a simplified version: + +```csharp +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Logging; +using Volo.Abp.DependencyInjection; +using Volo.Abp.DynamicProxy; +using Volo.Abp.Users; + +namespace AutoCache; + +public class AutoCacheManager : IScopedDependency +{ + private readonly IAutoCacheKeyManager _autoCacheKeyManager; + private readonly ICurrentUser _currentUser; + private readonly ILogger _logger; + private readonly IAutoCacheMetrics _metrics; + private readonly AutoCacheOptions _options; + + public AutoCacheManager( + IAutoCacheKeyManager autoCacheKeyManager, + ICurrentUser currentUser, + ILogger logger, + IAutoCacheMetrics metrics, + IOptions options) + { + _autoCacheKeyManager = autoCacheKeyManager; + _currentUser = currentUser; + _logger = logger; + _metrics = metrics; + _options = options.Value; + } + + public async Task GetOrAddAsync( + object? caller, + Func> func, + object?[]? parameters = null, + Func? optionsFactory = null, + Type[]? invalidateOnEntities = null, + AutoCacheScope scope = AutoCacheScope.Global, + bool considerUow = false, + string? additionalCacheKey = null, + [CallerMemberName] string methodName = "") + { + if (!_options.Enabled) + { + return await func(); // 👈 Caching disabled, execute directly + } + + var callerType = caller != null ? ProxyHelper.GetUnProxiedType(caller) : GetType(); + parameters ??= []; + + // Generate unique cache key based on method, parameters, and scope + var cacheKey = GenerateCacheKey( + callerType.Name, + additionalCacheKey, + methodName, + parameters, + scope); + + var (cachedResult, exception, wasHit) = await GetOrAddCacheAsync( + cacheKey, + func, + optionsFactory, + considerUow + ); + + // Record metrics + if (wasHit) + { + _metrics.RecordHit(cacheKey); + } + else + { + _metrics.RecordMiss(cacheKey); + } + + if (exception != null) + { + _metrics.RecordError(cacheKey, exception); + + if (_options.ThrowOnError) + { + throw exception; + } + } + + return cachedResult; + } + + private string GenerateCacheKey( + string callerTypeName, + string? additionalCacheKey, + string methodName, + object?[] parameters, + AutoCacheScope scope) + { + var keyBuilder = new StringBuilder(); + keyBuilder.Append($"{callerTypeName}:{methodName}"); + + // Add parameters to key + foreach (var param in parameters) + { + keyBuilder.Append($":{param}"); + } + + // Add scope-specific segments + if (scope.HasFlag(AutoCacheScope.CurrentUser) && _currentUser.Id.HasValue) + { + keyBuilder.Append($":user:{_currentUser.Id}"); // 👈 User-specific cache key + } + + if (scope.HasFlag(AutoCacheScope.AuthenticatedUser)) + { + keyBuilder.Append($":auth:{_currentUser.IsAuthenticated}"); + } + + if (!string.IsNullOrEmpty(additionalCacheKey)) + { + keyBuilder.Append($":{additionalCacheKey}"); + } + + return keyBuilder.ToString(); + } + + // Additional methods for cache retrieval and storage... +} +``` + +The manager generates unique cache keys based on method signatures, parameters, and scope settings. + +### Step - 6: Implement Cache Invalidation + +When entities change, related caches must be cleared. Create `AutoCacheInvalidationHandler.cs`: + +```csharp +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; + +namespace AutoCache; + +public class AutoCacheInvalidationHandler : + ILocalEventHandler> + where TEntity : class, IEntity +{ + private readonly IAutoCacheKeyManager _autoCacheKeyManager; + private readonly ILogger> _logger; + private readonly IUnitOfWorkManager _unitOfWorkManager; + + public AutoCacheInvalidationHandler( + IAutoCacheKeyManager autoCacheKeyManager, + ILogger> logger, + IUnitOfWorkManager unitOfWorkManager) + { + _autoCacheKeyManager = autoCacheKeyManager; + _logger = logger; + _unitOfWorkManager = unitOfWorkManager; + } + + public async Task HandleEventAsync(EntityChangedEventData eventData) + { + try + { + var entityType = typeof(TEntity); + var context = new RemoveCacheKeyContext + { + Keys = eventData.Entity.GetKeys()! + }; + + // Clear cache after unit of work completes + if(_unitOfWorkManager.Current != null) + { + _unitOfWorkManager.Current.OnCompleted(async () => + { + await _autoCacheKeyManager.RemoveCacheAndCacheKeys(entityType, context); // 👈 Invalidate cache + }); + } + else + { + await _autoCacheKeyManager.RemoveCacheAndCacheKeys(entityType, context); + } + } + catch (Exception e) + { + _logger.LogError( + e, + "Error occurred while clearing cache for entity type {EntityType}", + typeof(TEntity).FullName + ); + } + } +} +``` + +![Cache Invalidation Flow](./images/cache-invalidation-flow.svg) + +This handler listens to entity change events and automatically clears related caches. The invalidation happens after the unit of work completes to ensure data consistency. + +### Step - 7: Configure AutoCache in Your Application + +Add the `AutoCacheModule` to your application module dependencies: + +```csharp +[DependsOn( + typeof(AutoCacheModule), // 👈 Add AutoCache module + typeof(AbpCachingStackExchangeRedisModule), + // ... other modules +)] +public class YourApplicationModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Enabled = true; // 👈 Enable caching + options.DefaultAbsoluteExpirationRelativeToNow = 3600000; // 1 hour + options.DefaultSlidingExpiration = 600000; // 10 minutes + options.ThrowOnError = false; // Fallback to method execution on cache errors + }); + + // Configure Redis (if using distributed cache) + Configure(options => + { + options.KeyPrefix = "YourApp:"; + }); + } +} +``` + +### Step - 8: Use Automatic Caching in Application Services + +Now comes the easy part - using automatic caching! Simply add the `[Cache]` attribute to your methods: + +```csharp +using AutoCache; + +[Authorize(AutoCacheDemoPermissions.Books.Default)] +public class BookAppService : ApplicationService, IBookAppService +{ + private readonly IRepository _repository; + private readonly AutoCacheManager _autoCacheManager; + + public BookAppService(IRepository repository, AutoCacheManager autoCacheManager) + { + _repository = repository; + _autoCacheManager = autoCacheManager; + } + + // Cache this method, invalidate when Book entity changes + [Cache(typeof(Book), Scope = AutoCacheScope.Global)] + public virtual async Task GetAsync(Guid id) + { + // You can also use AutoCacheManager directly for nested caching + var book = await _autoCacheManager.GetOrAddAsync( + this, + async () => await _repository.GetAsync(id), + [id], // 👈 Method parameters + invalidateOnEntities: [typeof(Book)], + scope: AutoCacheScope.Entity); + + return ObjectMapper.Map(book!); + } + + // Cache book list, invalidate when any Book changes + [Cache(typeof(Book))] + public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) + { + var queryable = await _repository.GetQueryableAsync(); + var query = queryable + .OrderBy(input.Sorting.IsNullOrWhiteSpace() ? "Name" : input.Sorting) + .Skip(input.SkipCount) + .Take(input.MaxResultCount); + + var books = await AsyncExecuter.ToListAsync(query); + var totalCount = await AsyncExecuter.CountAsync(queryable); + + return new PagedResultDto( + totalCount, + ObjectMapper.Map, List>(books) + ); + } + + // No caching on write operations + [Authorize(AutoCacheDemoPermissions.Books.Create)] + public async Task CreateAsync(CreateUpdateBookDto input) + { + var book = ObjectMapper.Map(input); + await _repository.InsertAsync(book); // 👈 This will trigger cache invalidation + return ObjectMapper.Map(book); + } +} +``` + +**What Happens Here:** + +1. When `GetAsync` is called, the interceptor checks the cache +2. On cache miss, the actual method executes and the result is cached +3. When `CreateAsync` inserts a `Book`, the invalidation handler clears all caches related to `Book` +4. Next call to `GetAsync` will fetch fresh data + +## Advanced Features + +### User-Specific Caching + +For user-specific data, use `AutoCacheScope.CurrentUser`: + +```csharp +[Cache(typeof(Order), Scope = AutoCacheScope.CurrentUser)] +public virtual async Task> GetMyOrdersAsync() +{ + var orders = await _orderRepository.GetListAsync(x => x.UserId == CurrentUser.Id); + return ObjectMapper.Map, List>(orders); +} +``` + +Each user gets their own cache entry, automatically invalidated when their orders change. + +### Custom Cache Keys + +For fine-grained control, add custom cache key segments: + +```csharp +[Cache( + typeof(Product), + Scope = AutoCacheScope.Global, + AdditionalCacheKey = "featured" +)] +public virtual async Task> GetFeaturedProductsAsync() +{ + // Only featured products are cached separately + return await GetProductsByCategoryAsync("Featured"); +} +``` + +### Performance Metrics + +Monitor cache performance using `IAutoCacheMetrics`: + +```csharp +public class CacheMonitoringService : ITransientDependency +{ + private readonly IAutoCacheMetrics _metrics; + + public CacheMonitoringService(IAutoCacheMetrics metrics) + { + _metrics = metrics; + } + + public AutoCacheStatistics GetStatistics() + { + return _metrics.GetStatistics(); // 👈 Get hit rate, miss count, error count + } +} +``` + +## Testing the Application + +### 1. Run the Application + +```bash +abp new BookStore -u mvc -d ef +cd BookStore +dotnet run --project src/BookStore.Web +``` + +### 2. Test Cache Behavior + +Create a simple test to verify caching: + +```csharp +[Fact] +public async Task Should_Cache_Book_Results() +{ + // First call - cache miss + var book1 = await _bookAppService.GetAsync(testBookId); + + // Second call - cache hit (should be faster) + var book2 = await _bookAppService.GetAsync(testBookId); + + book1.Name.ShouldBe(book2.Name); +} + +[Fact] +public async Task Should_Invalidate_Cache_On_Update() +{ + // Cache the book + var book1 = await _bookAppService.GetAsync(testBookId); + + // Update the book + await _bookAppService.UpdateAsync(testBookId, new CreateUpdateBookDto + { + Name = "Updated Name" + }); + + // Fetch again - should get updated data (cache was invalidated) + var book2 = await _bookAppService.GetAsync(testBookId); + + book2.Name.ShouldBe("Updated Name"); +} +``` + +### 3. Monitor Cache Performance + +Check your application logs for cache metrics: + +``` +[INF] Cache Hit: BookAppService:GetAsync:book-id-123 (Response Time: 5ms) +[INF] Cache Miss: BookAppService:GetListAsync (Response Time: 156ms) +[INF] Cache Invalidation: Book entity changed, cleared 3 cache entries +``` + +## Key Takeaways + +✅ **Automatic caching reduces boilerplate code** - Just add `[Cache]` attribute to methods instead of manual cache management + +✅ **Smart invalidation keeps data fresh** - Entity changes automatically clear related caches without manual intervention + +✅ **Multiple scoping options** - Support for global, user-specific, authenticated, and entity-level caching strategies + +✅ **Built-in fallback handling** - Gracefully falls back to method execution if caching fails + +✅ **Performance monitoring** - Track cache hits, misses, and errors for optimization + +## Conclusion + +Automatic method-level caching dramatically simplifies performance optimization in ABP Framework applications. By using attributes and interceptors, you can add sophisticated caching behavior without cluttering your business logic with cache management code. + +The system we've built provides intelligent cache invalidation, multiple scoping strategies, and built-in monitoring - all while maintaining clean, readable code. Whether you're building a small application or an enterprise system, this approach scales elegantly and integrates seamlessly with ABP's architecture. + +Ready to implement this in your project? The complete working implementation is available in the [AbpAutoCacheDemo repository](https://github.com/salihozkara/AbpAutoCacheDemo). You can clone the repository, explore the code, and even extract the `src/AutoCache` folder to use it as a standalone library in your own ABP applications. The [main implementation commit](https://github.com/salihozkara/AbpAutoCacheDemo/commit/946df1fc07de6eddd26eb14013a09968cd59329b) shows all the components working together, including interceptor registration, cache key management, and automatic invalidation handlers.r you're building a small application or an enterprise system, this approach scales elegantly and integrates seamlessly with ABP's architecture. + +Ready to implement this in your project? Check out the complete working example in the repository linked below, and start improving your application's performance today! + +### See Also + +- [ABP Caching Documentation](https://abp.io/docs/latest/framework/fundamentals/caching) +- [Interceptors in ABP](https://abp.io/docs/latest/framework/infrastructure/interceptors) +- [Event Bus Documentation](https://abp.io/docs/latest/framework/infrastructure/event-bus) +- [Sample Project on GitHub](https://github.com/salihozkara/AbpAutoCacheDemo) + +--- + +## References + +- [ABP Framework Documentation](https://docs.abp.io) +- [Redis Distributed Caching](https://redis.io/docs/) +- [Aspect-Oriented Programming Patterns](https://en.wikipedia.org/wiki/Aspect-oriented_programming) diff --git a/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/summary.md b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/summary.md new file mode 100644 index 0000000000..a27494cd8a --- /dev/null +++ b/docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/summary.md @@ -0,0 +1 @@ +Learn how to implement automatic method-level caching in ABP Framework using attributes and interceptors. This comprehensive guide covers building a reusable cache infrastructure with attribute-based caching, intelligent cache invalidation when entities change, support for multiple cache scopes (Global, CurrentUser, AuthenticatedUser, and Entity), seamless integration with ABP's dynamic proxy system and event bus, and built-in performance metrics for monitoring cache effectiveness in production applications. diff --git a/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/cover.png b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/cover.png new file mode 100644 index 0000000000..69116d7961 Binary files /dev/null and b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/cover.png differ diff --git a/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/images/sitemap-architecture.svg b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/images/sitemap-architecture.svg new file mode 100644 index 0000000000..57721c4550 --- /dev/null +++ b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/images/sitemap-architecture.svg @@ -0,0 +1,122 @@ + + + + + + + + + + Sitemap Module Architecture + + + 1. Discovery Layer + + RazorPageDiscoveryService + + • Scans assemblies + • Finds PageModel classes + • Extracts route metadata + + + + + + 2. Source Layer + + + + IStaticPageSitemapSource + + Processes attributes: + [IncludeSitemapXml] + Returns static page + sitemap items + + + + IGroupedSitemapSource + + Queries repositories: + Books, Articles, Products + Returns dynamic + sitemap items + + + + Custom Sources + + Implement + ISitemapItemSource + for custom logic + + + + + + + + 3. Collection Layer + + SitemapItemCollector + + • Aggregates items from all sources + • Groups by category (Main, Blog, Products) + • Removes duplicates + • Returns Dictionary<Group, Items> + + + + + + 4. Generation Layer + + SitemapXmlGenerator + + • Converts items to XML format + • Adds <loc>, <lastmod>, <priority> + • Validates against sitemap protocol + • Returns XML string + + + + + + 5. Management Layer + + + + SitemapFileGenerator + + • Orchestrates collection + • Calls XML generator + • Writes files to disk: + Sitemaps/ + + + + SitemapRegenerationWorker + + • Runs periodically (e.g., hourly) + • Triggers SitemapFileGenerator + • Non-blocking background execution + + + + + + 📄 sitemap.xml + 📄 sitemap-Blog.xml + 📄 sitemap-Products.xml + + + + diff --git a/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/post.md b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/post.md new file mode 100644 index 0000000000..fd9d10756e --- /dev/null +++ b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/post.md @@ -0,0 +1,475 @@ +# Building Dynamic XML Sitemaps with ABP Framework + +Search Engine Optimization (SEO) is crucial for any web application that wants to be discovered by users. One of the most fundamental SEO practices is providing a comprehensive XML sitemap that helps search engines crawl and index your website efficiently. In this article, we'll use a reusable ABP module that automatically generates dynamic XML sitemaps for both static Razor Pages and dynamic content from your database. + +By the end of this tutorial, you'll have a production-ready sitemap solution that discovers your pages automatically, includes dynamic content like blog posts or products, and regenerates sitemaps in the background without impacting performance. + +## What is an XML Sitemap? + +An XML sitemap is a file that lists all important pages of your website in a structured format that search engines can easily read. It acts as a roadmap for crawlers like Google, Bing, and others, telling them which pages exist, when they were last updated, and how they relate to each other. + +For modern web applications with dynamic content, manually maintaining sitemap files quickly becomes impractical. A dynamic sitemap solution that automatically discovers and updates URLs is essential for: + +- **Large content sites** with frequently changing blog posts, articles, or products +- **Multi-tenant applications** where each tenant may have different content +- **Enterprise applications** with complex page hierarchies +- **E-commerce platforms** with thousands of product pages + +## Why Build a Custom Sitemap Module? + +While there are general-purpose sitemap libraries available, building a custom module for ABP Framework provides several advantages: + +✅ **Deep ABP Integration**: Leverages ABP's dependency injection, background workers, and module system +✅ **Automatic Discovery**: Uses ASP.NET Core's Razor Page infrastructure to automatically find pages +✅ **Type-Safe Configuration**: Strongly-typed attributes and options for configuration +✅ **Multi-Group Support**: Organize sitemaps by logical groups (main, blog, products, etc.) +✅ **Background Generation**: Non-blocking sitemap regeneration using ABP's background worker system +✅ **Repository Integration**: Direct integration with ABP repositories for database entities + +## Project Architecture Overview + +Before using the module, let's understand its architecture: + +![Architecture Diagram](./images/sitemap-architecture.svg) + +The sitemap module consists of several key components: + +1. **Discovery Layer**: Discovers Razor Pages and their metadata using reflection +2. **Source Layer**: Defines contracts for providing sitemap items (static pages and dynamic content) +3. **Collection Layer**: Collects items from all registered sources +4. **Generation Layer**: Transforms collected items into XML format +5. **Management Layer**: Orchestrates file generation and background workers + +## Installation + +To get started, clone the demo repository which includes the sitemap module: + +```bash +git clone https://github.com/salihozkara/AbpSitemapDemo +cd AbpSitemapDemo +``` + +The repository contains the sitemap module in the `Modules/abp.sitemap/` directory. To use it in your own project, add a project reference: + +```xml + +``` + +## Module Configuration + +After installing the package, add the module to your ABP application's module class: + +```csharp +using Abp.Sitemap.Web; + +[DependsOn( + typeof(SitemapWebModule), // 👈 Add sitemap module + // ... other dependencies +)] +public class YourProjectWebModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + // Configure sitemap options + Configure(options => + { + options.BaseUrl = "https://yourdomain.com"; // 👈 Your website URL + options.FolderPath = "Sitemaps"; // 👈 Where XML files are stored + options.WorkerPeriod = 3600000; // 👈 Regenerate every hour (in milliseconds) + }); + } +} +``` + +> **Note:** In ABP applications, BaseUrl can be resolved from AppUrlOptions to stay consistent with environment configuration. + +That's it! The module is now integrated and will automatically: +- Discover your Razor Pages +- Generate sitemap XML files on application startup +- Regenerate sitemaps in the background every hour + +## Usage Examples + +Let's explore practical examples of using the sitemap module. You can see complete working examples in the [AbpSitemapDemo repository](https://github.com/salihozkara/AbpSitemapDemo). + +### Example 1: Mark Static Pages + +The simplest way to include pages in your sitemap is using attributes: + +```csharp +using Abp.Sitemap.Web.Sitemap.Sources.Page.Attributes; + +namespace YourProject.Pages; + +[IncludeSitemapXml] // 👈 Include in default "Main" group +public class IndexModel : PageModel +{ + public void OnGet() + { + // Your page logic + } +} + +[IncludeSitemapXml(Group = "Help")] +public class FaqModel : PageModel +{ + public void OnGet() + { + // Your page logic + } +} +``` + +These pages will be automatically discovered and included in the sitemap XML files. + +### Example 2: Add Dynamic Content from Database + +For dynamic content like blog posts, products, or articles, create a custom sitemap source. Here's a complete example using a Book entity: + +```csharp +using Abp.Sitemap.Web.Sitemap.Core; +using Abp.Sitemap.Web.Sitemap.Sources.Group; +using Volo.Abp.DependencyInjection; + +namespace YourProject.Sitemaps; + +public class BookSitemapSource : GroupedSitemapItemSource, ITransientDependency +{ + public BookSitemapSource( + IReadOnlyRepository repository, + IAsyncQueryableExecuter executer) + : base(repository, executer, group: "Books") // 👈 Creates sitemap-Books.xml + { + Filter = x => x.IsPublished; // 👈 Only published books + } + + protected override Expression> Selector => + book => new SitemapItem( + book.Id.ToString(), // 👈 Unique identifier + $"/Books/Detail/{book.Id}", // 👈 URL pattern matching your route + book.LastModificationTime ?? book.CreationTime // 👈 Last modified date + ) + { + ChangeFrequency = "weekly", + Priority = 0.7 + }; +} +``` + +Key points: +- Inherits from `GroupedSitemapItemSource` +- Specifies the entity type (`Book`) +- Defines a group name ("Books") which creates `sitemap-Books.xml` +- Uses `Filter` to include only published books +- Maps entity properties to sitemap URLs using `Selector` +- Automatically registered via `ITransientDependency` + +### Example 3: Category-Based Dynamic Content + +For content with categories, you can build more complex URL patterns: + +```csharp +using Abp.Sitemap.Web.Sitemap.Core; +using Abp.Sitemap.Web.Sitemap.Sources.Group; + +namespace YourProject.Sitemaps; + +public class ArticleSitemapSource : GroupedSitemapItemSource
, ITransientDependency +{ + public ArticleSitemapSource( + IReadOnlyRepository
repository, + IAsyncQueryableExecuter executer) + : base(repository, executer, "Articles") + { + // Multiple filter conditions + Filter = x => x.IsPublished && + !x.IsDeleted && + x.PublishDate <= DateTime.Now; + } + + protected override Expression> Selector => + article => new SitemapItem( + article.Id.ToString(), + $"/blog/{article.Category.Slug}/{article.Slug}", // 👈 Category-based URL + article.LastModificationTime ?? article.CreationTime + ); +} +``` + +This example demonstrates: +- Multiple filter conditions for complex business logic +- Building URLs with category slugs + +## Testing Your Sitemaps + +After configuring the module, test your sitemap generation: + +### 1. Run Your Application + +```bash +dotnet run +``` + +The sitemaps are automatically generated on application startup. + +### 2. Check Generated Files + +Navigate to `{WebProject}/Sitemaps/` directory (at the root of your web project): + +``` +{WebProject} +└── Sitemaps/ + ├── sitemap.xml # Main group (static pages) + ├── sitemap-Books.xml # Books from database + ├── sitemap-Articles.xml # Articles from database + └── sitemap-Help.xml # Help pages +``` + +### 3. Verify XML Content + +Open `sitemap-Books.xml` and verify the structure: + +```xml + + + + https://yourdomain.com/Books/Detail/3a071e39-12c9-48d7-8c1e-3b4f5c6d7e8f + 2025-12-13 + + + https://yourdomain.com/Books/Detail/7b8c9d0e-1f2a-3b4c-5d6e-7f8g9h0i1j2k + 2025-12-10 + + +``` + +### 4. Test in Browser + +Visit the sitemap URLs directly (the module serves them from the root path): +- Main sitemap: `https://localhost:5001/sitemap.xml` +- Books sitemap: `https://localhost:5001/sitemap-Books.xml` + +> **Note:** The sitemaps are stored in `{WebProject}/Sitemaps/` directory and served directly from the root URL. + +## Advanced Configuration + +### Custom Regeneration Schedule + +Control when sitemaps are regenerated using cron expressions: + +```csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + Configure(options => + { + options.BaseUrl = "https://yourdomain.com"; + options.WorkerCronExpression = "0 0 2 * * ?"; // 👈 Every day at 2 AM + // Or use period in milliseconds: + // options.WorkerPeriod = 7200000; // 2 hours + }); +} +``` + +### Environment-Specific Configuration + +Use different settings for development and production: + +```csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + var configuration = context.Services.GetConfiguration(); + var hostingEnvironment = context.Services.GetHostingEnvironment(); + + Configure(options => + { + if (hostingEnvironment.IsDevelopment()) + { + options.BaseUrl = "https://localhost:5001"; + options.WorkerPeriod = 300000; // 5 minutes for testing + } + else + { + options.BaseUrl = configuration["App:SelfUrl"]!; + options.WorkerPeriod = 3600000; // 1 hour in production + } + + options.FolderPath = "Sitemaps"; + }); +} +``` + +### Manual Sitemap Generation + +Trigger sitemap generation manually (useful for admin panels): + +```csharp +using Abp.Sitemap.Web.Sitemap.Management; + +public class SitemapManagementService : ITransientDependency +{ + private readonly SitemapFileGenerator _generator; + + public SitemapManagementService(SitemapFileGenerator generator) + { + _generator = generator; + } + + [Authorize("Admin")] + public async Task RegenerateSitemapsAsync() + { + await _generator.GenerateAsync(); // 👈 Manual regeneration + } +} +``` + +## Real-World Use Cases + +Here are practical scenarios where the sitemap module excels: + +### E-Commerce Platform +```csharp +// Products grouped by category +public class ProductSitemapSource : GroupedSitemapItemSource +{ + // Automatically includes all active products with stock +} + +// Separate sitemap for categories +public class CategorySitemapSource : GroupedSitemapItemSource +{ + // All browsable categories +} + +// Brand pages +public class BrandSitemapSource : GroupedSitemapItemSource +{ + // All active brands +} +``` + +Result: `sitemap-Products.xml`, `sitemap-Categories.xml`, `sitemap-Brands.xml` + +### Content Management System +```csharp +// Blog posts by date +public class BlogPostSitemapSource : GroupedSitemapItemSource +{ + // Filter by published date, priority based on view count +} + +// Static CMS pages +[IncludeSitemapXml] +public class AboutUsModel : PageModel { } +``` + +## Best Practices + +### 1. Group Related Content +Organize your sitemaps logically: +```csharp +// ✅ Good: Logical grouping +"Products", "Categories", "Brands", "Blog", "Help" + +// ❌ Bad: Everything in one group +"Main" // Contains 50,000 mixed URLs +``` + +### 2. Use Filters Wisely +```csharp +// ✅ Good: Only published, non-deleted content +Filter = x => x.IsPublished && + !x.IsDeleted && + x.PublishDate <= DateTime.Now + +// ❌ Bad: Including draft content +Filter = x => true // Everything included +``` + +### 3. Keep URLs Clean +```csharp +// ✅ Good: SEO-friendly URLs +$"/products/{product.Slug}" +$"/blog/{year}/{month}/{article.Slug}" + +// ❌ Bad: Technical IDs exposed +$"/product-detail?id={product.Id}" +``` + +## Troubleshooting + +### Sitemap Not Generated +**Problem:** No XML files in `{WebProject}/Sitemaps/` + +**Solutions:** +1. Check module is added to dependencies +2. Verify `SitemapOptions.BaseUrl` is configured +3. Check application logs for errors +4. Ensure the web project directory has write permissions + +### Pages Not Appearing +**Problem:** Some pages missing from sitemap + +**Solutions:** +1. Verify `[IncludeSitemapXml]` attribute is present +2. Check namespace imports: `using Abp.Sitemap.Web.Sitemap.Sources.Page.Attributes;` +3. Ensure PageModel classes are public +4. Check filter conditions in custom sources + +### Background Worker Not Running +**Problem:** Sitemaps not regenerating automatically + +**Solutions:** +1. Check `SitemapOptions.WorkerPeriod` is set +2. Verify background workers are enabled in ABP configuration +3. Check application logs for worker errors + +## Performance Considerations + +### Caching Strategy +Consider adding caching for frequently accessed sitemaps: + +```csharp +public class CachedSitemapFileGenerator : ITransientDependency +{ + private readonly SitemapFileGenerator _generator; + private readonly IDistributedCache _cache; + + public async Task GetOrGenerateAsync(string group) + { + var cacheKey = $"Sitemap:{group}"; + var cached = await _cache.GetStringAsync(cacheKey); + + if (cached != null) + return cached; + + await _generator.GenerateAsync(); + // Read and cache... + } +} +``` + +## Conclusion + +The ABP Sitemap module provides a production-ready solution for dynamic sitemap generation in ABP Framework applications. By leveraging ABP's architecture—dependency injection, repository pattern, and background workers—the module automatically discovers pages, includes dynamic content, and regenerates sitemaps without manual intervention. + +Key benefits: +✅ **Zero Configuration** for basic scenarios +✅ **Type-Safe** attribute-based configuration +✅ **Extensible** for complex business logic +✅ **Performance** optimized with background processing +✅ **SEO-Friendly** following XML sitemap standards + +Whether you're building a blog, e-commerce platform, or enterprise application, this module provides a solid foundation for search engine optimization. + +## Additional Resources + +### Documentation +- [ABP Framework Documentation](https://abp.io/docs/latest/) +- [ABP Background Workers](https://abp.io/docs/latest/framework/infrastructure/background-workers) +- [ABP Repository Pattern](https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories) +- [ABP Dependency Injection](https://abp.io/docs/latest/framework/fundamentals/dependency-injection) + +### Source Code +- [Complete Working Demo](https://github.com/salihozkara/AbpSitemapDemo) - Full implementation with examples + - [BookSitemapSource](https://github.com/salihozkara/AbpSitemapDemo/blob/master/AbpSitemapDemo/Pages/Books/Index.cshtml.cs#L23) - Entity-based source example + - [Index.cshtml](https://github.com/salihozkara/AbpSitemapDemo/blob/master/AbpSitemapDemo/Pages/Index.cshtml#L9) - Page attribute usage diff --git a/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/summary.md b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/summary.md new file mode 100644 index 0000000000..0c20291c95 --- /dev/null +++ b/docs/en/Community-Articles/2025-12-13-Building-Dynamic-XML-Sitemaps-With-ABP-Framework/summary.md @@ -0,0 +1 @@ +Learn how to use the ABP Sitemap module for automatic XML sitemap generation in your ABP Framework applications. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/cover.png b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/cover.png new file mode 100644 index 0000000000..3739cbb97a Binary files /dev/null and b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/cover.png differ diff --git a/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/abp-studio-ai-management.png b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/abp-studio-ai-management.png new file mode 100644 index 0000000000..5577fb0b33 Binary files /dev/null and b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/abp-studio-ai-management.png differ diff --git a/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/ai-management-workspace-playground.png b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/ai-management-workspace-playground.png new file mode 100644 index 0000000000..7051772489 Binary files /dev/null and b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/ai-management-workspace-playground.png differ diff --git a/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/ai-management-workspace-widget.png b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/ai-management-workspace-widget.png new file mode 100644 index 0000000000..bb3a75d8cd Binary files /dev/null and b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/ai-management-workspace-widget.png differ diff --git a/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/aimanagement-workspace-geminiasopenai.png b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/aimanagement-workspace-geminiasopenai.png new file mode 100644 index 0000000000..a221b3ed7d Binary files /dev/null and b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/images/aimanagement-workspace-geminiasopenai.png differ diff --git a/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/post.md b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/post.md new file mode 100644 index 0000000000..80c4a8fbeb --- /dev/null +++ b/docs/en/Community-Articles/2025-12-18-Announcement-AIMAnagement/post.md @@ -0,0 +1,106 @@ +# Introducing the AI Management Module: Manage AI Integration Dynamically + +We are excited to announce the **AI Management Module**, a powerful new module to the ABP Platform that makes managing AI capabilities in your applications easier. No need to redeploy your application, now you can configure, test, and manage your AI integrations on the fly through an intuitive user interface! + +## What is the AI Management Module? + +Built on top of the [ABP Framework's AI infrastructure](https://abp.io/docs/latest/framework/infrastructure/artificial-intelligence), the AI Management Module allows you to manage AI workspaces dynamically without touching your code. Whether you're building a customer support chatbot, adding AI-powered search, or creating intelligent automation workflows, this module provides everything you need to manage AI integrations through a user-friendly interface. + +> **Note**: The AI Management Module is currently in **preview** and available to ABP Team or higher license holders. + +## What it offers? + +### Manage AI Without Redeployment + +Create, configure, and update AI workspaces directly from the UI. Switch between different AI providers (OpenAI, Azure OpenAI, Ollama, etc.), change models, adjust prompts, and test configurations, all without restarting your application or deploying new code. + +### Built-In Chat Interface + +Test your AI workspaces immediately with the included chat interface in playground pages. Verify your configurations work correctly before using them in production. Perfect for experimenting with different models, prompts, and settings. + + ![AI Management Playground](./images/ai-management-workspace-playground.png) + +### Flexible for Any Architecture + +Whether you're building a monolith, microservices, or something in between, the module adapts to your needs: +- Host AI management directly in your application with full UI and database +- Deploy a centralized AI service that multiple applications can consume +- Use it as an API gateway pattern for your microservices + +### Works with Any AI Provider + +Even AI Management module doesn't implement all the providers by default, it provides extensibility options with a good abstraction for other providers like Azure, Anthropic Claude, Google Gemini, and more. Or you can directly use the OpenAI adapter with LLMs that support OpenAI API. + +- Example of using Gemini as an OpenAI provider: + + ![Using Gemini as an OpenAI provider](./images/aimanagement-workspace-geminiasopenai.png) + + +You can even add your own custom AI providers: [learn how to implement a custom AI provider factory in the documentation](https://abp.io/docs/latest/modules/ai-management#implementing-custom-ai-provider-factories). + +### Ready to Use Chat Widget + +Drop a compact, pre-built chat widget into any page with minimal code. It includes streaming support, conversation history, and API integration for customization. + +- Simple to use with minimal code + ```cs + @await Component.InvokeAsync(typeof(ChatClientChatViewComponent), new ChatClientChatViewModel + { + WorkspaceName = "StoryTeller", + }) + ``` + +- And result is a working, pre-integrated widget + + ![AI Management Chat Widget](./images/ai-management-workspace-widget.png) + +- [See the widget documentation](https://abp.io/docs/latest/modules/ai-management#client-usage-mvc-ui) for details and all parameters for customization. + +### Security + +Control who can manage and use AI workspaces with permission-based access control. Isolate your AI configurations by using workspaces with different permissions. Also, resource based authorization on workspaces is on the way and will be available in the next versions. It'll allow you to manage access to specific workspaces by a user or role. + +## Getting Started + +Installation is straightforward using the [ABP Studio](https://abp.io/studio). You can just enable **AI Management** module while creating a new project with ABP Studio and configure your preferred AI provider and model in the solution creation wizard. + +![ABP Studio AI Management Solution Creation Wizard](./images/abp-studio-ai-management.png) + +## Roadmap + +### v10.0 ✅ +- Workspace Management +- MVC UI +- Playground + - Chat History _(Client-Side)_ +- Client Components +- Integration to Startup Templates + +### v10.1 +- Blazor UI +- Angular UI +- Resource based authorization on Workspaces +- Agent-Framework compatibility examples + +### Future Goals +- Microservice templates +- MCP Support +- RAG with file upload _(md, pdf, txt)_ +- Chat History _(Server-Side Conversations)_ +- OpenAI Compatible Endpoints +- Tenant-Based Configuration +- Extended RAG capabilities, _(ie. providing application data as tools)_ + + +## Ready to Get Started? + +The AI Management Module is available now for ABP Team and higher license holders. + +**Learn More:** +- [AI Management Module Documentation](https://abp.io/docs/latest/modules/ai-management) - All features, scenarios, and technical details. +- [AI Infrastructure Documentation](https://abp.io/docs/latest/framework/infrastructure/artificial-intelligence) - Understanding AI workspaces in the framework. +- [Usage Scenarios](https://abp.io/docs/latest/modules/ai-management#usage-scenarios) - Examples for different architectures. + +--- + +*The AI Management Module is currently in preview. We're excited to hear your feedback as we continue to improve and add new features!* \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-12-23-Referral-Program-Announcement/post.md b/docs/en/Community-Articles/2025-12-23-Referral-Program-Announcement/post.md new file mode 100644 index 0000000000..77621a1be2 --- /dev/null +++ b/docs/en/Community-Articles/2025-12-23-Referral-Program-Announcement/post.md @@ -0,0 +1,38 @@ +We are happy to share some exciting news. We launched **ABP.IO Referral Program** as a way to thank our customers and community members who help introduce ABP.IO to new professionals and organizations\! + +If you already use ABP.IO and believe in it, you can now get benefits by recommending it to others. + +## **What is ABP.IO Referral Program?** +Referral_Program_-3 + +ABP.IO Referral Program rewards people who bring new customers to ABP.IO. + +When someone you refer purchases an ABP.IO license, you earn a commission as a thank-you for your contribution. + +*\*This referral program is available to users who have an organization.* + +## **What Benefits Do You Get?** + +* Earn **5% commission** on the total sales price of each new license you refer + +* Get rewarded for sharing a platform you already know and trust + +## **Who Can Join?** + +You can participate if: + +* You are an existing ABP.IO customer who has purchased a license before + +* You are a license owner or a developer + +* Your license is active or expired + +* The purchase is not made by your own company + +## **Start Referring Today** + +If you are interested in joining the program, you can get started right away. + +👉 [**Start Referring Now**](https://abp.io/my-referrals) + +Thank you for being part of our community. Your support helps us grow and now it pays back. diff --git a/docs/en/cli/new-command-samples.md b/docs/en/cli/new-command-samples.md index 7c26e724a4..60c53ed5f6 100644 --- a/docs/en/cli/new-command-samples.md +++ b/docs/en/cli/new-command-samples.md @@ -171,7 +171,7 @@ It's a template of a basic .NET console application with ABP module architecture * This project consists of the following files: `Acme.BookStore.csproj`, `appsettings.json`, `BookStoreHostedService.cs`, `BookStoreModule.cs`, `HelloWorldService.cs` and `Program.cs`. ```bash - abp new Acme.BookStore -t console -csf + abp new Acme.BookStore -t console -csf --old ``` ## Module diff --git a/docs/en/contribution/angular-ui.md b/docs/en/contribution/angular-ui.md index 6aefa43fa8..e3445b12bd 100644 --- a/docs/en/contribution/angular-ui.md +++ b/docs/en/contribution/angular-ui.md @@ -12,7 +12,7 @@ - Dotnet core SDK https://dotnet.microsoft.com/en-us/download - Nodejs LTS https://nodejs.org/en/ - Docker https://docs.docker.com/engine/install -- Angular CLI. https://angular.io/guide/what-is-angular#angular-cli +- Angular CLI. https://angular.dev/tools/cli - Abp CLI https://docs.abp.io/en/abp/latest/cli - A code editor diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index b59620e72b..1cce28fa3f 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -593,6 +593,10 @@ { "text": "Quartz Integration", "path": "framework/infrastructure/background-jobs/quartz.md" + }, + { + "text": "TickerQ Integration", + "path": "framework/infrastructure/background-jobs/tickerq.md" } ] }, @@ -611,6 +615,10 @@ { "text": "Hangfire Integration", "path": "framework/infrastructure/background-workers/hangfire.md" + }, + { + "text": "TickerQ Integration", + "path": "framework/infrastructure/background-workers/tickerq.md" } ] }, @@ -1557,6 +1565,10 @@ "text": "SSR Configuration", "path": "framework/ui/angular/ssr-configuration.md" }, + { + "text": "AI Tools Configuration", + "path": "framework/ui/angular/ai-config.md" + }, { "text": "PWA Configuration", "path": "framework/ui/angular/pwa-configuration.md" @@ -1641,7 +1653,7 @@ "path": "framework/ui/angular/list-service.md" }, { - "text": "Easy *ngFor trackBy", + "text": "Easy @for() track", "path": "framework/ui/angular/track-by-service.md" }, { @@ -2359,13 +2371,17 @@ "path": "modules/account-pro.md", "isIndex": true }, + { + "text": "Idle Session Timeout", + "path": "modules/account/idle-session-timeout.md" + }, { "text": "Tenant impersonation & User impersonation", "path": "modules/account/impersonation.md" }, { - "text": "Idle Session Timeout", - "path": "modules/account/idle-session-timeout.md" + "text": "Web Authentication API (WebAuthn) passkeys", + "path": "modules/account/passkey.md" } ] }, diff --git a/docs/en/framework/infrastructure/artificial-intelligence/index.md b/docs/en/framework/infrastructure/artificial-intelligence/index.md index 004801d0c4..ddf9ad4b07 100644 --- a/docs/en/framework/infrastructure/artificial-intelligence/index.md +++ b/docs/en/framework/infrastructure/artificial-intelligence/index.md @@ -1,3 +1,10 @@ +```json +//[doc-seo] +{ + "Description": "Explore ABP Framework's AI integration, enabling seamless AI capabilities, workspace management, and reusable modules for .NET developers." +} +``` + # Artificial Intelligence (AI) ABP Framework provides integration for AI capabilities to your application by using Microsoft's popular AI libraries. The main purpose of this integration is to provide a consistent and easy way to use AI capabilities and manage different AI providers, models and configurations in a single application. diff --git a/docs/en/framework/infrastructure/background-jobs/index.md b/docs/en/framework/infrastructure/background-jobs/index.md index 286b09d569..0d5e19442c 100644 --- a/docs/en/framework/infrastructure/background-jobs/index.md +++ b/docs/en/framework/infrastructure/background-jobs/index.md @@ -355,6 +355,7 @@ See pre-built job manager alternatives: * [Hangfire Background Job Manager](./hangfire.md) * [RabbitMQ Background Job Manager](./rabbitmq.md) * [Quartz Background Job Manager](./quartz.md) +* [TickerQ Background Job Manager](./tickerq.md) ## See Also * [Background Workers](../background-workers) \ No newline at end of file diff --git a/docs/en/framework/infrastructure/background-jobs/tickerq.md b/docs/en/framework/infrastructure/background-jobs/tickerq.md new file mode 100644 index 0000000000..013a8fde74 --- /dev/null +++ b/docs/en/framework/infrastructure/background-jobs/tickerq.md @@ -0,0 +1,125 @@ +# TickerQ Background Job Manager + +[TickerQ](https://tickerq.net/) is a fast, reflection-free background task scheduler for .NET — built with source generators, EF Core integration, cron + time-based execution, and a real-time dashboard. You can integrate TickerQ with the ABP to use it instead of the [default background job manager](../background-jobs). In this way, you can use the same background job API for TickerQ and your code will be independent of TickerQ. If you like, you can directly use TickerQ's API, too. + +> See the [background jobs document](../background-jobs) to learn how to use the background job system. This document only shows how to install and configure the TickerQ integration. + +## Installation + +It is suggested to use the [ABP CLI](../../../cli) to install this package. + +### Using the ABP CLI + +Open a command line window in the folder of the project (.csproj file) and type the following command: + +````bash +abp add-package Volo.Abp.BackgroundJobs.TickerQ +```` + +> If you haven't done it yet, you first need to install the [ABP CLI](../../../cli). For other installation options, see [the package description page](https://abp.io/package-detail/Volo.Abp.BackgroundJobs.TickerQ). + +## Configuration + +### AddTickerQ + +You can call the `AddTickerQ` extension method in the `ConfigureServices` method of your module to configure TickerQ services: + +> This is optional. ABP will automatically register TickerQ services. + +```csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.AddTickerQ(x => + { + // Configure TickerQ options here + }); +} +``` + +### UseAbpTickerQ + +You need to call the `UseAbpTickerQ` extension method instead of `AddTickerQ` in the `OnApplicationInitialization` method of your module: + +```csharp +// (default: TickerQStartMode.Immediate) +app.UseAbpTickerQ(startMode: ...); +``` + +### AbpBackgroundJobsTickerQOptions + +You can configure the `TimeTicker` properties for specific jobs. For example, you can change `Priority`, `Retries` and `RetryIntervals` properties as shown below: + +```csharp +Configure(options => +{ + options.AddJobConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min + Priority = TickerTaskPriority.High + + // Optional batching + //BatchParent = Guid.Parse("...."), + //BatchRunCondition = BatchRunCondition.OnSuccess + }); + + options.AddJobConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 5, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min + Priority = TickerTaskPriority.Normal + }); +}); +``` + +### Add your own TickerQ Background Jobs Definitions + +ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs. + +For example, you can add a `CleanupJobs` job definition in the `OnPreApplicationInitializationAsync` method of your module: + +```csharp +public class CleanupJobs +{ + public async Task CleanupLogsAsync(TickerFunctionContext tickerContext, CancellationToken cancellationToken) + { + var logFileName = tickerContext.Request; + Console.WriteLine($"Cleaning up log file: {logFileName} at {DateTime.Now}"); + } +} +``` + +```csharp +public override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context) +{ + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => + { + var service = new CleanupJobs(); // Or get it from the serviceProvider + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); + }))); + abpTickerQFunctionProvider.RequestTypes.TryAdd(nameof(CleanupJobs), (typeof(string).FullName, typeof(string))); + return Task.CompletedTask; +} +``` + +And then you can add a job by using the `ITimeTickerManager`: + +```csharp +var timeTickerManager = context.ServiceProvider.GetRequiredService>(); +await timeTickerManager.AddAsync(new TimeTicker +{ + Function = nameof(CleanupJobs), + ExecutionTime = DateTime.UtcNow.AddSeconds(5), + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 3, + RetryIntervals = new[] { 30, 60, 120 }, // Retry after 30s, 60s, then 2min +}); +``` + +### TickerQ Dashboard and EF Core Integration + +You can install the [TickerQ dashboard](https://tickerq.net/setup/dashboard.html) and [Entity Framework Core](https://tickerq.net/setup/tickerq-ef-core.html) integration by its documentation. There is no specific configuration needed for the ABP integration. + diff --git a/docs/en/framework/infrastructure/background-workers/index.md b/docs/en/framework/infrastructure/background-workers/index.md index f6fe5fbb70..6204857d8c 100644 --- a/docs/en/framework/infrastructure/background-workers/index.md +++ b/docs/en/framework/infrastructure/background-workers/index.md @@ -48,7 +48,7 @@ Start your worker in the `StartAsync` (which is called when the application begi Assume that we want to make a user passive, if the user has not logged in to the application in last 30 days. `AsyncPeriodicBackgroundWorkerBase` class simplifies to create periodic workers, so we will use it for the example below: -> You can use `CronExpression` property to set the cron expression for the background worker if you will use the [Hangfire Background Worker Manager](./hangfire.md) or [Quartz Background Worker Manager](./quartz.md). +> You can use `CronExpression` property to set the cron expression for the background worker if you will use the [Hangfire Background Worker Manager](./hangfire.md), [Quartz Background Worker Manager](./quartz.md), or [TickerQ Background Worker Manager](./tickerq.md). ````csharp public class PassiveUserCheckerWorker : AsyncPeriodicBackgroundWorkerBase @@ -223,7 +223,8 @@ Background worker system is extensible and you can change the default background See pre-built worker manager alternatives: * [Quartz Background Worker Manager](./quartz.md) -* [Hangfire Background Worker Manager](./hangfire.md) +* [Hangfire Background Worker Manager](./hangfire.md) +* [TickerQ Background Worker Manager](./tickerq.md) ## See Also diff --git a/docs/en/framework/infrastructure/background-workers/tickerq.md b/docs/en/framework/infrastructure/background-workers/tickerq.md new file mode 100644 index 0000000000..840b5137cb --- /dev/null +++ b/docs/en/framework/infrastructure/background-workers/tickerq.md @@ -0,0 +1,119 @@ +# TickerQ Background Worker Manager + +[TickerQ](https://tickerq.net/) is a fast, reflection-free background task scheduler for .NET — built with source generators, EF Core integration, cron + time-based execution, and a real-time dashboard. You can integrate TickerQ with the ABP to use it instead of the [default background worker manager](../background-workers). + +## Installation + +It is suggested to use the [ABP CLI](../../../cli) to install this package. + +### Using the ABP CLI + +Open a command line window in the folder of the project (.csproj file) and type the following command: + +````bash +abp add-package Volo.Abp.BackgroundWorkers.TickerQ +```` + +> If you haven't done it yet, you first need to install the [ABP CLI](../../../cli). For other installation options, see [the package description page](https://abp.io/package-detail/Volo.Abp.BackgroundWorkers.TickerQ). + +## Configuration + +### AddTickerQ + +You can call the `AddTickerQ` extension method in the `ConfigureServices` method of your module to configure TickerQ services: + +> This is optional. ABP will automatically register TickerQ services. + +```csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.AddTickerQ(x => + { + // Configure TickerQ options here + }); +} +``` + +### UseAbpTickerQ + +You need to call the `UseAbpTickerQ` extension method instead of `AddTickerQ` in the `OnApplicationInitialization` method of your module: + +```csharp +// (default: TickerQStartMode.Immediate) +app.UseAbpTickerQ(startMode: ...); +``` + +### AbpBackgroundWorkersTickerQOptions + +You can configure the `CronTicker` properties for specific jobs. For example, Change `Priority`, `Retries` and `RetryIntervals` properties: + +```csharp +Configure(options => +{ + options.AddConfiguration(new AbpBackgroundWorkersCronTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min, + Priority = TickerTaskPriority.High + }); +}); +``` + +### Add your own TickerQ Background Worker Definitions + +ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs. + +For example, you can add a `CleanupJobs` job definition in the `OnPreApplicationInitializationAsync` method of your module: + +```csharp +public class CleanupJobs +{ + public async Task CleanupLogsAsync(TickerFunctionContext tickerContext, CancellationToken cancellationToken) + { + var logFileName = tickerContext.Request; + Console.WriteLine($"Cleaning up log file: {logFileName} at {DateTime.Now}"); + } +} +``` + +```csharp +public override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context) +{ + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => + { + var service = new CleanupJobs(); // Or get it from the serviceProvider + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); + }))); + abpTickerQFunctionProvider.RequestTypes.TryAdd(nameof(CleanupJobs), (typeof(string).FullName, typeof(string))); + return Task.CompletedTask; +} +``` + +And then you can add a job by using the `ICronTickerManager`: + +```csharp +var cronTickerManager = context.ServiceProvider.GetRequiredService>(); +await cronTickerManager.AddAsync(new CronTicker +{ + Function = nameof(CleanupJobs), + Expression = "0 */6 * * *", // Every 6 hours + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 2, + RetryIntervals = new[] { 60, 300 } +}); +``` + +You can specify a cron expression instead of use `ICronTickerManager` to add a worker: + +```csharp +abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => +{ + var service = new CleanupJobs(); + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); +}))); +``` diff --git a/docs/en/framework/infrastructure/blob-storing/minio.md b/docs/en/framework/infrastructure/blob-storing/minio.md index 20bfb57296..bffba04b01 100644 --- a/docs/en/framework/infrastructure/blob-storing/minio.md +++ b/docs/en/framework/infrastructure/blob-storing/minio.md @@ -38,6 +38,7 @@ Configure(options => minio.AccessKey = "your minio accessKey"; minio.SecretKey = "your minio secretKey"; minio.BucketName = "your minio bucketName"; + minio.PresignedGetExpirySeconds = 3600; }); }); }); @@ -60,6 +61,7 @@ Configure(options => * Buckets used with Amazon S3 Transfer Acceleration can't have dots (.) in their names. For more information about transfer acceleration, see Amazon S3 Transfer Acceleration. * **WithSSL** (bool): Default value is `false`,Chain to MinIO Client object to use https instead of http. * **CreateContainerIfNotExists** (bool): Default value is `false`, If a bucket does not exist in minio, `MinioBlobProvider` will try to create it. +* **PresignedGetExpirySeconds** (int): Default value is `7 * 24 * 3600`, The expiration time of the pre-specified get url. The is valid within the range of 1 to 604800(corresponding to 7 days). ## Minio Blob Name Calculator diff --git a/docs/en/framework/infrastructure/event-bus/distributed/azure.md b/docs/en/framework/infrastructure/event-bus/distributed/azure.md index 8e1bff3e63..92a961230d 100644 --- a/docs/en/framework/infrastructure/event-bus/distributed/azure.md +++ b/docs/en/framework/infrastructure/event-bus/distributed/azure.md @@ -137,4 +137,14 @@ Configure(options => }); ```` +Use `TokenCredential` instead of `ConnectionString` if you want to use custom credential. + +````csharp +Configure(options => +{ + options.Connections.Default.FullyQualifiedNamespace = "sb-my-app.servicebus.windows.net"; + options.Connections.Default.TokenCredential = new DefaultAzureCredential(); +}); +```` + Using these options classes can be combined with the `appsettings.json` way. Configuring an option property in the code overrides the value in the configuration file. diff --git a/docs/en/framework/infrastructure/features.md b/docs/en/framework/infrastructure/features.md index 2d135b822b..e450dc2068 100644 --- a/docs/en/framework/infrastructure/features.md +++ b/docs/en/framework/infrastructure/features.md @@ -395,8 +395,31 @@ There are three pre-defined value providers, executed by the given order: * `TenantFeatureValueProvider` tries to get if the feature value is explicitly set for the **current tenant**. * `EditionFeatureValueProvider` tries to get the feature value for the current edition. Edition Id is obtained from the current principal identity (`ICurrentPrincipalAccessor`) with the claim name `editionid` (a constant defined as`AbpClaimTypes.EditionId`). Editions are not implemented for the [tenant management](../../modules/tenant-management.md) module. You can implement it yourself or consider to use the [SaaS module](https://abp.io/modules/Volo.Saas) of the ABP Commercial. +* `ConfigurationFeatureValueProvider`: Gets the value from the [IConfiguration service](../fundamentals/configuration.md). * `DefaultValueFeatureValueProvider` gets the default value of the feature. +#### Feature Values in the Application Configuration + +The `ConfigurationFeatureValueProvider` reads the feature values from the `IConfiguration` service, which can read values from the `appsettings.json` by default. So, the easiest way to configure feature values is to define them in the `appsettings.json` file. + +For example, you can configure feature values as shown below: + +````json +{ + "Features": { + "MyApp.Reporting": "true", + "MyApp.PdfReporting": "true", + "MyApp.MaxProductCount": "50" + } +} +```` + +Feature values should be configured under the `Features` section as like in this example. + +> `IConfiguration` is an .NET Core service and it can read values not only from the `appsettings.json`, but also from the environment, user secrets... etc. See [Microsoft's documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/) for more. + +#### Custom Feature Value Providers + You can write your own provider by inheriting the `FeatureValueProvider`. **Example: Enable all features for a user with "SystemAdmin" as a "User_Type" claim value** diff --git a/docs/en/framework/ui/angular/ai-config.md b/docs/en/framework/ui/angular/ai-config.md new file mode 100644 index 0000000000..06f690016a --- /dev/null +++ b/docs/en/framework/ui/angular/ai-config.md @@ -0,0 +1,262 @@ +```json +//[doc-seo] +{ + "Description": "Learn how to configure AI-powered development tools for ABP Framework Angular applications with automatic setup for Claude, Cursor, Copilot, Gemini, Junie, and Windsurf." +} +``` + +# AI Configuration + +ABP Framework provides an **AI Configuration Generator** that helps developers set up AI-powered coding assistants for their Angular applications. This schematic automatically generates configuration files for popular AI tools with pre-configured ABP best practices and guidelines. + +## Overview + +The AI Configuration Generator is an Angular schematic that creates standardized configuration files for various AI development tools. These configurations include: + +- ABP Framework coding standards and best practices +- Angular development guidelines +- Project-specific rules and conventions +- Full-stack development patterns (ABP .NET + Angular) + +## Supported AI Tools + +The generator supports the following AI coding assistants: + +- **Claude** - Creates `.claude/CLAUDE.md` configuration file +- **Copilot** - Creates `.github/copilot-instructions.md` configuration file +- **Cursor** - Creates `.cursor/rules/cursor.mdc` configuration file +- **Gemini** - Creates `.gemini/GEMINI.md` configuration file +- **Junie** - Creates `.junie/guidelines.md` configuration file +- **Windsurf** - Creates `.windsurf/rules/guidelines.md` configuration file + +## Usage + +### Basic Usage + +Generate AI configuration for a single tool: + +```bash +ng g @abp/ng.schematics:ai-config --tool=claude +``` + +### Multiple Tools + +Generate configurations for multiple AI tools at once: + +```bash +# Comma-separated +ng g @abp/ng.schematics:ai-config --tool=claude,cursor,copilot + +# Space-separated (with quotes) +ng g @abp/ng.schematics:ai-config --tool="claude cursor gemini" + +# Multiple --tool flags +ng g @abp/ng.schematics:ai-config --tool=claude --tool=cursor --tool=gemini +``` + +### Target Specific Project + +By default, configurations are generated at the workspace root. To target a specific project: + +```bash +ng g @abp/ng.schematics:ai-config --tool=claude --target-project=my-app +``` + +This creates the configuration files in the `my-app` project root directory. + +### Overwrite Existing Files + +If configuration files already exist, use the `--overwrite` flag to replace them: + +```bash +ng g @abp/ng.schematics:ai-config --tool=cursor --overwrite +``` + +## Schema Options + +The AI Configuration Generator accepts the following options: + +### tool + +- **Type:** `string` +- **Required:** Yes +- **Description:** Comma-separated list of AI tools to generate configurations for +- **Valid values:** `claude`, `copilot`, `cursor`, `gemini`, `junie`, `windsurf` +- **Example:** `"claude,cursor,copilot"` + +### targetProject + +- **Type:** `string` +- **Required:** No +- **Description:** The name of the target project in your workspace +- **Default:** Workspace root (`/`) +- **Example:** `"my-angular-app"` + +### overwrite + +- **Type:** `boolean` +- **Required:** No +- **Default:** `false` +- **Description:** Whether to overwrite existing configuration files + +## Configuration Content + +All generated configuration files include comprehensive guidelines for: + +### General Principles +- Clear separation between backend (ABP/.NET) and frontend (Angular) layers +- Modular architecture patterns +- Official ABP documentation references +- Readability, maintainability, and performance standards + +### ABP / .NET Development Rules +- Standard folder structure (`*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`) +- C# coding conventions and naming patterns +- Modern C# features (records, pattern matching, null-coalescing) +- ABP module integration (Permissions, Settings, Audit Logging) +- Error handling and validation patterns + +### Angular Development Rules +- Angular coding style and best practices +- Component architecture patterns +- Reactive programming with RxJS +- ABP Angular package usage (`@abp/ng.core`, `@abp/ng.theme.shared`) +- State management and service patterns + +### Performance and Testing +- Performance optimization techniques +- Unit testing and integration testing guidelines +- Best practices for both backend and frontend + +## Examples + +### Example 1: Setup Claude for Development + +```bash +ng g @abp/ng.schematics:ai-config --tool=claude +``` + +Output: +``` +🚀 Generating AI configuration files... +📁 Target path: / +🤖 Selected tools: claude +✅ AI configuration files generated successfully! + +📝 Generated files: + - .claude/CLAUDE.md + +💡 Tip: Restart your IDE or AI tool to apply the new configurations. +``` + +### Example 2: Setup Multiple Tools for a Project + +```bash +ng g @abp/ng.schematics:ai-config --tool="cursor,copilot,gemini" --target-project=acme-app +``` + +Output: +``` +🚀 Generating AI configuration files... +📁 Target path: /acme-app +🤖 Selected tools: cursor, copilot, gemini +✅ AI configuration files generated successfully! + +📝 Generated files: + - /acme-app/.cursor/rules/cursor.mdc + - /acme-app/.github/copilot-instructions.md + - /acme-app/.gemini/GEMINI.md + +💡 Tip: Restart your IDE or AI tool to apply the new configurations. +``` + +### Example 3: Update Existing Configuration + +```bash +ng g @abp/ng.schematics:ai-config --tool=windsurf --overwrite +``` + +This will regenerate the Windsurf configuration file even if it already exists. + +## File Structure + +After running the generator, your project will have configuration files in their respective directories: + +``` +your-project/ +├── .claude/ +│ └── CLAUDE.md # Claude AI configuration +├── .cursor/ +│ └── rules/ +│ └── cursor.mdc # Cursor AI configuration +├── .github/ +│ └── copilot-instructions.md # GitHub Copilot configuration +├── .gemini/ +│ └── GEMINI.md # Gemini AI configuration +├── .junie/ +│ └── guidelines.md # Junie AI configuration +└── .windsurf/ + └── rules/ + └── guidelines.md # Windsurf AI configuration +``` + +## Best Practices + +1. **Generate Early**: Set up AI configurations at the beginning of your project to ensure consistent code quality from the start. + +2. **Multiple Tools**: If your team uses different AI assistants, generate configurations for all of them to maintain consistency across the team. + +3. **Version Control**: Commit the generated configuration files to your repository so all team members benefit from the same AI guidelines. + +4. **Keep Updated**: When ABP releases new best practices or your project evolves, regenerate configurations with the `--overwrite` flag. + +5. **Project-Specific**: For monorepos or multi-project workspaces, use `--target-project` to create project-specific configurations. + +## Troubleshooting + +### Configuration File Already Exists + +If you see a warning that a configuration file already exists: + +``` +⚠️ Configuration file already exists: .claude/CLAUDE.md + Use --overwrite flag to replace existing files. +``` + +Add the `--overwrite` flag to replace it: + +```bash +ng g @abp/ng.schematics:ai-config --tool=claude --overwrite +``` + +### Invalid Tool Name + +If you specify an invalid tool name: + +``` +Invalid AI tool(s): chatgpt. Valid options are: claude, copilot, cursor, gemini, junie, windsurf +``` + +Make sure to use only the supported tool names listed above. + +### No Tools Selected + +If you run the command without specifying any tools: + +```bash +ng g @abp/ng.schematics:ai-config +``` + +You'll see usage examples and available tools: + +``` +ℹ️ No AI tools selected. Skipping configuration generation. + +💡 Usage examples: + ng g @abp/ng.schematics:ai-config --tool=claude,cursor + ng g @abp/ng.schematics:ai-config --tool="claude, cursor" + ng g @abp/ng.schematics:ai-config --tool=gemini --tool=cursor + ng g @abp/ng.schematics:ai-config --tool=gemini --target-project=my-app + +Available tools: claude, copilot, cursor, gemini, junie, windsurf +``` \ No newline at end of file diff --git a/docs/en/framework/ui/angular/component-replacement.md b/docs/en/framework/ui/angular/component-replacement.md index 6feebfc409..ec1102f893 100644 --- a/docs/en/framework/ui/angular/component-replacement.md +++ b/docs/en/framework/ui/angular/component-replacement.md @@ -584,8 +584,8 @@ Open the generated `nav-items.component.html` in `src/app/nav-items` folder and class="bg-transparent border-0 text-white" /> ``` diff --git a/docs/en/framework/ui/angular/data-table-column-extensions.md b/docs/en/framework/ui/angular/data-table-column-extensions.md index 30b9facf0d..0365336d81 100644 --- a/docs/en/framework/ui/angular/data-table-column-extensions.md +++ b/docs/en/framework/ui/angular/data-table-column-extensions.md @@ -171,7 +171,7 @@ It has the following properties: - **index** is the table index where the record is at. -- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `ExtensibleTableComponent`, including, but not limited to, its parent component. +- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `ExtensibleTableComponent`, including, but not limited to, its parent component. ```js { diff --git a/docs/en/framework/ui/angular/dynamic-form-extensions.md b/docs/en/framework/ui/angular/dynamic-form-extensions.md index ee7af81397..a92a06d609 100644 --- a/docs/en/framework/ui/angular/dynamic-form-extensions.md +++ b/docs/en/framework/ui/angular/dynamic-form-extensions.md @@ -107,7 +107,7 @@ Extra properties defined on an existing entity will be included in the create an It has the following properties: -- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `ExtensibleFormPropComponent`, including, but not limited to, its parent components. +- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `ExtensibleFormPropComponent`, including, but not limited to, its parent components. ```js { diff --git a/docs/en/framework/ui/angular/entity-action-extensions.md b/docs/en/framework/ui/angular/entity-action-extensions.md index 152ff6636d..5a8e74a2f9 100644 --- a/docs/en/framework/ui/angular/entity-action-extensions.md +++ b/docs/en/framework/ui/angular/entity-action-extensions.md @@ -272,7 +272,7 @@ It has the following properties: - **index** is the table index where the record is at. -- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `GridActionsComponent`, including, but not limited to, its parent component. +- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `GridActionsComponent`, including, but not limited to, its parent component. ```js { diff --git a/docs/en/framework/ui/angular/form-validation.md b/docs/en/framework/ui/angular/form-validation.md index 35a54549af..b4ed31842d 100644 --- a/docs/en/framework/ui/angular/form-validation.md +++ b/docs/en/framework/ui/angular/form-validation.md @@ -52,7 +52,7 @@ export const appConfig: ApplicationConfig = { }; ``` -When a [validator](https://angular.io/guide/form-validation#defining-custom-validators) or an [async validator](https://angular.io/guide/form-validation#creating-asynchronous-validators) returns an error with the key given to the error blueprints (`uniqueUsername` here), the validation library will be able to display an error message after localizing according to the given key and interpolation params. The result will look like this: +When a [validator](https://angular.dev/guide/forms/form-validation) or an [async validator](https://angular.dev/guide/forms/form-validation) returns an error with the key given to the error blueprints (`uniqueUsername` here), the validation library will be able to display an error message after localizing according to the given key and interpolation params. The result will look like this: An already taken username is entered while creating new user and a custom error message appears under the input after validation. @@ -146,12 +146,13 @@ import { ChangeDetectionStrategy, Component } from "@angular/core"; selector: "app-validation-error", imports:[CommonModule, LocalizationPipe], template: ` -
- {%{{{ error.message | abpLocalization: error.interpoliteParams }}}%} -
+ @for (error of abpErrors; track $index){ +
+ {%{{{ error.message | abpLocalization: error.interpoliteParams }}}%} +
+ } `, changeDetection: ChangeDetectionStrategy.OnPush, }) @@ -250,7 +251,7 @@ buildForm() { {%{{ 'AbpIdentity::UserInformations' | abpLocalization }}%} - + @@ -263,7 +264,7 @@ buildForm() { + /> } diff --git a/docs/en/framework/ui/angular/http-requests.md b/docs/en/framework/ui/angular/http-requests.md index 5cb217540d..a5ca0dec66 100644 --- a/docs/en/framework/ui/angular/http-requests.md +++ b/docs/en/framework/ui/angular/http-requests.md @@ -9,7 +9,7 @@ ## About HttpClient -Angular has the amazing [HttpClient](https://angular.io/guide/http) for communication with backend services. It is a layer on top and a simplified representation of [XMLHttpRequest Web API](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). It also is the recommended agent by Angular for any HTTP request. There is nothing wrong with using the `HttpClient` in your ABP project. +Angular has the amazing [HttpClient](https://angular.dev/guide/http/making-requests) for communication with backend services. It is a layer on top and a simplified representation of [XMLHttpRequest Web API](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). It also is the recommended agent by Angular for any HTTP request. There is nothing wrong with using the `HttpClient` in your ABP project. However, `HttpClient` leaves error handling to the caller (method). In other words, HTTP errors are handled manually and by hooking into the observer of the `Observable` returned. @@ -93,7 +93,7 @@ postFoo(body: Foo) { } ``` -You may [check here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/rest.ts#L23) for complete `Rest.Request` type, which has only a few changes compared to [HttpRequest](https://angular.io/api/common/http/HttpRequest) class in Angular. +You may [check here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/rest.ts#L23) for complete `Rest.Request` type, which has only a few changes compared to [HttpRequest](https://angular.dev/api/common/http/HttpRequest) class in Angular. ### How to Disable Default Error Handler of RestService diff --git a/docs/en/framework/ui/angular/lazy-load-service.md b/docs/en/framework/ui/angular/lazy-load-service.md index e0942a15f0..9eb1113899 100644 --- a/docs/en/framework/ui/angular/lazy-load-service.md +++ b/docs/en/framework/ui/angular/lazy-load-service.md @@ -44,10 +44,13 @@ The first parameter of `load` method expects a `LoadingStrategy`. If you pass a ```js import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core'; import { inject } from '@angular/core'; +import { AsyncPipe } from '@angular/common'; @Component({ template: ` - + @if (libraryLoaded$ | async) { + + } ` }) class DemoComponent { @@ -59,7 +62,7 @@ class DemoComponent { } ``` -The `load` method returns an observable to which you can subscibe in your component or with an `async` pipe. In the example above, the `NgIf` directive will render `` only **if the script gets successfully loaded or is already loaded before**. +The `load` method returns an observable to which you can subscibe in your component or with an `async` pipe. In the example above, the `@if(...)` directive will render `` only **if the script gets successfully loaded or is already loaded before**. > You can subscribe multiple times in your template with `async` pipe. The Scripts will only be loaded once. @@ -74,10 +77,13 @@ If you pass a `StyleLoadingStrategy` instance as the first parameter of `load` m ```js import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core'; import { inject } from '@angular/core'; +import { AsyncPipe } from '@angular/common'; @Component({ template: ` - + @if (stylesLoaded$ | async) { + + } ` }) class DemoComponent { @@ -89,7 +95,7 @@ class DemoComponent { } ``` -The `load` method returns an observable to which you can subscibe in your component or with an `AsyncPipe`. In the example above, the `NgIf` directive will render `` only **if the style gets successfully loaded or is already loaded before**. +The `load` method returns an observable to which you can subscibe in your component or with an `AsyncPipe`. In the example above, the `@if(...)` directive will render `` only **if the style gets successfully loaded or is already loaded before**. > You can subscribe multiple times in your template with `async` pipe. The styles will only be loaded once. @@ -126,10 +132,13 @@ A common usecase is **loading multiple scripts and/or styles before using a feat import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core'; import { forkJoin } from 'rxjs'; import { inject } from '@angular/core'; +import { AsyncPipe } from '@angular/common'; @Component({ template: ` - + @if (scriptsAndStylesLoaded$ | async) { + + } ` }) class DemoComponent { @@ -168,10 +177,13 @@ Another frequent usecase is **loading dependent scripts in order**: import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core'; import { concat } from 'rxjs'; import { inject } from '@angular/core'; +import { AsyncPipe } from '@angular/common'; @Component({ template: ` - + @if (scriptsLoaded$ | async) { + + } ` }) class DemoComponent { diff --git a/docs/en/framework/ui/angular/list-service.md b/docs/en/framework/ui/angular/list-service.md index f8b0a42249..dab58d0e33 100644 --- a/docs/en/framework/ui/angular/list-service.md +++ b/docs/en/framework/ui/angular/list-service.md @@ -126,7 +126,7 @@ Then you can place inputs to the HTML: ## Usage with Observables -You may use observables in combination with [AsyncPipe](https://angular.io/guide/observables-in-angular#async-pipe) of Angular instead. Here are some possibilities: +You may use observables in combination with [AsyncPipe](https://angular.dev/ecosystem/rxjs-interop) of Angular instead. Here are some possibilities: ```js book$ = this.list.hookToQuery(query => this.bookService.getListByInput(query)); diff --git a/docs/en/framework/ui/angular/localization.md b/docs/en/framework/ui/angular/localization.md index 034e77abf0..9f3122529c 100644 --- a/docs/en/framework/ui/angular/localization.md +++ b/docs/en/framework/ui/angular/localization.md @@ -220,7 +220,7 @@ As of v2.9 ABP supports RTL. If you are generating a new project with v2.9 and a ### Step 1. Create Chunks for Bootstrap LTR and RTL -Find [styles configuration in angular.json](https://angular.io/guide/workspace-config#style-script-config) and make sure the chunks in your project has `bootstrap-rtl.min` and `bootstrap-ltr.min` as shown below. +Find [styles configuration in angular.json](https://angular.dev/reference/configs/workspace-config) and make sure the chunks in your project has `bootstrap-rtl.min` and `bootstrap-ltr.min` as shown below. ```json { @@ -279,7 +279,7 @@ export class AppComponent {} ## Registering a New Locale -Since ABP has more than one language, Angular locale files load lazily using [Webpack's import function](https://webpack.js.org/api/module-methods/#import-1) to avoid increasing the bundle size and to register the Angular core using the [`registerLocaleData`](https://angular.io/api/common/registerLocaleData) function. The chunks to be included in the bundle are specified by the [Webpack's magic comments](https://webpack.js.org/api/module-methods/#magic-comments) as hard-coded. Therefore a `registerLocale` function that returns Webpack `import` function must be passed to `provideAbpCore(withOptions({...}))`. +Since ABP has more than one language, Angular locale files load lazily using [Webpack's import function](https://webpack.js.org/api/module-methods/#import-1) to avoid increasing the bundle size and to register the Angular core using the [`registerLocaleData`](https://angular.dev/api/common/registerLocaleData) function. The chunks to be included in the bundle are specified by the [Webpack's magic comments](https://webpack.js.org/api/module-methods/#magic-comments) as hard-coded. Therefore a `registerLocale` function that returns Webpack `import` function must be passed to `provideAbpCore(withOptions({...}))`. ### registerLocaleFn diff --git a/docs/en/framework/ui/angular/modifying-the-menu.md b/docs/en/framework/ui/angular/modifying-the-menu.md index 75da5169cb..eec9e79ba0 100644 --- a/docs/en/framework/ui/angular/modifying-the-menu.md +++ b/docs/en/framework/ui/angular/modifying-the-menu.md @@ -44,7 +44,29 @@ export const appConfig: ApplicationConfig = { Notes - This approach works across themes. If you are using LeptonX, the brand logo component reads these values automatically; you don't need any theme-specific code. -- You can still override visuals with CSS variables if desired. See the LeptonX section for CSS overrides. +- You can still override visuals with CSS variables if desired. See the alternative approach below. + +### Alternative: Using CSS Variables (LeptonX Theme) + +If you're using the LeptonX theme, you can also configure the logo using CSS variables in your `styles.scss` file. This approach is specific to LeptonX and provides direct control over the logo styling. + +Add the following to your `src/styles.scss`: + +```scss +:root { + --lpx-logo: url('/assets/images/logo/logo-light.png'); + --lpx-logo-icon: url('/assets/images/logo/logo-light-thumbnail.png'); +} +``` + +**When to use each approach:** + +| Approach | Use Case | Theme Support | +|----------|----------|-------------| +| **provideLogo** (recommended) | Cross-theme compatibility, environment-based configuration | All themes | +| **CSS Variables** | LeptonX-specific styling, fine-grained CSS control | LeptonX only | + +**Recommendation:** Use the `provideLogo` approach for most cases as it's theme-independent and follows ABP's standard configuration pattern. Use CSS variables only when you need LeptonX-specific styling control or have existing CSS-based theme customizations. ## How to Add a Navigation Element diff --git a/docs/en/framework/ui/angular/page-toolbar-extensions.md b/docs/en/framework/ui/angular/page-toolbar-extensions.md index 8214c19889..30c5c9813d 100644 --- a/docs/en/framework/ui/angular/page-toolbar-extensions.md +++ b/docs/en/framework/ui/angular/page-toolbar-extensions.md @@ -215,7 +215,7 @@ It has the following properties: } ``` -- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `PageToolbarComponent`, including, but not limited to, its parent component. +- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `PageToolbarComponent`, including, but not limited to, its parent component. ```js { diff --git a/docs/en/framework/ui/angular/permission-management-component-replacement.md b/docs/en/framework/ui/angular/permission-management-component-replacement.md index f91fbb42d9..7ee3022b80 100644 --- a/docs/en/framework/ui/angular/permission-management-component-replacement.md +++ b/docs/en/framework/ui/angular/permission-management-component-replacement.md @@ -334,7 +334,7 @@ Open the generated `permission-management.component.html` in `src/app/permission ```html - + @if (data.entityDisplayName) {

{%{{{ 'AbpPermissionManagement::Permissions' | abpLocalization }}}%} - @@ -360,19 +360,22 @@ Open the generated `permission-management.component.html` in `src/app/permission
@@ -393,34 +396,36 @@ Open the generated `permission-management.component.html` in `src/app/permission }}}%}

-
- - -
+ @for (permission of selectedGroupPermissions; track permission.name; let i = $index) { +
+ + +
+ }
@@ -433,7 +438,7 @@ Open the generated `permission-management.component.html` in `src/app/permission 'AbpIdentity::Save' | abpLocalization }}}%} - + } ``` diff --git a/docs/en/framework/ui/angular/pwa-configuration.md b/docs/en/framework/ui/angular/pwa-configuration.md index 2c042e9d77..ea63f60b96 100644 --- a/docs/en/framework/ui/angular/pwa-configuration.md +++ b/docs/en/framework/ui/angular/pwa-configuration.md @@ -37,7 +37,7 @@ Here is the output of the command: So, Angular CLI updates some files and add a few others: -- **ngsw-config.json** is where the [service worker configuration](https://angular.io/guide/service-worker-config) is placed. Not all PWAs have this file. It is specific to Angular. +- **ngsw-config.json** is where the [service worker configuration](https://angular.dev/ecosystem/service-workers/config) is placed. Not all PWAs have this file. It is specific to Angular. - **manifest.webmanifest** is a [web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) and provides information about your app in JSON format. - **icons** are placeholder icons that are referred to in your web app manifest. We will replace these in a minute. - **angular.json** has following modifications: @@ -45,7 +45,7 @@ So, Angular CLI updates some files and add a few others: - `serviceWorker` is `true` in production build. - `ngswConfigPath` refers to _ngsw-config.json_. - **package.json** has _@angular/service-worker_ as a new dependency. -- **app.config.ts** imports `ServiceWorkerModule` and registers a service worker filename. +- **app.config.ts** The `provideServiceWorker` provider is imported to register the service worker script. - **index.html** has following modifications: - A `` element that refers to _manifest.webmanifest_. - A `` tag that sets a theme color. @@ -342,8 +342,8 @@ Open _ngsw-config.json_ file and replace its content with this: } ``` -In case you want to cache other static files, please refer to the [service worker configuration document](https://angular.io/guide/service-worker-config#assetgroups) on Angular.io. +In case you want to cache other static files, please refer to the [service worker configuration document](https://angular.dev/ecosystem/service-workers/config) on Angular.dev. ### 3.2 Set Data Groups -This part is unique to your project. We recommend being very careful about which endpoints to cache. Please refer to [service worker configuration document](https://angular.io/guide/service-worker-config#datagroups) on Angular.io for details. +This part is unique to your project. We recommend being very careful about which endpoints to cache. Please refer to [service worker configuration document](https://angular.dev/ecosystem/service-workers/config) on Angular.dev for details. diff --git a/docs/en/framework/ui/angular/quick-start.md b/docs/en/framework/ui/angular/quick-start.md index f5bc88329f..0e48f0190e 100644 --- a/docs/en/framework/ui/angular/quick-start.md +++ b/docs/en/framework/ui/angular/quick-start.md @@ -84,10 +84,10 @@ Now let us take a look at the contents of the source folder. - **app.config.ts** is the [root configuration](https://angular.dev/api/platform-browser/bootstrapApplication) that includes information about how parts of your application are related and what to run at the initiation of your application. - **route.provider.ts** is used for [modifying the menu](../angular/modifying-the-menu.md). - **assets** is for static files. A file (e.g. an image) placed in this folder will be available as is when the application is served. -- **environments** includes one file per environment configuration. There are two configurations by default, but you may always introduce another one. These files are directly referred to in _angular.json_ and help you have different builds and application variables. Please refer to [configuring Angular application environments](https://angular.io/guide/build#configuring-application-environments) for details. +- **environments** includes one file per environment configuration. There are two configurations by default, but you may always introduce another one. These files are directly referred to in _angular.json_ and help you have different builds and application variables. Please refer to [configuring Angular application environments](https://angular.dev/tools/cli/environments) for details. - **index.html** is the HTML page served to visitors and will contain everything required to run your application. Servers should be configured to redirect every request to this page so that the Angular router can take over. Do not worry about how to add JavaScript and CSS files to it, because Angular CLI will do it automatically. - **main.ts** bootstraps and configures Angular application to run in the browser. It is production-ready, so forget about it. -- **polyfill.ts** is where you can add polyfills if you want to [support legacy browsers](https://angular.io/guide/browser-support). +- **polyfill.ts** is where you can add polyfills if you want to [support legacy browsers](https://angular.dev/reference/versions). - **style.scss** is the default entry point for application styles. You can change this or add new entry points in _angular.json_. - **test.ts** helps the unit test runner discover and bootstrap spec files. @@ -106,11 +106,11 @@ Now that you know about the files and folders, we can get the application up and New ABP Angular project home page -You may modify the behavior of the **start script** (in the package.json file) by changing the parameters passed to the `ng serve` command. For instance, if you do not want a browser window to open next time you run the script, remove `--open` from the end of it. Please check [ng serve documentation](https://angular.io/cli/serve) for all available options. +You may modify the behavior of the **start script** (in the package.json file) by changing the parameters passed to the `ng serve` command. For instance, if you do not want a browser window to open next time you run the script, remove `--open` from the end of it. Please check [ng serve documentation](https://angular.dev/cli/serve) for all available options. ### Angular Live Development Server -The development server of Angular is based on [Webpack DevServer](https://webpack.js.org/configuration/dev-server/). It tracks changes to source files and syncs the browser window after an incremental re-compilation every time [2](#f-dev-server) you make one. Your experience will be like this: +The development server runs via Angular's Application Builder and uses a fast, modern dev server under the hood. It tracks changes to source files and refreshes the browser after an incremental compilation every time [2](#f-dev-server) you make one. Your experience will be like this: Angular Live Development Server compiles again on template change and removes a button from the page displayed by the browser. @@ -122,13 +122,13 @@ Please keep in mind that you should not use this server in production. To provid 1 _If you see the error above when you run the Angular app, your browser might be blocking access to the API because of the self-signed certificate. Visit that address and allow access to it (once). When you see the Swagger interface, you are good to go._ [↩](#a-certificate-error) -2 _Sometimes, depending on the file changed, Webpack may miss the change and cannot reflect it in the browser. For example, tsconfig files are not being tracked. In such a case, please restart the development server._ [↩](#a-dev-server) +2 _Sometimes, depending on the file changed, the development server may not pick up the change (for example, certain configuration files like tsconfig are not watched). In such a case, please restart the development server._ [↩](#a-dev-server) --- ## How to Build the Angular Application -An Angular application can have multiple [build targets](https://angular.io/guide/glossary#target), i.e. **configurations in angular.json** which define how [Architect](https://angular.io/guide/glossary#architect) will build applications and libraries. Usually, each build configuration has a separate environment variable file. Currently, the project has two: One for development and one for production. +An Angular application can have multiple build targets, i.e. **configurations in angular.json** which define how [Architect](https://angular.dev/reference/configs/workspace-config) will build applications and libraries. Usually, each build configuration has a separate environment variable file. Currently, the project has two: One for development and one for production. ```js // this is what environment variables look like @@ -161,7 +161,7 @@ export const environment = { } as Config.Environment; ``` -When you run the development server, variables defined in _environment.ts_ take effect. Similarly, in production mode, the default environment is replaced by _environment.prod.ts_ and completely different variables become effective. You may even [create a new build configuration](https://angular.dev/reference/configs/workspace-config#alternate-build-configurations) and set [file replacements](https://angular.io/guide/build#configure-target-specific-file-replacements) to use a completely new environment. For now, we will start a production build: +When you run the development server, variables defined in _environment.ts_ take effect. Similarly, in production mode, the default environment is replaced by _environment.prod.ts_ and completely different variables become effective. You may even [create a new build configuration](https://angular.dev/reference/configs/workspace-config#alternate-build-configurations) and set [file replacements](https://angular.dev/tools/cli/environments) to use a completely new environment. For now, we will start a production build: 1. Open your terminal and navigate to the root Angular folder. 2. Run `yarn` or `npm install` if you have not installed dependencies already. @@ -180,18 +180,18 @@ Angular web applications run on the browser and require no server except for a [ ```shell # please replace MyProjectName with your project name -npx servor dist/MyProjectName index.html 4200 --browse +npx servor dist/MyProjectName/browser index.html 4200 --browse ``` This command will download and start a simple static server, a browser window at `http://localhost:4200` will open, and the compiled output of your project will be served. Of course, you need your application to run on an optimized web server and become available to everyone. This is quite straight-forward: -1. Create a new static web server instance. You can use a service like [Azure App Service](https://azure.microsoft.com/en-us/services/app-service/web/), [Firebase](https://firebase.google.com/docs/hosting), [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), or even [GitHub Pages](https://angular.io/guide/deployment#deploy-to-github-pages). Another option is maintaining own web server with [NGINX](https://www.nginx.com/), [IIS](https://www.iis.net/), [Apache HTTP Server](https://httpd.apache.org/), or equivalent. +1. Create a new static web server instance. You can use a service like [Azure App Service](https://azure.microsoft.com/en-us/services/app-service/web/), [Firebase](https://firebase.google.com/docs/hosting), [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), or even [GitHub Pages](https://angular.dev/tools/cli/deployment). Another option is maintaining own web server with [NGINX](https://www.nginx.com/), [IIS](https://www.iis.net/), [Apache HTTP Server](https://httpd.apache.org/), or equivalent. 2. Copy the files from `dist/MyProjectName` [1](#f-dist-folder-name) to a publicly served destination on the server via CLI of the service provider, SSH, or FTP (whichever is available). This step would be defined as a job if you have a CI/CD flow. -3. [Configure the server](https://angular.io/guide/deployment#server-configuration) to redirect all requests to the _index.html_ file. Some services do that automatically. Others require you [to add a file to the bundle via assets](https://angular.io/guide/workspace-config#assets-configuration) which describes the server how to do the redirections. Occasionally, you may need to do manual configuration. +3. [Configure the server](https://angular.dev/tools/cli/deployment#server-configuration) to redirect all requests to the _index.html_ file. Some services do that automatically. Others require you [to add a file to the bundle via assets](https://angular.dev/reference/configs/workspace-config) which describes the server how to do the redirections. Occasionally, you may need to do manual configuration. -In addition, you can [deploy your application to certain targets using the Angular CLI](https://angular.io/guide/deployment#automatic-deployment-with-the-cli). Here are some deploy targets: +In addition, you can [deploy your application to certain targets using the Angular CLI](https://angular.dev/tools/cli/deployment#automatic-deployment-with-the-cli). Here are some deploy targets: - [Azure](https://github.com/Azure/ng-deploy-azure#readme) - [Firebase](https://github.com/angular/angularfire#readme) diff --git a/docs/en/framework/ui/angular/router-events.md b/docs/en/framework/ui/angular/router-events.md index b7b760ae3f..5185c9c922 100644 --- a/docs/en/framework/ui/angular/router-events.md +++ b/docs/en/framework/ui/angular/router-events.md @@ -7,7 +7,7 @@ # Router Events Simplified -`RouterEvents` is a utility service for filtering specific router events and reacting to them. Please see [this page in Angular docs](https://angular.io/api/router/Event) for available router events. +`RouterEvents` is a utility service for filtering specific router events and reacting to them. Please see [this page in Angular docs](https://angular.dev/api/router/Event) for available router events. ## Benefit diff --git a/docs/en/framework/ui/angular/service-proxies.md b/docs/en/framework/ui/angular/service-proxies.md index 51a6c4f5b4..c816158f77 100644 --- a/docs/en/framework/ui/angular/service-proxies.md +++ b/docs/en/framework/ui/angular/service-proxies.md @@ -114,7 +114,7 @@ export class BookComponent implements OnInit { } ``` -The Angular compiler removes the services that have not been injected anywhere from the final output. See the [tree-shakable providers documentation](https://angular.io/guide/dependency-injection-providers#tree-shakable-providers). +The Angular compiler removes the services that have not been injected anywhere from the final output. See the [tree-shakable providers documentation](https://angular.dev/guide/di/defining-dependency-providers). ### Models @@ -152,9 +152,11 @@ export class BookComponent implements OnInit { ``` diff --git a/docs/en/framework/ui/angular/subscription-service.md b/docs/en/framework/ui/angular/subscription-service.md index b04a3dbf58..c64edb9fe0 100644 --- a/docs/en/framework/ui/angular/subscription-service.md +++ b/docs/en/framework/ui/angular/subscription-service.md @@ -7,7 +7,7 @@ # Managing RxJS Subscriptions -`SubscriptionService` is a utility service to provide an easy unsubscription from RxJS observables in Angular components and directives. Please see [why you should unsubscribe from observables on instance destruction](https://angular.io/guide/lifecycle-hooks#cleaning-up-on-instance-destruction). +`SubscriptionService` is a utility service to provide an easy unsubscription from RxJS observables in Angular components and directives. Please see [why you should unsubscribe from observables on instance destruction](https://angular.dev/guide/components/lifecycle). ## Getting Started diff --git a/docs/en/framework/ui/angular/testing.md b/docs/en/framework/ui/angular/testing.md index c0d5ff312c..ab215f7eba 100644 --- a/docs/en/framework/ui/angular/testing.md +++ b/docs/en/framework/ui/angular/testing.md @@ -7,7 +7,7 @@ # Unit Testing Angular UI -ABP Angular UI is tested like any other Angular application. So, [the guide here](https://angular.io/guide/testing) applies to ABP too. That said, we would like to point out some **unit testing topics specific to ABP Angular applications**. +ABP Angular UI is tested like any other Angular application. So, [the guide here](https://angular.dev/guide/testing) applies to ABP too. That said, we would like to point out some **unit testing topics specific to ABP Angular applications**. ## Setup diff --git a/docs/en/framework/ui/angular/theming.md b/docs/en/framework/ui/angular/theming.md index cb6f8fe8b0..1351a02f33 100644 --- a/docs/en/framework/ui/angular/theming.md +++ b/docs/en/framework/ui/angular/theming.md @@ -81,8 +81,8 @@ You can run the following command in **Angular** project directory to copy the s ### Global/Component Styles -Angular can bundle global style files and component styles with components. -See the [component styles](https://angular.io/guide/component-styles) guide on Angular documentation for more information. +Angular can bundle global style files and component styles with components. +See the [component styles](https://angular.dev/guide/components/styling) guide on Angular documentation for more information. ### Layout Parts @@ -238,8 +238,10 @@ import { Router } from '@angular/router'; selector: 'abp-current-user-test', template: ` - + @if (data.textTemplate.icon){ + {%{{{ data.textTemplate.text | abpLocalization }}}%} + } `, }) diff --git a/docs/en/framework/ui/angular/track-by-service.md b/docs/en/framework/ui/angular/track-by-service.md index 046935e5b6..15cdd9577f 100644 --- a/docs/en/framework/ui/angular/track-by-service.md +++ b/docs/en/framework/ui/angular/track-by-service.md @@ -5,9 +5,9 @@ } ``` -# Easy *ngFor trackBy +# Easy @for() track -`TrackByService` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.io/guide/template-syntax#ngfor-with-trackby) for its purpose. +`TrackByService` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.dev/guide/templates/control-flow) for its purpose. @@ -54,8 +54,9 @@ You can use `by` to get a `TrackByFunction` that tracks the iterated object base ```html - -
{%{{{ item.name }}}%}
+@for (item of list; track: track.by('id')) { +
{%{{{ item.name }}}%}
+} ``` @@ -67,11 +68,11 @@ import { trackBy } from "@abp/ng.core"; @Component({ template: ` -
- {%{{{ item.name }}}%} -
+ @for (item of list; track: trackById) { +
+ {%{{{ item.name }}}%} +
+ } `, }) class DemoComponent { @@ -89,12 +90,11 @@ You can use `byDeep` to get a `TrackByFunction` that tracks the iterated object ```html - -
- {%{{{ item.tenant.name }}}%} -
+@for (item of list; track: track.byDeep('tenant', 'account', 'id')) { +
+ {%{{{ item.tenant.name }}}%} +
+} ``` @@ -106,11 +106,11 @@ import { trackByDeep } from "@abp/ng.core"; @Component({ template: ` -
- {%{{{ item.name }}}%} + @for (item of list; track: trackByTenantAccountId) { +
+ {%{{{ item.name }}}%}
+ } `, }) class DemoComponent { diff --git a/docs/en/framework/ui/common/leptonx-css-variables.md b/docs/en/framework/ui/common/leptonx-css-variables.md index 193246a420..938bc92304 100644 --- a/docs/en/framework/ui/common/leptonx-css-variables.md +++ b/docs/en/framework/ui/common/leptonx-css-variables.md @@ -1,3 +1,10 @@ +```json +//[doc-seo] +{ + "Description": "Explore LeptonX CSS Variables to customize theming with ease, controlling colors, spacing, and styles for a cohesive application design." +} +``` + # LeptonX CSS Variables Documentation LeptonX uses CSS custom properties (variables) prefixed with `--lpx-*` to provide a flexible theming system. These variables control colors, spacing, shadows, and component-specific styles throughout the application. diff --git a/docs/en/framework/ui/react-native/setting-up-android-emulator.md b/docs/en/framework/ui/react-native/setting-up-android-emulator.md index 8ead542a76..e5d14de32a 100644 --- a/docs/en/framework/ui/react-native/setting-up-android-emulator.md +++ b/docs/en/framework/ui/react-native/setting-up-android-emulator.md @@ -1,3 +1,10 @@ +```json +//[doc-seo] +{ + "Description": "Learn how to set up an Android emulator without Android Studio using command line tools on Windows, macOS, and Linux." +} +``` + # Setting Up Android Emulator Without Android Studio (Windows, macOS, Linux) This guide explains how to install and run an Android emulator **without Android Studio**, using only **Command Line Tools**. @@ -111,6 +118,34 @@ adb install myApp.apk --- +## How to Enable Fast Refresh in React Native + +React Native uses a hot reload system called **Fast Refresh**. +It is enabled by default in development mode, but you can manually enable or disable it via the Developer Menu. + +### To open the Developer Menu on Android emulator: + +```bash +adb shell input keyevent 82 +``` + +This command simulates the hardware menu button and opens the Developer Menu inside the emulator. + +### From the Developer Menu: + +- Look for the option: **Enable Fast Refresh** +- If it's unchecked, tap to enable it +- If it's already checked, Fast Refresh is already active + +### Alternative (if adb doesn't work): + +Focus the emulator window and press: + +- **Ctrl + M** (Windows/Linux) +- **Cmd + M** (Mac) + +--- + ## Troubleshooting | Problem | Explanation | diff --git a/docs/en/images/add-passkey.png b/docs/en/images/add-passkey.png new file mode 100644 index 0000000000..345cdd644d Binary files /dev/null and b/docs/en/images/add-passkey.png differ diff --git a/docs/en/images/identity-pro-module-change-password.png b/docs/en/images/identity-pro-module-change-password.png new file mode 100644 index 0000000000..3acff1c68a Binary files /dev/null and b/docs/en/images/identity-pro-module-change-password.png differ diff --git a/docs/en/images/identity-pro-module-password-history-settings.png b/docs/en/images/identity-pro-module-password-history-settings.png new file mode 100644 index 0000000000..76b1e08799 Binary files /dev/null and b/docs/en/images/identity-pro-module-password-history-settings.png differ diff --git a/docs/en/images/my-passkey.png b/docs/en/images/my-passkey.png new file mode 100644 index 0000000000..2b40045165 Binary files /dev/null and b/docs/en/images/my-passkey.png differ diff --git a/docs/en/images/passkey-login.png b/docs/en/images/passkey-login.png new file mode 100644 index 0000000000..dabf324e7f Binary files /dev/null and b/docs/en/images/passkey-login.png differ diff --git a/docs/en/images/passkey-login2.png b/docs/en/images/passkey-login2.png new file mode 100644 index 0000000000..349d8a2dca Binary files /dev/null and b/docs/en/images/passkey-login2.png differ diff --git a/docs/en/images/passkey-setting.png b/docs/en/images/passkey-setting.png new file mode 100644 index 0000000000..6211e91d9c Binary files /dev/null and b/docs/en/images/passkey-setting.png differ diff --git a/docs/en/modules/account-pro.md b/docs/en/modules/account-pro.md index 81e1177e33..7944c7448a 100644 --- a/docs/en/modules/account-pro.md +++ b/docs/en/modules/account-pro.md @@ -424,3 +424,4 @@ This module doesn't define any additional distributed event. See the [standard d * [Linked Accounts](./account/linkedaccounts.md) * [Session Management](./account/session-management.md) * [Idle Session Timeout](./account/idle-session-timeout.md) +* [Web Authentication API (WebAuthn) passkeys](./account/passkey.md) diff --git a/docs/en/modules/account/passkey.md b/docs/en/modules/account/passkey.md new file mode 100644 index 0000000000..b8f00ee576 --- /dev/null +++ b/docs/en/modules/account/passkey.md @@ -0,0 +1,63 @@ +# Web Authentication API (WebAuthn) passkeys + +The `Web Authentication API (WebAuthn) passkeys` feature allows users to authenticate using passkeys, which are more secure and user-friendly alternatives to traditional passwords. Passkeys leverage public key cryptography to provide strong authentication without the need for users to remember complex passwords. + +## Enabling Passkeys + +You can enable/disable the `Web Authentication API (WebAuthn) passkeys` feature in the `Setting > Account > Passkeys` page. Also, there is an option to allow how many passkeys a user can register: + +![passkey-setting](../../images/passkey-setting.png) + +## Manage Passkeys + +You can add/rename/delete your passkeys in the `Account/Manage` page: + +![my-passkey](../../images/my-passkey.png) + +Click the `Add Passkey` button to register a new passkey. You will be prompted to use your device's built-in biometric authentication (such as fingerprint or facial recognition) or an external security key to complete the registration process: + +![add-passkey](../../images/add-passkey.png) + +## Using Passkey for Login + +Once you enable the passkey feature and register at least one passkey, you can use it to log in to your account. On the login page, select the `Passkey login` option and follow the prompts to authenticate using your registered passkey: + +![passkey-login](../../images/passkey-login.png) + +![passkey-login2](../../images/passkey-login2.png) + +## Configure passkey options + +ASP.NET Core Identity provides various options to configure passkey behavior through the `IdentityPasskeyOptions` class, which include: + +- **AuthenticatorTimeout**: Gets or sets the time that the browser should wait for the authenticator to provide a passkey as a TimeSpan. This option applies to both creating a new passkey and requesting an existing passkey. This option is treated as a hint to the browser, and the browser may ignore the option. The default value is 5 minutes. +- **ChallengeSize**: Gets or sets the size of the challenge in bytes sent to the client during attestation and assertion. This option applies to both creating a new passkey and requesting an existing passkey. The default value is 32 bytes. +- **ServerDomain**: Gets or sets the effective Relying Party ID (domain) of the server. This should be unique and will be used as the identity for the server. This option applies to both creating a new passkey and requesting an existing passkey. If null, which is the default value, the server's origin is used. For more information, see Relying Party Identifier RP ID. + +**Example configuration:** + +```csharp +builder.Services.Configure(options => +{ + options.ServerDomain = "abp.io"; + options.AuthenticatorTimeout = TimeSpan.FromMinutes(3); + options.ChallengeSize = 64; +}); +``` + +For a complete list of configuration options, see [IdentityPasskeyOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.identitypasskeyoptions). For the most up-to-date browser defaults, see the [W3C WebAuthn specification](https://www.w3.org/TR/webauthn-3/). + +## HTTPS requirement + +All passkey operations require HTTPS. The implementation stores authentication data in encrypted and signed cookies that could be intercepted over unencrypted connections. + +## Browser Support + +Passkeys are supported in most modern browsers, including: Chrome, Edge, Firefox, and Safari. Ensure that you are using the latest version of your browser to take advantage of passkey functionality. + +## Additional resources + +For more information on WebAuthn and passkeys, refer to the following resources: + +- [Enable Web Authentication API (WebAuthn) passkeys](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/passkeys) +- [Web Authentication API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API) diff --git a/docs/en/modules/ai-management/index.md b/docs/en/modules/ai-management/index.md index 51ba74f7aa..e50253c22c 100644 --- a/docs/en/modules/ai-management/index.md +++ b/docs/en/modules/ai-management/index.md @@ -1,3 +1,10 @@ +```json +//[doc-seo] +{ + "Description": "Discover how to implement AI management in your ABP Framework application, enhancing workspace dynamics with easy installation options." +} +``` + # AI Management (Pro) > You must have an ABP Team or a higher license to use this module. diff --git a/docs/en/modules/cms-kit/dynamic-widget.md b/docs/en/modules/cms-kit/dynamic-widget.md index 8644f7cd63..f0646cc00f 100644 --- a/docs/en/modules/cms-kit/dynamic-widget.md +++ b/docs/en/modules/cms-kit/dynamic-widget.md @@ -124,21 +124,26 @@ In this image, after choosing your widget (on the other case, it changes automat You can edit this output manually if do any wrong coding for that (wrong value or typo) you won't see the widget, even so, your page will be viewed successfully. -## Options -To configure the widget, you should define the below code in YourModule.cs +## Options + +To add content widgets, you should configure the `CmsKitContentWidgetOptions` in your module's `ConfigureServices` method: ```csharp Configure(options => { options.AddWidget(widgetType: "Today", widgetName: "CmsToday", parameterWidgetName: "Format"); + + // Alternatively, you can add a widget conditionally based on a global feature being enabled + options.AddWidgetIfFeatureEnabled(typeof(PagesFeature), "Today", "CmsToday", "Format"); }); ``` -Let's look at these parameters in detail -* `widgetType` is used for end-user and more readable names. The following bold word represents widgetType. -[Widget Type="**Today**" Format="yyyy-dd-mm HH:mm:ss"]. +The `CmsKitContentWidgetOptions` provides two methods for registering widgets: -* `widgetName` is used for your widget name used in code for the name of the `ViewComponent`. +- **AddWidget:** Registers a widget that will be available in the content editor. It accepts the following parameters: + - `widgetType` (required): A user-friendly name for the widget that appears in the widget selection dropdown and is used in content markup. For example, in `[Widget Type="Today"]`, `"Today"` is the `widgetType`. + - `widgetName` (required): The name of the `ViewComponent` that will be rendered. This must match the `Name` attribute of your `ViewComponent` (e.g., `[ViewComponent(Name = "CmsToday")]`). + - `parameterWidgetName` (optional): The name of the parameter widget that will be displayed in the "Add Widget" modal to collect parameter values from users. This is only required when your widget needs parameters. -* `parameterWidgetName` is used the for editor component side to see on the `Add Widget` modal. -After choosing the widget type from listbox (now just defined `Format`) and renders this widget automatically. It's required only to see UI once using parameters \ No newline at end of file +- **AddWidgetIfFeatureEnabled:** Registers a widget conditionally, only if a specified [global feature](../../framework/infrastructure/global-features.md) is enabled. It accepts the same parameters as `AddWidget`, plus an additional first parameter: + - `featureType` (required): The type of the global feature that must be enabled for the widget to be available (e.g., `typeof(PagesFeature)`). \ No newline at end of file diff --git a/docs/en/modules/elsa-pro.md b/docs/en/modules/elsa-pro.md index f070cbf8d9..6b93e42368 100644 --- a/docs/en/modules/elsa-pro.md +++ b/docs/en/modules/elsa-pro.md @@ -1,3 +1,10 @@ +```json +//[doc-seo] +{ + "Description": "Integrate Elsa Workflows into your ABP applications with this Pro module. Learn installation and setup for seamless workflow management." +} +``` + # Elsa Module (Pro) > You must have an ABP Team or a higher license to use this module. diff --git a/docs/en/modules/feature-management.md b/docs/en/modules/feature-management.md index 300b232f93..e80098a04d 100644 --- a/docs/en/modules/feature-management.md +++ b/docs/en/modules/feature-management.md @@ -72,9 +72,10 @@ namespace Demo ## Feature Management Providers -Features Management Module is extensible, just like the [features system](../framework/infrastructure/features.md). You can extend it by defining feature management providers. There are 3 pre-built feature management providers registered it the following order: +Features Management Module is extensible, just like the [features system](../framework/infrastructure/features.md). You can extend it by defining feature management providers. There are 4 pre-built feature management providers registered in the following order: * `DefaultValueFeatureManagementProvider`: Gets the value from the default value of the feature definition. It can not set the default value since default values are hard-coded on the feature definition. +* `ConfigurationFeatureManagementProvider`: Gets the value from the [IConfiguration service](../framework/fundamentals/configuration.md). * `EditionFeatureManagementProvider`: Gets or sets the feature values for an edition. Edition is a group of features assigned to tenants. Edition system has not implemented by the Tenant Management module. You can implement it yourself or purchase the ABP [SaaS Module](https://abp.io/modules/Volo.Saas) which implements it and also provides more SaaS features, like subscription and payment. * `TenantFeatureManagementProvider`: Gets or sets the features values for tenants. diff --git a/docs/en/modules/file-management.md b/docs/en/modules/file-management.md index e0cb3225f1..8a5f7aae29 100644 --- a/docs/en/modules/file-management.md +++ b/docs/en/modules/file-management.md @@ -144,6 +144,12 @@ You can move files by clicking `Actions -> Move` on the table. You can rename a file by clicking `Actions -> Rename` on the table. +###### File Sharing + +To share a file, click `Actions -> Share` in the table. Once sharing is enabled, you can copy the shared link directly from the table. + +> Anyone with the shared link will be able to access the file while sharing is enabled. + ## Data Seed This module doesn't seed any data. diff --git a/docs/en/modules/identity-pro.md b/docs/en/modules/identity-pro.md index 7392590c3f..0d26154932 100644 --- a/docs/en/modules/identity-pro.md +++ b/docs/en/modules/identity-pro.md @@ -439,3 +439,5 @@ This module doesn't define any additional distributed event. See the [standard d * [Periodic Password Change (Password Aging)](./identity/periodic-password-change.md) * [Two Factor Authentication](./identity/two-factor-authentication.md) * [Session Management](./identity/session-management.md) +* [Password History](./identity/password-history.md) + diff --git a/docs/en/modules/identity/password-history.md b/docs/en/modules/identity/password-history.md new file mode 100644 index 0000000000..e28d78fe0e --- /dev/null +++ b/docs/en/modules/identity/password-history.md @@ -0,0 +1,20 @@ +# Password History + +## Introduction + +> You must have an ABP Team or a higher license to use this module & its features. + +The Identity PRO module has a built-in password history function that allows you to enforce password reuse policies for users within your application. It keeps track of users’ previously used passwords and checks this history whenever a user attempts to change their password. This prevents users from setting a password that they have already used in the past, ensuring that each new password is unique and not a repetition of an older one. + +## Password History Settings + +You need to enable the password history and configure related settings: + +![identity-pro-module-password-history-settings](../../images/identity-pro-module-password-history-settings.png) + +* **Enable prevent password reuse**: Whether to prevent users from reusing their previous passwords. +* **Password change period**: The number of previous passwords that cannot be reused. + +When you enable the password history, users and administrators will not be able to reuse their previous passwords when changing/resetting their passwords. + +![identity-pro-module-change-password](../../images/identity-pro-module-change-password.png) diff --git a/docs/en/release-info/migration-guides/abp-10-0.md b/docs/en/release-info/migration-guides/abp-10-0.md index ea095d58b3..334adb2f4f 100644 --- a/docs/en/release-info/migration-guides/abp-10-0.md +++ b/docs/en/release-info/migration-guides/abp-10-0.md @@ -1,3 +1,10 @@ +```json +//[doc-seo] +{ + "Description": "Upgrade your ABP solutions from v9.x to v10.0 with this comprehensive migration guide, ensuring compatibility and new features with .NET 10.0." +} +``` + # ABP Version 10.0 Migration Guide This document is a guide for upgrading ABP v9.x solutions to ABP v10.0. There are some changes in this version that may affect your applications. Please read them carefully and apply the necessary changes to your application. diff --git a/docs/en/release-info/migration-guides/abp-5-0-angular.md b/docs/en/release-info/migration-guides/abp-5-0-angular.md index f6abcf10f6..66627b1e8a 100644 --- a/docs/en/release-info/migration-guides/abp-5-0-angular.md +++ b/docs/en/release-info/migration-guides/abp-5-0-angular.md @@ -104,7 +104,7 @@ If you don't want to use the NGXS, you should remove all NGXS related imports, i ## @angular/localize package -[`@angular/localize`](https://angular.io/api/localize) dependency has been removed from `@abp/ng.core` package. The package must be installed in your app. Run the following command to install: +[`@angular/localize`](https://angular.dev/guide/i18n/add-package) dependency has been removed from `@abp/ng.core` package. The package must be installed in your app. Run the following command to install: ```bash npm install @angular/localize@12 diff --git a/docs/en/solution-templates/layered-web-application/web-applications.md b/docs/en/solution-templates/layered-web-application/web-applications.md index 58cc3af078..8400a6dfbe 100644 --- a/docs/en/solution-templates/layered-web-application/web-applications.md +++ b/docs/en/solution-templates/layered-web-application/web-applications.md @@ -120,7 +120,7 @@ The required style files are added to the `styles` array in `angular.json`. `App You should create your tests in the same folder as the file you want to test. -See the [testing document](https://angular.io/guide/testing). +See the [testing document](https://angular.dev/guide/testing). ### Depended Packages diff --git a/docs/en/studio/installation.md b/docs/en/studio/installation.md index 6f12953f99..2e1d061920 100644 --- a/docs/en/studio/installation.md +++ b/docs/en/studio/installation.md @@ -65,3 +65,7 @@ When you see the "New Version Available" window, follow these steps to upgrade A 2. A progress indicator will display the download status. 3. Once the download is complete, a new modal will appear with the "Install and Relaunch" buttons. 4. Click on the "Install and Relaunch" button to complete the installation process. + +## Installing a Specific Version + +There is no official support for installing an older version of ABP Studio yet. But, if you want to install an older version of ABP Studio, you can use approach explanined here [https://github.com/enisn/AbpDevTools?tab=readme-ov-file#switch-abp-studio-version](https://github.com/enisn/AbpDevTools?tab=readme-ov-file#switch-abp-studio-version) \ No newline at end of file diff --git a/docs/en/suite/editing-templates.md b/docs/en/suite/editing-templates.md index 9c859ba0de..354adc8ead 100644 --- a/docs/en/suite/editing-templates.md +++ b/docs/en/suite/editing-templates.md @@ -27,7 +27,7 @@ There's a search box on the templates page. To find the related template, pick a There's a naming convention for the template files. * If the template name has `Server` prefix, it's used for backend code like repositories, application services, localizations, controllers, permissions, mappings, unit tests. -* If the template name has `Frontend.Angular` prefix, it's used for Angular code generation. The Angular code is being generated via [Angular Schematics](https://angular.io/guide/schematics). +* If the template name has `Frontend.Angular` prefix, it's used for Angular code generation. The Angular code is being generated via [Angular Schematics](https://angular.dev/tools/cli/schematics). * If the template name has `Frontend.Mvc` prefix, it's used for razor pages, menus, JavaScript, CSS files. * If the template name has `Frontend.Blazor` prefix, it's used for razor components. diff --git a/docs/en/suite/generating-crud-page.md b/docs/en/suite/generating-crud-page.md index cc9df3ee32..afc2536709 100644 --- a/docs/en/suite/generating-crud-page.md +++ b/docs/en/suite/generating-crud-page.md @@ -294,7 +294,7 @@ There are some adjustments you may need to make before generating CRUD pages for - Check if your environment variables have `rootNamespace` defined as explained [here](../framework/ui/angular/service-proxies.md#angular-project-configuration). -- Check if your [workspace configuration](https://angular.io/guide/workspace-config) satisfies one of the following. Examples assume your solution namespace is `BookStore`, `Acme.BookStore`, or `Acme.Retail.BookStore`. +- Check if your [workspace configuration](https://angular.dev/reference/configs/workspace-config) satisfies one of the following. Examples assume your solution namespace is `BookStore`, `Acme.BookStore`, or `Acme.Retail.BookStore`. - Project key is in pascal case. E.g. `BookStore`. - Project key is in camel case. E.g. `bookStore`. - Project key is in kebab case. E.g. `book-store`. diff --git a/docs/en/suite/solution-structure.md b/docs/en/suite/solution-structure.md index d36ea35e7f..4b15be2f07 100644 --- a/docs/en/suite/solution-structure.md +++ b/docs/en/suite/solution-structure.md @@ -303,7 +303,7 @@ Lepton theme uses two logos for each style. You can change these logos with your You should create your tests in the same folder as the file file you want to test. -See the [testing document](https://angular.io/guide/testing). +See the [testing document](https://angular.dev/guide/testing). ### Depended Packages diff --git a/docs/en/tutorials/book-store/part-02.md b/docs/en/tutorials/book-store/part-02.md index 750808fe4d..1fe21c2848 100644 --- a/docs/en/tutorials/book-store/part-02.md +++ b/docs/en/tutorials/book-store/part-02.md @@ -315,7 +315,7 @@ This is a fully working, server side paged, sorted and localized table of books. ## Install NPM packages -> Notice: This tutorial is based on the ABP v3.1.0+ If your project version is older, then please upgrade your solution. Check the [migration guide](../../framework/ui/angular/migration-guide-v3.md) if you are upgrading an existing project with v2.x. +> Notice: This tutorial is based on the ABP v9.3.0+ If your project version is older, then please upgrade your solution. Check the [migration guide](../../framework/ui/angular/migration-guide-v3.md) if you are upgrading an existing project with v2.x. If you haven't done it before, open a new command line interface (terminal window) and go to your `angular` folder and then run the `yarn` command to install the NPM packages: @@ -330,69 +330,42 @@ It's time to create something visible and usable! There are some tools that we w - [Ng Bootstrap](https://ng-bootstrap.github.io/#/home) will be used as the UI component library. - [Ngx-Datatable](https://swimlane.gitbook.io/ngx-datatable/) will be used as the datatable library. -Run the following command line to create a new module, named `BookModule` in the root folder of the angular application: +Run the following command line to create a new component, named `BookComponent` in the root folder of the angular application: ```bash -yarn ng generate module book --module app --routing --route books +yarn ng generate component book ``` This command should produce the following output: ````bash -> yarn ng generate module book --module app --routing --route books - -yarn run v1.19.1 -$ ng generate module book --module app --routing --route books -CREATE src/app/book/book-routing.module.ts (336 bytes) -CREATE src/app/book/book.module.ts (335 bytes) -CREATE src/app/book/book.component.html (19 bytes) -CREATE src/app/book/book.component.spec.ts (614 bytes) -CREATE src/app/book/book.component.ts (268 bytes) +> yarn ng generate component book + +yarn run v1.22.22 +$ ng generate component book +CREATE src/app/book/book.component.spec.ts (537 bytes) +CREATE src/app/book/book.component.ts (189 bytes) CREATE src/app/book/book.component.scss (0 bytes) -UPDATE src/app/app-routing.module.ts (1289 bytes) +CREATE src/app/book/book.component.html (20 bytes) Done in 3.88s. ```` -### BookModule - -Open the `/src/app/book/book.module.ts` and replace the content as shown below: - -````js -import { NgModule } from '@angular/core'; -import { SharedModule } from '../shared/shared.module'; -import { BookRoutingModule } from './book-routing.module'; -import { BookComponent } from './book.component'; - -@NgModule({ - declarations: [BookComponent], - imports: [ - BookRoutingModule, - SharedModule - ] -}) -export class BookModule { } - -```` - -* Added the `SharedModule`. `SharedModule` exports some common modules needed to create user interfaces. -* `SharedModule` already exports the `CommonModule`, so we've removed the `CommonModule`. - ### Routing -The generated code places the new route definition to the `src/app/app-routing.module.ts` file as shown below: +The generated code places the new route definition to the `src/app/app.routes.ts` file as shown below: ````js -const routes: Routes = [ +export const routes: Routes = [ // other route definitions... - { path: 'books', loadChildren: () => import('./book/book.module').then(m => m.BookModule) }, + { path : 'books', loadComponent: () => import('./book/book.component').then(c => c.BookComponent) }, ]; ```` Now, open the `src/app/route.provider.ts` file and replace the `configureRoutes` function declaration as shown below: ```js -function configureRoutes(routes: RoutesService) { - return () => { +function configureRoutes() { + const routes = inject(RoutesService); routes.add([ { path: '/', @@ -416,7 +389,6 @@ function configureRoutes(routes: RoutesService) { }, ]); }; -} ``` `RoutesService` is a service provided by the ABP to configure the main menu and the routes. @@ -497,7 +469,7 @@ Open the `/src/app/book/book.component.html` and replace the content as shown be
- + {%{{{ '::Enum:BookType.' + row.type | abpLocalization }}}%} diff --git a/docs/en/tutorials/book-store/part-03.md b/docs/en/tutorials/book-store/part-03.md index 546b4a743d..73b2daea4e 100644 --- a/docs/en/tutorials/book-store/part-03.md +++ b/docs/en/tutorials/book-store/part-03.md @@ -670,7 +670,7 @@ You can open your browser and click the **New book** button to see the new modal ### Create a Reactive Form -[Reactive forms](https://angular.io/guide/reactive-forms) provide a model-driven approach to handling form inputs whose values change over time. +[Reactive forms](https://angular.dev/guide/forms/reactive-forms) provide a model-driven approach to handling form inputs whose values change over time. Open `/src/app/book/book.component.ts` and replace the content as below: @@ -742,8 +742,8 @@ export class BookComponent implements OnInit { * Imported `FormGroup`, `FormBuilder` and `Validators` from `@angular/forms`. * Added a `form: FormGroup` property. * Added a `bookTypes` property as a list of `BookType` enum members. That will be used in form options. -* Injected with the `FormBuilder` inject function.. [FormBuilder](https://angular.io/api/forms/FormBuilder) provides convenient methods for generating form controls. It reduces the amount of boilerplate needed to build complex forms. -* Added a `buildForm` method to the end of the file and executed the `buildForm()` in the `createBook` method. +* Injected the `FormBuilder` with the inject function. [FormBuilder](https://angular.dev/api/forms/FormBuilder) provides convenient methods for generating form controls. It reduces the amount of boilerplate that is needed to build complex forms. +* Added a `buildForm` method at the end of the file and executed the `buildForm()` in the `createBook` method. * Added a `save` method. Open `/src/app/book/book.component.html` and replace ` ` with the following code part: @@ -765,7 +765,11 @@ Open `/src/app/book/book.component.html` and replace ` Type *
@@ -804,46 +808,24 @@ Also replace ` ` with the following code p We've used [NgBootstrap datepicker](https://ng-bootstrap.github.io/#/components/datepicker/overview) in this component. So, we need to arrange the dependencies related to this component. -Open `/src/app/book/book.module.ts` and replace the content as below: - -```js -import { NgModule } from '@angular/core'; -import { SharedModule } from '../shared/shared.module'; -import { BookRoutingModule } from './book-routing.module'; -import { BookComponent } from './book.component'; -import { NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap'; // add this line - -@NgModule({ - declarations: [BookComponent], - imports: [ - BookRoutingModule, - SharedModule, - NgbDatepickerModule, // add this line - ] -}) -export class BookModule { } -``` - -* We imported `NgbDatepickerModule` to be able to use the date picker. - Open `/src/app/book/book.component.ts` and replace the content as below: ```js import { ListService, PagedResultDto } from '@abp/ng.core'; import { Component, OnInit, inject } from '@angular/core'; import { BookService, BookDto, bookTypeOptions } from '@proxy/books'; -import { FormGroup, FormBuilder, Validators } from '@angular/forms'; - -// added this line -import { NgbDateNativeAdapter, NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap'; +import { FormGroup, FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms'; +import { NgbDateNativeAdapter, NgbDateAdapter, NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap'; +import { ThemeSharedModule } from '@abp/ng.theme.shared'; @Component({ selector: 'app-book', templateUrl: './book.component.html', styleUrls: ['./book.component.scss'], + imports: [ThemeSharedModule, ReactiveFormsModule, NgbDatepickerModule], providers: [ ListService, - { provide: NgbDateAdapter, useClass: NgbDateNativeAdapter } // add this line + { provide: NgbDateAdapter, useClass: NgbDateNativeAdapter } ], }) export class BookComponent implements OnInit { diff --git a/docs/en/tutorials/book-store/part-05.md b/docs/en/tutorials/book-store/part-05.md index b7b05103c9..3db00ea423 100644 --- a/docs/en/tutorials/book-store/part-05.md +++ b/docs/en/tutorials/book-store/part-05.md @@ -311,23 +311,19 @@ We've only added the `.RequirePermissions(BookStorePermissions.Books.Default)` e First step of the UI is to prevent unauthorized users to see the "Books" menu item and enter to the book management page. -Open the `/src/app/book/book-routing.module.ts` and replace with the following content: +Open the `/src/app/app.routes.ts` and replace with the following content: ````js -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; import { authGuard, permissionGuard } from '@abp/ng.core'; import { BookComponent } from './book.component'; const routes: Routes = [ - { path: '', component: BookComponent, canActivate: [authGuard, permissionGuard] }, +{ + path: 'books', + loadComponent: () => import('./book/book.component').then(c => BookComponent), + canActivate: [authGuard, permissionGuard], +}, ]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class BookRoutingModule {} ```` * Imported `authGuard` and `permissionGuard` from the `@abp/ng.core`. diff --git a/docs/en/tutorials/book-store/part-09.md b/docs/en/tutorials/book-store/part-09.md index c30b018494..b70fd3e875 100644 --- a/docs/en/tutorials/book-store/part-09.md +++ b/docs/en/tutorials/book-store/part-09.md @@ -477,49 +477,43 @@ That's all! You can run the application and try to edit an author. ## The Author Management Page -Run the following command line to create a new module, named `AuthorModule` in the root folder of the angular application: +Run the following command line to create a new component, named `AuthorComponent` in the root folder of the angular application: ```bash -yarn ng generate module author --module app --routing --route authors +yarn ng generate component author ``` This command should produce the following output: ```bash -> yarn ng generate module author --module app --routing --route authors +> yarn ng generate component author yarn run v1.19.1 -$ ng generate module author --module app --routing --route authors -CREATE src/app/author/author-routing.module.ts (344 bytes) -CREATE src/app/author/author.module.ts (349 bytes) +$ yarn ng generate component author CREATE src/app/author/author.component.html (21 bytes) CREATE src/app/author/author.component.spec.ts (628 bytes) CREATE src/app/author/author.component.ts (276 bytes) CREATE src/app/author/author.component.scss (0 bytes) -UPDATE src/app/app-routing.module.ts (1396 bytes) Done in 2.22s. ``` -### AuthorModule +### Author Component -Open the `/src/app/author/author.module.ts` and replace the content as shown below: +Open the `/src/app/author/author.component.ts` and replace the content as shown below: ```js -import { NgModule } from '@angular/core'; -import { SharedModule } from '../shared/shared.module'; -import { AuthorRoutingModule } from './author-routing.module'; -import { AuthorComponent } from './author.component'; +import { Component } from '@angular/core'; import { NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap'; -@NgModule({ - declarations: [AuthorComponent], - imports: [SharedModule, AuthorRoutingModule, NgbDatepickerModule], +@Component({ + selector: 'app-author', + templateUrl: './author.component.html', + styleUrls: ['./author.component.scss'], + imports: [NgbDatepickerModule], }) -export class AuthorModule {} +export class AuthorComponent {} ``` -- Added the `SharedModule`. `SharedModule` exports some common modules needed to create user interfaces. -- `SharedModule` already exports the `CommonModule`, so we've removed the `CommonModule`. - Added `NgbDatepickerModule` that will be used later on the author create and edit forms. ### Menu Definition @@ -753,13 +747,13 @@ Open the `/src/app/author/author.component.html` and replace the content as belo - + {%{{{ row.birthDate | date }}}%} - + diff --git a/docs/en/tutorials/book-store/part-10.md b/docs/en/tutorials/book-store/part-10.md index 5e0235ad14..e03ada5a96 100644 --- a/docs/en/tutorials/book-store/part-10.md +++ b/docs/en/tutorials/book-store/part-10.md @@ -970,7 +970,7 @@ Book list page change is trivial. Open the `/src/app/book/book.component.html` a [name]="'::Author' | abpLocalization" prop="authorName" [sortable]="false" -> +/> ```` When you run the application, you can see the *Author* column on the table: @@ -1098,9 +1098,11 @@ Open the `/src/app/book/book.component.html` and add the following form group ju * ```` diff --git a/docs/en/tutorials/microservice/index.md b/docs/en/tutorials/microservice/index.md index 938d9b9108..7f6dc734f3 100644 --- a/docs/en/tutorials/microservice/index.md +++ b/docs/en/tutorials/microservice/index.md @@ -45,7 +45,7 @@ This tutorial is organized as the following parts: ## Download the Source Code -After logging in to the ABP website, you can download the source code from {{if UI == "MVC"}} [here](https://abp.io/api/download/samples/cloud-crm-mvc-ef) {{else if UI == "NG"}} [here](https://abp.io/api/download/samples/cloud-crm-ng-ef) {{else if UI == "Blazor"}} [here](https://abp.io/api/download/samples/cloud-crm-blazor-wasm-ef) {{else if UI == "BlazorServer"}} [here](https://abp.io/api/download/samples/cloud-crm-blazor-server-ef) {{else if UI == "BlazorWebApp"}} [here](https://abp.io/api/download/samples/cloud-crm-blazor-webapp-ef) {{end}}. +After logging in to the ABP website, you can download the source code from {{if UI == "MVC"}} [here](https://abp.io/api/download/samples/cloud-crm-mvc-ef) {{else if UI == "NG"}} [here](https://abp.io/api/download/samples/cloud-crm-angular-ef) {{else if UI == "Blazor"}} [here](https://abp.io/api/download/samples/cloud-crm-blazor-wasm-ef) {{else if UI == "BlazorServer"}} [here](https://abp.io/api/download/samples/cloud-crm-blazor-server-ef) {{else if UI == "BlazorWebApp"}} [here](https://abp.io/api/download/samples/cloud-crm-blazor-webapp-ef) {{end}}. ## See Also diff --git a/docs/en/tutorials/microservice/part-05.md b/docs/en/tutorials/microservice/part-05.md index 24da71a716..29727700e8 100644 --- a/docs/en/tutorials/microservice/part-05.md +++ b/docs/en/tutorials/microservice/part-05.md @@ -628,7 +628,7 @@ export const APP_ROUTES: Routes = [ // ... { path: 'order-service', - children: ORDER_SERVICE_ROUTES, + loadChildren: () => import('ordering-service').then(c =>c.ORDER_SERVICE_ROUTES), }, ]; ``` @@ -636,12 +636,8 @@ export const APP_ROUTES: Routes = [ ```typescript // order-service.routes.ts export const ORDER_SERVICE_ROUTES: Routes = [ - { - path: '', - pathMatch: 'full', - component: RouterOutletComponent, - }, - { path: 'orders', children: ORDER_ROUTES }, + { path: 'orders', loadComponent: () => import('./order/order.component').then(c => c.OrderComponent) }, + { path: '**', redirectTo: 'orders' } ]; ``` @@ -657,17 +653,16 @@ import { OrderDto, OrderService } from './proxy/ordering-service/services'; @Component({ selector: 'lib-order', templateUrl: './order.component.html', - styleUrl: './order.component.css' + styleUrl: './order.component.css', imports: [CommonModule] }) export class OrderComponent { items: OrderDto[] = []; - - private readonly proxy = inject(OrderService); + private readonly orderService = inject(OrderService); constructor() { - this.proxy.getList().subscribe((res) => { + this.orderService.getList().subscribe((res) => { this.items = res; }); } @@ -686,11 +681,13 @@ export class OrderComponent { Product Id Customer Name - - {%{{{item.id}}}%} - {%{{{item.productId}}}%} - {%{{{item.customerName}}}%} - + @for (item of items; track item.id) { + + {%{{{item.id}}}%} + {%{{{item.productId}}}%} + {%{{{item.customerName}}}%} + + } diff --git a/docs/en/tutorials/microservice/part-06.md b/docs/en/tutorials/microservice/part-06.md index bf54602936..a694631979 100644 --- a/docs/en/tutorials/microservice/part-06.md +++ b/docs/en/tutorials/microservice/part-06.md @@ -314,11 +314,13 @@ Open the `order.component.html` file (the `order.component.html` file under the Product Name Customer Name - - {%{{{item.id}}}%} - {%{{{item.productName}}}%} - {%{{{item.customerName}}}%} - + @for (item of items; track item.id) { + + {%{{{item.id}}}%} + {%{{{item.productName}}}%} + {%{{{item.customerName}}}%} + + } diff --git a/docs/en/tutorials/todo/layered/index.md b/docs/en/tutorials/todo/layered/index.md index b561f0bb06..c8d95b627c 100644 --- a/docs/en/tutorials/todo/layered/index.md +++ b/docs/en/tutorials/todo/layered/index.md @@ -760,45 +760,46 @@ We can then use `todoService` to use the server-side HTTP APIs, as we'll do in t Open the `/angular/src/app/home/home.component.ts` file and replace its content with the following code block: -```js +```ts +import {Component, inject, OnInit} from '@angular/core'; +import {FormsModule} from '@angular/forms'; import { ToasterService } from '@abp/ng.theme.shared'; -import { Component, OnInit, inject } from '@angular/core'; import { TodoItemDto, TodoService } from '@proxy'; @Component({ - selector: 'app-home', - standalone: false, - templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'] + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], + imports: [FormsModule] }) export class HomeComponent implements OnInit { - todoItems: TodoItemDto[]; - newTodoText: string; + todoItems: TodoItemDto[]; + newTodoText: string; + readonly todoService = inject(TodoService); + readonly toasterService = inject(ToasterService); - private readonly todoService = inject(TodoService); - private readonly toasterService = inject(ToasterService); + ngOnInit(): void { + this.todoService.getList().subscribe(response => { + this.todoItems = response; + }); + } - ngOnInit(): void { - this.todoService.getList().subscribe(response => { - this.todoItems = response; - }); - } - - create(): void { - this.todoService.create(this.newTodoText).subscribe((result) => { - this.todoItems = this.todoItems.concat(result); - this.newTodoText = null; - }); - } + create(): void{ + this.todoService.create(this.newTodoText).subscribe((result) => { + this.todoItems = this.todoItems.concat(result); + this.newTodoText = null; + }); + } - delete(id: string): void { - this.todoService.delete(id).subscribe(() => { - this.todoItems = this.todoItems.filter(item => item.id !== id); - this.toasterService.info('Deleted the todo item.'); - }); - } + delete(id: string): void { + this.todoService.delete(id).subscribe(() => { + this.todoItems = this.todoItems.filter(item => item.id !== id); + this.toasterService.info('Deleted the todo item.'); + }); + } } + ``` We've used `todoService` to get the list of todo items and assigned the returning value to the `todoItems` array. We've also added `create` and `delete` methods. These methods will be used on the view side. @@ -809,31 +810,35 @@ Open the `/angular/src/app/home/home.component.html` file and replace its conten ```html
-
-
-
TODO LIST
-
-
- -
-
-
- -
+
+
+
TODO LIST
-
- +
+ + +
+
+ +
+
+
+ +
+ + + +
    + @for (todoItem of todoItems; track todoItem.id) { +
  • + {%{{{ todoItem.text }}}%} +
  • + } +
- - -
    -
  • - {%{{{ todoItem.text }}}%} -
  • -
-
+ ``` ### home.component.scss diff --git a/docs/en/tutorials/todo/single-layer/index.md b/docs/en/tutorials/todo/single-layer/index.md index 32e7290bc2..6a7f45ce62 100644 --- a/docs/en/tutorials/todo/single-layer/index.md +++ b/docs/en/tutorials/todo/single-layer/index.md @@ -728,43 +728,43 @@ Then, we can use the `TodoService` to use the server-side HTTP APIs, as we'll do Open the `/angular/src/app/home/home.component.ts` file and replace its content with the following code block: ```ts -import { ToasterService } from "@abp/ng.theme.shared"; -import { Component, OnInit, inject } from '@angular/core'; -import { TodoItemDto } from "@proxy/services/dtos"; -import { TodoService } from "@proxy/services"; +import {Component, inject, OnInit} from '@angular/core'; +import {FormsModule} from '@angular/forms'; +import { ToasterService } from '@abp/ng.theme.shared'; +import { TodoItemDto, TodoService } from '@proxy'; @Component({ - selector: 'app-home', - templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'], + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], + imports: [FormsModule] }) export class HomeComponent implements OnInit { - todoItems: TodoItemDto[]; - newTodoText: string; + todoItems: TodoItemDto[]; + newTodoText: string; + readonly todoService = inject(TodoService); + readonly toasterService = inject(ToasterService); - private readonly todoService = inject(TodoService); - private readonly toasterService = inject(ToasterService); + ngOnInit(): void { + this.todoService.getList().subscribe(response => { + this.todoItems = response; + }); + } - ngOnInit(): void { - this.todoService.getList().subscribe(response => { - this.todoItems = response; - }); - } - - create(): void { - this.todoService.create(this.newTodoText).subscribe((result) => { - this.todoItems = this.todoItems.concat(result); - this.newTodoText = null; - }); - } + create(): void{ + this.todoService.create(this.newTodoText).subscribe((result) => { + this.todoItems = this.todoItems.concat(result); + this.newTodoText = null; + }); + } - delete(id: string): void { - this.todoService.delete(id).subscribe(() => { - this.todoItems = this.todoItems.filter(item => item.id !== id); - this.toasterService.info('Deleted the todo item.'); - }); - } + delete(id: string): void { + this.todoService.delete(id).subscribe(() => { + this.todoItems = this.todoItems.filter(item => item.id !== id); + this.toasterService.info('Deleted the todo item.'); + }); + } } ``` @@ -776,30 +776,33 @@ Open the `/angular/src/app/home/home.component.html` file and replace its conten ````html
-
-
-
TODO LIST
-
-
- -
-
-
- -
+
+
+
TODO LIST
-
- +
+ + +
+
+ +
+
+
+ +
+ + + +
    + @for (todoItem of todoItems; track todoItem.id) { +
  • + {%{{{ todoItem.text }}}%} +
  • + } +
- - -
    -
  • - {%{{{ todoItem.text }}}%} -
  • -
-
```` diff --git a/framework/Volo.Abp.slnx b/framework/Volo.Abp.slnx index 1289991520..3d74af9f95 100644 --- a/framework/Volo.Abp.slnx +++ b/framework/Volo.Abp.slnx @@ -166,6 +166,9 @@ + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo/Abp/AspNetCore/Mvc/NewtonsoftJson/AbpAspNetCoreMvcNewtonsoftModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo/Abp/AspNetCore/Mvc/NewtonsoftJson/AbpAspNetCoreMvcNewtonsoftModule.cs index 95e07a06e0..214b866197 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo/Abp/AspNetCore/Mvc/NewtonsoftJson/AbpAspNetCoreMvcNewtonsoftModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo/Abp/AspNetCore/Mvc/NewtonsoftJson/AbpAspNetCoreMvcNewtonsoftModule.cs @@ -13,7 +13,7 @@ public class AbpAspNetCoreMvcNewtonsoftModule : AbpModule { context.Services.AddMvcCore().AddNewtonsoftJson(); - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { options.SerializerSettings.ContractResolver = diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelper.cs index 0135d136ba..a9cdd76200 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelper.cs @@ -12,6 +12,11 @@ public class AbpRadioInputTagHelper : AbpTagHelper { private readonly IAbpTagHelperLocalizer _tagHelperLocalizer; - - public AbpRadioInputTagHelperService(IAbpTagHelperLocalizer tagHelperLocalizer) + private readonly IHtmlGenerator _generator; + private readonly HtmlEncoder _encoder; + private readonly IStringLocalizerFactory _stringLocalizerFactory; + private readonly IAbpEnumLocalizer _abpEnumLocalizer; + + public AbpRadioInputTagHelperService( + IAbpTagHelperLocalizer tagHelperLocalizer, + IHtmlGenerator generator, + HtmlEncoder encoder, + IStringLocalizerFactory stringLocalizerFactory, + IAbpEnumLocalizer abpEnumLocalizer) { _tagHelperLocalizer = tagHelperLocalizer; + _generator = generator; + _encoder = encoder; + _stringLocalizerFactory = stringLocalizerFactory; + _abpEnumLocalizer = abpEnumLocalizer; } - public override void Process(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var selectItems = GetSelectItems(context, output); SetSelectedValue(context, output, selectItems); var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder(); - var html = GetHtml(context, output, selectItems); + var html = await GetRadioInputGroupAsHtmlAsync(context, output, selectItems); AddGroupToFormGroupContents(context, TagHelper.AspFor.Name, html, order, out var suppress); @@ -44,6 +62,21 @@ public class AbpRadioInputTagHelperService : AbpTagHelperService GetRadioInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output, List selectItems) + { + var radioGroupHtml = GetHtml(context, output, selectItems); + var label = await GetLabelAsHtmlAsync(context, output); + var infoText = GetInfoAsHtml(context, output); + + var tagBuilder = new TagBuilder("div"); + tagBuilder.AddCssClass("mb-3"); + tagBuilder.InnerHtml.AppendHtml(label); + tagBuilder.InnerHtml.AppendHtml(radioGroupHtml); + tagBuilder.InnerHtml.AppendHtml(infoText); + + return tagBuilder.ToHtmlString(); + } + protected virtual string GetHtml(TagHelperContext context, TagHelperOutput output, List selectItems) { var html = new StringBuilder(""); @@ -77,14 +110,92 @@ public class AbpRadioInputTagHelperService : AbpTagHelperService GetLabelAsHtmlAsync(TagHelperContext context, TagHelperOutput output) + { + if (TagHelper.SuppressLabel) + { + return string.Empty; + } + + if (string.IsNullOrEmpty(TagHelper.Label)) + { + return await GetLabelAsHtmlUsingTagHelperAsync(context, output); + } + + var label = new TagBuilder("label"); + label.AddCssClass("form-label"); + label.InnerHtml.AppendHtml(TagHelper.Label); + label.InnerHtml.AppendHtml(GetRequiredSymbol(context, output)); + + return label.ToHtmlString(); + } + + protected virtual async Task GetLabelAsHtmlUsingTagHelperAsync(TagHelperContext context, TagHelperOutput output) + { + var labelTagHelper = new LabelTagHelper(_generator) + { + For = TagHelper.AspFor, + ViewContext = TagHelper.ViewContext, + }; + + var innerOutput = await labelTagHelper.ProcessAndGetOutputAsync( + new TagHelperAttributeList { { "class", "form-label" } }, + context, + "label", + TagMode.StartTagAndEndTag); + + innerOutput.Content.AppendHtml(GetRequiredSymbol(context, output)); + + return innerOutput.Render(_encoder); + } + + protected virtual string GetRequiredSymbol(TagHelperContext context, TagHelperOutput output) + { + var isHaveRequiredAttribute = context.AllAttributes.Any(a => a.Name == "required"); + + return TagHelper.AspFor.ModelExplorer.GetAttribute() != null || isHaveRequiredAttribute + ? " * " + : ""; + } + + protected virtual string GetInfoAsHtml(TagHelperContext context, TagHelperOutput output) + { + var text = string.Empty; + var infoAttribute = TagHelper.AspFor.ModelExplorer.GetAttribute(); + + if (!string.IsNullOrEmpty(TagHelper.InfoText)) + { + text = TagHelper.InfoText!; + } + else if (infoAttribute != null) + { + text = _tagHelperLocalizer.GetLocalizedText(infoAttribute.Text, TagHelper.AspFor.ModelExplorer); + } + else + { + return ""; + } + + var small = new TagBuilder("small"); + small.Attributes.Add("id", TagHelper.AspFor.Name.Replace('.', '_') + "InfoText"); + small.AddCssClass("form-text"); + small.InnerHtml.Append(text); + + return small.ToHtmlString(); } protected virtual List GetSelectItems(TagHelperContext context, TagHelperOutput output) @@ -110,10 +221,32 @@ public class AbpRadioInputTagHelperService : AbpTagHelperService GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer) { - var localizer = _tagHelperLocalizer.GetLocalizerOrNull(explorer); + var selectItems = new List(); + var isNullableType = Nullable.GetUnderlyingType(explorer.ModelType) != null; + var enumType = explorer.ModelType; + + if (isNullableType) + { + enumType = Nullable.GetUnderlyingType(explorer.ModelType)!; + selectItems.Add(new SelectListItem()); + } + + var containerLocalizer = _tagHelperLocalizer.GetLocalizerOrNull(explorer.Container.ModelType.Assembly); - var selectItems = explorer.Metadata.IsEnum ? explorer.ModelType.GetTypeInfo().GetMembers(BindingFlags.Public | BindingFlags.Static) - .Select((t, i) => new SelectListItem { Value = i.ToString(), Text = GetLocalizedPropertyName(localizer, explorer.ModelType, t.Name) }).ToList() : new List(); + foreach (var enumValue in enumType.GetEnumValuesAsUnderlyingType()) + { + var localizedMemberName = _abpEnumLocalizer.GetString(enumType, enumValue, + new[] + { + containerLocalizer, + _stringLocalizerFactory.CreateDefaultOrNull() + }!); + selectItems.Add(new SelectListItem + { + Value = enumValue.ToString(), + Text = localizedMemberName + }); + } return selectItems; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index c3fc470ed8..ad8d8c1c28 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -165,7 +165,7 @@ public class AbpAspNetCoreMvcModule : AbpModule context.Services.AddSingleton(); context.Services.TryAddEnumerable(ServiceDescriptor.Transient()); - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((mvcOptions, serviceProvider) => { mvcOptions.AddAbp(context.Services); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs index f2bac81316..89af08fd43 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs @@ -13,7 +13,7 @@ public static class MvcCoreBuilderExtensions { public static IMvcCoreBuilder AddAbpJson(this IMvcCoreBuilder builder) { - builder.Services.AddOptions() + builder.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { options.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip; diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs index 2e16c79809..bb2f080e71 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; @@ -33,6 +34,15 @@ public abstract class AbpWebApplicationFactoryIntegratedTest : WebAppl return base.CreateHost(builder); } + protected override void ConfigureWebHost(IWebHostBuilder builder) + { + builder.ConfigureAppConfiguration((hostingContext, config) => + { + hostingContext.HostingEnvironment.EnvironmentName = "Production"; + }); + base.ConfigureWebHost(builder); + } + protected virtual T? GetService() { return Services.GetService(); diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/AbpPermissionOptions.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/AbpPermissionOptions.cs index 4bdd7c0bb8..c240e1ac07 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/AbpPermissionOptions.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/AbpPermissionOptions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Volo.Abp.Authorization.Permissions.Resources; using Volo.Abp.Collections; namespace Volo.Abp.Authorization.Permissions; @@ -9,6 +10,8 @@ public class AbpPermissionOptions public ITypeList ValueProviders { get; } + public ITypeList ResourceValueProviders { get; } + public HashSet DeletedPermissions { get; } public HashSet DeletedPermissionGroups { get; } @@ -17,6 +20,7 @@ public class AbpPermissionOptions { DefinitionProviders = new TypeList(); ValueProviders = new TypeList(); + ResourceValueProviders = new TypeList(); DeletedPermissions = new HashSet(); DeletedPermissionGroups = new HashSet(); diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/ICanAddChildPermission.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/ICanAddChildPermission.cs index 828e4cbd01..2bcf9ba10d 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/ICanAddChildPermission.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/ICanAddChildPermission.cs @@ -11,4 +11,4 @@ public interface ICanAddChildPermission ILocalizableString? displayName = null, MultiTenancySides multiTenancySide = MultiTenancySides.Both, bool isEnabled = true); -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionContext.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionContext.cs index 7ff890bac7..5a1bef8e1d 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionContext.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionContext.cs @@ -1,5 +1,7 @@ using System; +using JetBrains.Annotations; using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.Authorization.Permissions; @@ -46,4 +48,16 @@ public interface IPermissionDefinitionContext /// Name of the permission /// PermissionDefinition? GetPermissionOrNull(string name); + + PermissionDefinition AddResourcePermission( + string name, + string resourceName, + string managementPermissionName, + ILocalizableString? displayName = null, + MultiTenancySides multiTenancySide = MultiTenancySides.Both, + bool isEnabled = true); + + PermissionDefinition? GetResourcePermissionOrNull([NotNull] string resourceName, [NotNull] string name); + + void RemoveResourcePermission([NotNull] string resourceName, [NotNull] string name); } diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs index ca04b110f7..d9411d54fa 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs @@ -11,7 +11,14 @@ public interface IPermissionDefinitionManager Task GetOrNullAsync([NotNull] string name); + [ItemNotNull] + Task GetResourcePermissionAsync([NotNull]string resourceName, [NotNull] string name); + + Task GetResourcePermissionOrNullAsync([NotNull]string resourceName, [NotNull] string name); + Task> GetPermissionsAsync(); + Task> GetResourcePermissionsAsync(); + Task> GetGroupsAsync(); } diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionValueProvider.cs index ae9252632d..683f513cf4 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionValueProvider.cs @@ -6,7 +6,6 @@ public interface IPermissionValueProvider { string Name { get; } - //TODO: Rename to GetResult? (CheckAsync throws exception by naming convention) Task CheckAsync(PermissionValueCheckContext context); Task CheckAsync(PermissionValuesCheckContext context); diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs index 0f5d713e2b..c93992ed49 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs @@ -7,7 +7,7 @@ using Volo.Abp.SimpleStateChecking; namespace Volo.Abp.Authorization.Permissions; -public class PermissionDefinition : +public class PermissionDefinition : IHasSimpleStateCheckers, ICanAddChildPermission { @@ -16,6 +16,16 @@ public class PermissionDefinition : /// public string Name { get; } + /// + /// Resource name of the permission. + /// + public string? ResourceName { get; set; } + + /// + /// Management permission of the resource permission. + /// + public string? ManagementPermissionName { get; set; } + /// /// Parent of this permission if one exists. /// If set, this permission can be granted only if parent is granted. @@ -76,6 +86,19 @@ public class PermissionDefinition : set => Properties[name] = value; } + protected internal PermissionDefinition( + [NotNull] string name, + string resourceName, + string managementPermissionName, + ILocalizableString? displayName = null, + MultiTenancySides multiTenancySide = MultiTenancySides.Both, + bool isEnabled = true) + : this(name, displayName, multiTenancySide, isEnabled) + { + ResourceName = Check.NotNull(resourceName, nameof(resourceName)); + ManagementPermissionName = Check.NotNull(managementPermissionName, nameof(managementPermissionName)); + } + protected internal PermissionDefinition( [NotNull] string name, ILocalizableString? displayName = null, @@ -99,6 +122,11 @@ public class PermissionDefinition : MultiTenancySides multiTenancySide = MultiTenancySides.Both, bool isEnabled = true) { + if (ResourceName != null) + { + throw new AbpException($"Resource permission cannot have child permissions. Resource: {ResourceName}"); + } + var child = new PermissionDefinition( name, displayName, @@ -109,12 +137,12 @@ public class PermissionDefinition : }; child[PermissionDefinitionContext.KnownPropertyNames.CurrentProviderName] = this[PermissionDefinitionContext.KnownPropertyNames.CurrentProviderName]; - + _children.Add(child); return child; } - + PermissionDefinition ICanAddChildPermission.AddPermission( string name, ILocalizableString? displayName = null, @@ -124,7 +152,6 @@ public class PermissionDefinition : return this.AddChild(name, displayName, multiTenancySide, isEnabled); } - /// /// Sets a property in the dictionary. /// This is a shortcut for nested calls on this object. diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinitionContext.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinitionContext.cs index 394cdb9d82..c13f53866a 100644 --- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinitionContext.cs +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinitionContext.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Linq; using JetBrains.Annotations; using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.Authorization.Permissions; @@ -11,17 +13,20 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext public Dictionary Groups { get; } + public List ResourcePermissions { get; } + internal IPermissionDefinitionProvider? CurrentProvider { get; set; } public static class KnownPropertyNames { public const string CurrentProviderName = "_CurrentProviderName"; } - + public PermissionDefinitionContext(IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; Groups = new Dictionary(); + ResourcePermissions = new List(); } public virtual PermissionGroupDefinition AddGroup( @@ -43,7 +48,7 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext } Groups[name] = group; - + return group; } @@ -51,37 +56,23 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext public virtual PermissionGroupDefinition GetGroup([NotNull] string name) { var group = GetGroupOrNull(name); - - if (group == null) - { - throw new AbpException($"Could not find a permission definition group with the given name: {name}"); - } - - return group; + return group ?? throw new AbpException($"Could not find a permission definition group with the given name: {name}"); } public virtual PermissionGroupDefinition? GetGroupOrNull([NotNull] string name) { Check.NotNull(name, nameof(name)); - - if (!Groups.ContainsKey(name)) - { - return null; - } - - return Groups[name]; + return Groups.GetOrDefault(name); } public virtual void RemoveGroup(string name) { Check.NotNull(name, nameof(name)); - if (!Groups.ContainsKey(name)) + if (!Groups.Remove(name)) { throw new AbpException($"Not found permission group with name: {name}"); } - - Groups.Remove(name); } public virtual PermissionDefinition? GetPermissionOrNull([NotNull] string name) @@ -100,4 +91,58 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext return null; } + + public virtual PermissionDefinition AddResourcePermission( + string name, + string resourceName, + string managementPermissionName, + ILocalizableString? displayName = null, + MultiTenancySides multiTenancySide = MultiTenancySides.Both, + bool isEnabled = true) + { + Check.NotNull(name, nameof(name)); + Check.NotNull(resourceName, nameof(resourceName)); + Check.NotNull(managementPermissionName, nameof(managementPermissionName)); + + if (ResourcePermissions.Any(x => x.ResourceName == resourceName && x.Name == name)) + { + throw new AbpException($"There is already an existing resource permission with name: {name} for resource: {resourceName}"); + } + + var permission = new PermissionDefinition( + name, + resourceName, + managementPermissionName, + displayName, + multiTenancySide, + isEnabled) + { + [KnownPropertyNames.CurrentProviderName] = CurrentProvider?.GetType().FullName + }; + + ResourcePermissions.Add(permission); + + return permission; + } + + public virtual PermissionDefinition? GetResourcePermissionOrNull([NotNull] string resourceName, [NotNull] string name) + { + Check.NotNull(resourceName, nameof(resourceName)); + Check.NotNull(name, nameof(name)); + + return ResourcePermissions.FirstOrDefault(p => p.ResourceName == resourceName && p.Name == name); + } + + public virtual void RemoveResourcePermission([NotNull] string resourceName, [NotNull] string name) + { + Check.NotNull(resourceName, nameof(resourceName)); + Check.NotNull(name, nameof(name)); + + var resourcePermission = GetResourcePermissionOrNull(resourceName, name); + if (resourcePermission == null) + { + throw new AbpException($"Not found resource permission with name: {name} for resource: {resourceName}"); + } + ResourcePermissions.Remove(resourcePermission); + } } diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IHasResourcePermissions.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IHasResourcePermissions.cs new file mode 100644 index 0000000000..903f6bd2d6 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IHasResourcePermissions.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public interface IHasResourcePermissions : IKeyedObject +{ + Dictionary ResourcePermissions { get; } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionChecker.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionChecker.cs new file mode 100644 index 0000000000..0270d2c96b --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionChecker.cs @@ -0,0 +1,33 @@ +using System.Security.Claims; +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public interface IResourcePermissionChecker +{ + Task IsGrantedAsync( + string name, + string resourceName, + string resourceKey + ); + + Task IsGrantedAsync( + ClaimsPrincipal? claimsPrincipal, + string name, + string resourceName, + string resourceKey + ); + + Task IsGrantedAsync( + string[] names, + string resourceName, + string resourceKey + ); + + Task IsGrantedAsync( + ClaimsPrincipal? claimsPrincipal, + string[] names, + string resourceName, + string resourceKey + ); +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionStore.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionStore.cs new file mode 100644 index 0000000000..42f751b4c5 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionStore.cs @@ -0,0 +1,83 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public interface IResourcePermissionStore +{ + /// + /// Checks if the given permission is granted for the given resource. + /// + /// The name of the permission. + /// The name of the resource. + /// Resource key + /// The name of the provider. + /// The key of the provider. + /// + /// True if the permission is granted. + /// + Task IsGrantedAsync( + string name, + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + /// + /// Checks if the given permissions are granted for the given resource. + /// + /// The name of the permissions. + /// The name of the resource. + /// Resource key + /// The name of the provider. + /// The key of the provider. + /// + /// A object containing the grant results for each permission. + /// + Task IsGrantedAsync( + string[] names, + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + /// + /// Gets all permissions for the given resource. + /// + /// Resource name + /// Resource key + /// + /// A object containing the grant results for each permission. + /// + Task GetPermissionsAsync( + string resourceName, + string resourceKey + ); + + /// + /// Gets all granted permissions for the given resource. + /// + /// Resource name + /// Resource key + /// + /// An array of granted permission names. + /// + Task GetGrantedPermissionsAsync( + string resourceName, + string resourceKey + ); + + /// + /// Retrieves the keys of resources for which the specified permission is granted. + /// + /// The name of the resource. + /// The name of the permission. + /// + /// An array of resource keys where the specified permission is granted. + /// + Task GetGrantedResourceKeysAsync( + string resourceName, + string name + ); +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionValueProvider.cs new file mode 100644 index 0000000000..288b878e5d --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionValueProvider.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public interface IResourcePermissionValueProvider +{ + string Name { get; } + + Task CheckAsync(ResourcePermissionValueCheckContext context); + + Task CheckAsync(ResourcePermissionValuesCheckContext context); +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionValueProviderManager.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionValueProviderManager.cs new file mode 100644 index 0000000000..e07e63d06a --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/IResourcePermissionValueProviderManager.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public interface IResourcePermissionValueProviderManager +{ + IReadOnlyList ValueProviders { get; } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/NullResourcePermissionStore.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/NullResourcePermissionStore.cs new file mode 100644 index 0000000000..84bf38ef42 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/NullResourcePermissionStore.cs @@ -0,0 +1,43 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class NullResourcePermissionStore : IResourcePermissionStore, ISingletonDependency +{ + public ILogger Logger { get; set; } + + public NullResourcePermissionStore() + { + Logger = NullLogger.Instance; + } + + public Task IsGrantedAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + return TaskCache.FalseResult; + } + + public Task IsGrantedAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey) + { + return Task.FromResult(new MultiplePermissionGrantResult(names, PermissionGrantResult.Prohibited)); + } + + public Task GetPermissionsAsync(string resourceName, string resourceKey) + { + return Task.FromResult(new MultiplePermissionGrantResult()); + } + + public Task GetGrantedPermissionsAsync(string resourceName, string resourceKey) + { + return Task.FromResult(Array.Empty()); + } + + public Task GetGrantedResourceKeysAsync(string resourceName, string name) + { + return Task.FromResult(Array.Empty()); + } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionCheckerExtensions.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionCheckerExtensions.cs new file mode 100644 index 0000000000..c1d153b246 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionCheckerExtensions.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public static class ResourcePermissionCheckerExtensions +{ + /// + /// Checks if a specific permission is granted for a resource with a given key. + /// + /// The type of the resource. + /// The resource permission checker instance. + /// The name of the permission to check. + /// The resource instance to check permission for. + /// The unique key identifying the resource instance. + /// A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the permission is granted. + public static Task IsGrantedAsync( + this IResourcePermissionChecker resourcePermissionChecker, + string permissionName, + TResource resource, + object resourceKey + ) + { + Check.NotNull(resourcePermissionChecker, nameof(resourcePermissionChecker)); + Check.NotNullOrWhiteSpace(permissionName, nameof(permissionName)); + Check.NotNull(resource, nameof(resource)); + Check.NotNull(resourceKey, nameof(resourceKey)); + + return resourcePermissionChecker.IsGrantedAsync( + permissionName, + typeof(TResource).FullName!, + resourceKey.ToString()! + ); + } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionGrantInfo.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionGrantInfo.cs new file mode 100644 index 0000000000..4eb9604454 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionGrantInfo.cs @@ -0,0 +1,21 @@ +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class ResourcePermissionGrantInfo : PermissionGrantInfo +{ + public string ResourceName { get; } + + public string ResourceKey { get; } + + public ResourcePermissionGrantInfo( + string name, + bool isGranted, + string resourceName, + string resourceKey, + string? providerName = null, + string? providerKey = null) + : base(name, isGranted, providerName, providerKey) + { + ResourceName = resourceName; + ResourceKey = resourceKey; + } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionStoreExtensions.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionStoreExtensions.cs new file mode 100644 index 0000000000..f5604a7683 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionStoreExtensions.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public static class ResourcePermissionStoreExtensions +{ + /// + /// Retrieves the list of granted permissions for a specific resource with a given key. + /// + /// The type of the resource. + /// The resource permission store instance. + /// The resource instance to retrieve permissions for. + /// The unique key identifying the resource instance. + /// A task that represents the asynchronous operation. The task result contains an array of strings representing the granted permissions. + public static async Task GetGrantedPermissionsAsync( + this IResourcePermissionStore resourcePermissionStore, + TResource resource, + object resourceKey + ) + { + return (await GetPermissionsAsync(resourcePermissionStore, resource, resourceKey)).Where(x => x.Value).Select(x => x.Key).ToArray(); + } + + /// + /// Retrieves a dictionary of permissions and their granted status for the specified entity. + /// + /// The type of the resource. + /// The resource permission store instance. + /// The resource for which the permissions are being retrieved. + /// The unique key identifying the resource instance. + /// A dictionary where the keys are permission names and the values are booleans indicating whether the permission is granted. + public static async Task> GetPermissionsAsync( + this IResourcePermissionStore resourcePermissionStore, + TResource resource, + object resourceKey + ) + { + Check.NotNull(resourcePermissionStore, nameof(resourcePermissionStore)); + Check.NotNull(resource, nameof(resource)); + Check.NotNull(resourceKey, nameof(resourceKey)); + + var result = await resourcePermissionStore.GetPermissionsAsync( + typeof(TResource).FullName!, + resourceKey.ToString()! + ); + + return result.Result.ToDictionary(x => x.Key, x => x.Value == PermissionGrantResult.Granted); + } + + /// + /// Retrieves the keys of the resources granted a specific permission. + /// + /// The type of the resource. + /// The resource permission store instance. + /// The resource instance to check granted permissions for. + /// The name of the permission to check. + /// A task that represents the asynchronous operation. The task result contains an array of strings representing the granted resource keys. + public static Task GetGrantedResourceKeysAsync( + this IResourcePermissionStore resourcePermissionStore, + TResource resource, + string permissionName + ) + { + Check.NotNull(resourcePermissionStore, nameof(resourcePermissionStore)); + Check.NotNull(resource, nameof(resource)); + Check.NotNullOrWhiteSpace(permissionName, nameof(permissionName)); + + return resourcePermissionStore.GetGrantedResourceKeysAsync( + typeof(TResource).FullName!, + permissionName + ); + } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueCheckContext.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueCheckContext.cs new file mode 100644 index 0000000000..dc8c78be64 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueCheckContext.cs @@ -0,0 +1,22 @@ +using System.Security.Claims; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class ResourcePermissionValueCheckContext : PermissionValueCheckContext +{ + public string ResourceName { get; } + + public string ResourceKey { get; } + + public ResourcePermissionValueCheckContext(PermissionDefinition permission, string resourceName, string resourceKey) + : this(permission, null, resourceName, resourceKey) + { + } + + public ResourcePermissionValueCheckContext(PermissionDefinition permission, ClaimsPrincipal? principal, string resourceName, string resourceKey) + : base(permission, principal) + { + ResourceName = resourceName; + ResourceKey = resourceKey; + } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueProvider.cs new file mode 100644 index 0000000000..ff53f274ad --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueProvider.cs @@ -0,0 +1,20 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public abstract class ResourcePermissionValueProvider : IResourcePermissionValueProvider, ITransientDependency +{ + public abstract string Name { get; } + + protected IResourcePermissionStore ResourcePermissionStore { get; } + + protected ResourcePermissionValueProvider(IResourcePermissionStore resourcePermissionStore) + { + ResourcePermissionStore = resourcePermissionStore; + } + + public abstract Task CheckAsync(ResourcePermissionValueCheckContext context); + + public abstract Task CheckAsync(ResourcePermissionValuesCheckContext context); +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValuesCheckContext.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValuesCheckContext.cs new file mode 100644 index 0000000000..239f74fc19 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValuesCheckContext.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Security.Claims; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class ResourcePermissionValuesCheckContext : PermissionValuesCheckContext +{ + public string ResourceName { get; } + + public string ResourceKey { get; } + + public ResourcePermissionValuesCheckContext(PermissionDefinition permission,string resourceName, string resourceKey) + : this([permission], null, resourceName, resourceKey) + { + + } + + + public ResourcePermissionValuesCheckContext(PermissionDefinition permission, ClaimsPrincipal? principal, string resourceName, string resourceKey) + : this([permission], principal, resourceName, resourceKey) + { + + } + + public ResourcePermissionValuesCheckContext(List permissions, string resourceName, string resourceKey) + : this(permissions, null, resourceName, resourceKey) + { + ResourceName = resourceName; + ResourceKey = resourceKey; + } + + public ResourcePermissionValuesCheckContext(List permissions, ClaimsPrincipal? principal, string resourceName, string resourceKey) + : base(permissions, principal) + { + ResourceName = resourceName; + ResourceKey = resourceKey; + } +} diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/ResourcePermissionRequirement.cs b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/ResourcePermissionRequirement.cs new file mode 100644 index 0000000000..03658f3e90 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/ResourcePermissionRequirement.cs @@ -0,0 +1,21 @@ +using JetBrains.Annotations; +using Microsoft.AspNetCore.Authorization; + +namespace Volo.Abp.Authorization; + +public class ResourcePermissionRequirement : IAuthorizationRequirement +{ + public string PermissionName { get; } + + public ResourcePermissionRequirement([NotNull] string permissionName) + { + Check.NotNull(permissionName, nameof(permissionName)); + + PermissionName = permissionName; + } + + public override string ToString() + { + return $"ResourcePermissionRequirement: {PermissionName}"; + } +} diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/KeyedObjectResourcePermissionExtenstions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/KeyedObjectResourcePermissionExtenstions.cs new file mode 100644 index 0000000000..e65d5174de --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Microsoft/Extensions/DependencyInjection/KeyedObjectResourcePermissionExtenstions.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Authorization.Permissions.Resources; + +namespace Microsoft.Extensions.DependencyInjection; + +public static class KeyedObjectResourcePermissionExtenstions +{ + public static IServiceCollection AddKeyedObjectResourcePermissionAuthorization(this IServiceCollection services) + { + services.AddSingleton(); + return services; + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs index d8226bdee5..65b7e1b390 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Volo.Abp.Authorization.Localization; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; @@ -32,6 +33,7 @@ public class AbpAuthorizationModule : AbpModule { context.Services.AddAuthorizationCore(); + context.Services.AddKeyedObjectResourcePermissionAuthorization(); context.Services.AddSingleton(); context.Services.AddSingleton(); @@ -42,6 +44,9 @@ public class AbpAuthorizationModule : AbpModule options.ValueProviders.Add(); options.ValueProviders.Add(); options.ValueProviders.Add(); + + options.ResourceValueProviders.Add(); + options.ResourceValueProviders.Add(); }); Configure(options => diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs index 7958f2a979..a5bd19b539 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs @@ -40,6 +40,14 @@ public class AbpAuthorizationPolicyProvider : DefaultAuthorizationPolicyProvider return policyBuilder.Build(); } + if ((await _permissionDefinitionManager.GetResourcePermissionsAsync()).Any(x => x.Name == policyName)) + { + //TODO: Optimize & Cache! + var policyBuilder = new AuthorizationPolicyBuilder(Array.Empty()); + policyBuilder.Requirements.Add(new ResourcePermissionRequirement(policyName)); + return policyBuilder.Build(); + } + return null; } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs index 6316e38f52..6a34b21835 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs @@ -20,7 +20,7 @@ public class MethodInvocationAuthorizationService : IMethodInvocationAuthorizati _abpAuthorizationService = abpAuthorizationService; } - public async Task CheckAsync(MethodInvocationAuthorizationContext context) + public virtual async Task CheckAsync(MethodInvocationAuthorizationContext context) { if (AllowAnonymous(context)) { diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IDynamicPermissionDefinitionStore.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IDynamicPermissionDefinitionStore.cs index 366ae2e58a..597b274035 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IDynamicPermissionDefinitionStore.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IDynamicPermissionDefinitionStore.cs @@ -8,6 +8,10 @@ public interface IDynamicPermissionDefinitionStore Task GetOrNullAsync(string name); Task> GetPermissionsAsync(); - + + Task GetResourcePermissionOrNullAsync(string resourceName, string name); + + Task> GetResourcePermissionsAsync(); + Task> GetGroupsAsync(); -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IStaticPermissionDefinitionStore.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IStaticPermissionDefinitionStore.cs index 4da8423dd3..da4055d771 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IStaticPermissionDefinitionStore.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IStaticPermissionDefinitionStore.cs @@ -8,6 +8,10 @@ public interface IStaticPermissionDefinitionStore Task GetOrNullAsync(string name); Task> GetPermissionsAsync(); - + + Task GetResourcePermissionOrNullAsync(string resourceName, string name); + + Task> GetResourcePermissionsAsync(); + Task> GetGroupsAsync(); -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/NullDynamicPermissionDefinitionStore.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/NullDynamicPermissionDefinitionStore.cs index 5b13288153..cf3a9820b4 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/NullDynamicPermissionDefinitionStore.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/NullDynamicPermissionDefinitionStore.cs @@ -9,10 +9,15 @@ namespace Volo.Abp.Authorization.Permissions; public class NullDynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStore, ISingletonDependency { private readonly static Task CachedPermissionResult = Task.FromResult((PermissionDefinition?)null); - + private readonly static Task> CachedPermissionsResult = Task.FromResult((IReadOnlyList)Array.Empty().ToImmutableList()); + private readonly static Task CachedResourcePermissionResult = Task.FromResult((PermissionDefinition?)null); + + private readonly static Task> CachedResourcePermissionsResult = + Task.FromResult((IReadOnlyList)Array.Empty().ToImmutableList()); + private readonly static Task> CachedGroupsResult = Task.FromResult((IReadOnlyList)Array.Empty().ToImmutableList()); @@ -26,8 +31,18 @@ public class NullDynamicPermissionDefinitionStore : IDynamicPermissionDefinition return CachedPermissionsResult; } + public Task GetResourcePermissionOrNullAsync(string resourceName, string name) + { + return CachedResourcePermissionResult; + } + + public Task> GetResourcePermissionsAsync() + { + return CachedResourcePermissionsResult; + } + public Task> GetGroupsAsync() { return CachedGroupsResult; } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs index 23f9e7883e..3dbc22fb47 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs @@ -34,17 +34,36 @@ public class PermissionDefinitionManager : IPermissionDefinitionManager, ITransi { Check.NotNull(name, nameof(name)); - return await _staticStore.GetOrNullAsync(name) ?? + return await _staticStore.GetOrNullAsync(name) ?? await _dynamicStore.GetOrNullAsync(name); } + public virtual async Task GetResourcePermissionAsync(string resourceName, string name) + { + var permission = await GetResourcePermissionOrNullAsync(resourceName, name); + if (permission == null) + { + throw new AbpException($"Undefined resource permission: {name} for resource: {resourceName}"); + } + + return permission; + } + + public virtual async Task GetResourcePermissionOrNullAsync(string resourceName, string name) + { + Check.NotNull(name, nameof(name)); + + return await _staticStore.GetResourcePermissionOrNullAsync(resourceName, name) ?? + await _dynamicStore.GetResourcePermissionOrNullAsync(resourceName, name); + } + public virtual async Task> GetPermissionsAsync() { var staticPermissions = await _staticStore.GetPermissionsAsync(); var staticPermissionNames = staticPermissions .Select(p => p.Name) .ToImmutableHashSet(); - + var dynamicPermissions = await _dynamicStore.GetPermissionsAsync(); /* We prefer static permissions over dynamics */ @@ -53,13 +72,28 @@ public class PermissionDefinitionManager : IPermissionDefinitionManager, ITransi ).ToImmutableList(); } - public async Task> GetGroupsAsync() + public virtual async Task> GetResourcePermissionsAsync() + { + var staticResourcePermissions = await _staticStore.GetResourcePermissionsAsync(); + var staticResourcePermissionNames = staticResourcePermissions + .Select(p => p.Name) + .ToImmutableHashSet(); + + var dynamicResourcePermissions = await _dynamicStore.GetResourcePermissionsAsync(); + + /* We prefer static permissions over dynamics */ + return staticResourcePermissions.Concat( + dynamicResourcePermissions.Where(d => !staticResourcePermissionNames.Contains(d.Name)) + ).ToImmutableList(); + } + + public virtual async Task> GetGroupsAsync() { var staticGroups = await _staticStore.GetGroupsAsync(); var staticGroupNames = staticGroups .Select(p => p.Name) .ToImmutableHashSet(); - + var dynamicGroups = await _dynamicStore.GetGroupsAsync(); /* We prefer static groups over dynamics */ @@ -67,4 +101,4 @@ public class PermissionDefinitionManager : IPermissionDefinitionManager, ITransi dynamicGroups.Where(d => !staticGroupNames.Contains(d.Name)) ).ToImmutableList(); } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionCheckerExtensions.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionCheckerExtensions.cs new file mode 100644 index 0000000000..e8b9e38218 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionCheckerExtensions.cs @@ -0,0 +1,28 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public static class KeyedObjectResourcePermissionCheckerExtensions +{ + /// + /// Checks if the specified permission is granted for the given resource. + /// + /// The type of the object. + /// The resource permission checker instance. + /// The name of the permission to check. + /// The resource for which the permission is being checked. + /// A task that represents the asynchronous operation. The task result is a boolean indicating whether the permission is granted. + public static Task IsGrantedAsync(this IResourcePermissionChecker resourcePermissionChecker, string permissionName, TResource resource) + where TResource : class, IKeyedObject + { + Check.NotNull(resourcePermissionChecker, nameof(resourcePermissionChecker)); + Check.NotNullOrWhiteSpace(permissionName, nameof(permissionName)); + Check.NotNull(resource, nameof(resource)); + + return resourcePermissionChecker.IsGrantedAsync( + permissionName, + resource, + resource.GetObjectKey() ?? throw new AbpException("The resource doesn't have a key.") + ); + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionRequirementHandler.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionRequirementHandler.cs new file mode 100644 index 0000000000..e43b6d07b5 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionRequirementHandler.cs @@ -0,0 +1,33 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class KeyedObjectResourcePermissionRequirementHandler : AuthorizationHandler +{ + protected readonly IResourcePermissionChecker PermissionChecker; + + public KeyedObjectResourcePermissionRequirementHandler(IResourcePermissionChecker permissionChecker) + { + PermissionChecker = permissionChecker; + } + + protected override async Task HandleRequirementAsync( + AuthorizationHandlerContext context, + ResourcePermissionRequirement requirement, + IKeyedObject? resource) + { + if (resource == null) + { + return; + } + + var resourceName = resource.GetType().FullName!; + var resourceKey = resource.GetObjectKey() ?? throw new AbpException("The resource doesn't have a key."); + + if (await PermissionChecker.IsGrantedAsync(context.User, requirement.PermissionName, resourceName, resourceKey)) + { + context.Succeed(requirement); + } + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionStoreExtensions.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionStoreExtensions.cs new file mode 100644 index 0000000000..3088950510 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/KeyedObjectResourcePermissionStoreExtensions.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public static class KeyedObjectResourcePermissionStoreExtensions +{ + /// + /// Retrieves an array of granted permissions for a specific entity. + /// + /// The type of the resource. + /// The resource permission store instance. + /// The resource for which the permissions are being checked. + /// An array of granted permission names as strings. + public static async Task GetGrantedPermissionsAsync( + this IResourcePermissionStore resourcePermissionStore, + TResource resource + ) + where TResource : class, IKeyedObject + { + Check.NotNull(resourcePermissionStore, nameof(resourcePermissionStore)); + Check.NotNull(resource, nameof(resource)); + + return (await GetPermissionsAsync(resourcePermissionStore, resource)).Where(x => x.Value).Select(x => x.Key).ToArray(); + } + + /// + /// Retrieves a dictionary of permissions and their granted status for the specified entity. + /// + /// The type of the entity. + /// The resource permission store instance. + /// The entity for which the permissions are being retrieved. + /// A dictionary where the keys are permission names and the values are booleans indicating whether the permission is granted. + public static async Task> GetPermissionsAsync( + this IResourcePermissionStore resourcePermissionStore, + TEntity entity + ) + where TEntity : class, IKeyedObject + { + Check.NotNull(resourcePermissionStore, nameof(resourcePermissionStore)); + Check.NotNull(entity, nameof(entity)); + + return await resourcePermissionStore.GetPermissionsAsync( + entity, + entity.GetObjectKey() ?? throw new AbpException("The entity doesn't have a key.") + ); + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionChecker.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionChecker.cs new file mode 100644 index 0000000000..a920c2e464 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionChecker.cs @@ -0,0 +1,173 @@ +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; +using System.Security.Principal; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Security.Claims; +using Volo.Abp.SimpleStateChecking; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class ResourcePermissionChecker : IResourcePermissionChecker, ITransientDependency +{ + protected IPermissionDefinitionManager PermissionDefinitionManager { get; } + protected ICurrentPrincipalAccessor PrincipalAccessor { get; } + protected ICurrentTenant CurrentTenant { get; } + protected IResourcePermissionValueProviderManager PermissionValueProviderManager { get; } + protected ISimpleStateCheckerManager StateCheckerManager { get; } + protected IPermissionChecker PermissionChecker { get; } + + public ResourcePermissionChecker( + ICurrentPrincipalAccessor principalAccessor, + IPermissionDefinitionManager permissionDefinitionManager, + ICurrentTenant currentTenant, + IResourcePermissionValueProviderManager permissionValueProviderManager, + ISimpleStateCheckerManager stateCheckerManager, + IPermissionChecker permissionChecker) + { + PrincipalAccessor = principalAccessor; + PermissionDefinitionManager = permissionDefinitionManager; + CurrentTenant = currentTenant; + PermissionValueProviderManager = permissionValueProviderManager; + StateCheckerManager = stateCheckerManager; + PermissionChecker = permissionChecker; + } + + public virtual async Task IsGrantedAsync(string name, string resourceName, string resourceKey) + { + return await IsGrantedAsync(PrincipalAccessor.Principal, name, resourceName, resourceKey); + } + + public virtual async Task IsGrantedAsync( + ClaimsPrincipal? claimsPrincipal, + string name, + string resourceName, + string resourceKey) + { + Check.NotNull(name, nameof(name)); + + var permission = await PermissionDefinitionManager.GetResourcePermissionOrNullAsync(resourceName, name); + if (permission == null) + { + return false; + } + + if (!permission.IsEnabled) + { + return false; + } + + if (!await StateCheckerManager.IsEnabledAsync(permission)) + { + return false; + } + + var multiTenancySide = claimsPrincipal?.GetMultiTenancySide() + ?? CurrentTenant.GetMultiTenancySide(); + + if (!permission.MultiTenancySide.HasFlag(multiTenancySide)) + { + return false; + } + + var isGranted = false; + var context = new ResourcePermissionValueCheckContext(permission, claimsPrincipal, resourceName, resourceKey); + foreach (var provider in PermissionValueProviderManager.ValueProviders) + { + if (context.Permission.Providers.Any() && + !context.Permission.Providers.Contains(provider.Name)) + { + continue; + } + + var result = await provider.CheckAsync(context); + + if (result == PermissionGrantResult.Granted) + { + isGranted = true; + } + else if (result == PermissionGrantResult.Prohibited) + { + return false; + } + } + + return isGranted; + } + + public async Task IsGrantedAsync(string[] names, string resourceName, string resourceKey) + { + return await IsGrantedAsync(PrincipalAccessor.Principal, names, resourceName, resourceKey); + } + + public async Task IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, string[] names, string resourceName, string resourceKey) + { + Check.NotNull(names, nameof(names)); + + var result = new MultiplePermissionGrantResult(); + if (!names.Any()) + { + return result; + } + + var multiTenancySide = claimsPrincipal?.GetMultiTenancySide() ?? + CurrentTenant.GetMultiTenancySide(); + + var permissionDefinitions = new List(); + foreach (var name in names) + { + var permission = await PermissionDefinitionManager.GetResourcePermissionOrNullAsync(resourceName, name); + if (permission == null) + { + result.Result.Add(name, PermissionGrantResult.Prohibited); + continue; + } + + result.Result.Add(name, PermissionGrantResult.Undefined); + + if (permission.IsEnabled && + await StateCheckerManager.IsEnabledAsync(permission) && + permission.MultiTenancySide.HasFlag(multiTenancySide)) + { + permissionDefinitions.Add(permission); + } + } + + foreach (var provider in PermissionValueProviderManager.ValueProviders) + { + var permissions = permissionDefinitions + .Where(x => !x.Providers.Any() || x.Providers.Contains(provider.Name)) + .ToList(); + + if (permissions.IsNullOrEmpty()) + { + continue; + } + + var context = new ResourcePermissionValuesCheckContext( + permissions, + claimsPrincipal, + resourceName, + resourceKey); + + var multipleResult = await provider.CheckAsync(context); + foreach (var grantResult in multipleResult.Result.Where(grantResult => + result.Result.ContainsKey(grantResult.Key) && + result.Result[grantResult.Key] == PermissionGrantResult.Undefined && + grantResult.Value != PermissionGrantResult.Undefined)) + { + result.Result[grantResult.Key] = grantResult.Value; + permissionDefinitions.RemoveAll(x => x.Name == grantResult.Key); + } + + if (result.AllGranted || result.AllProhibited) + { + break; + } + } + + return result; + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionPopulator.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionPopulator.cs new file mode 100644 index 0000000000..91dfb509d4 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionPopulator.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class ResourcePermissionPopulator : ITransientDependency +{ + protected IPermissionDefinitionManager PermissionDefinitionManager { get; } + protected IResourcePermissionChecker ResourcePermissionChecker { get; } + protected IResourcePermissionStore ResourcePermissionStore { get; } + protected IPermissionChecker PermissionChecker { get; } + + public ResourcePermissionPopulator( + IPermissionDefinitionManager permissionDefinitionManager, + IResourcePermissionChecker resourcePermissionChecker, + IResourcePermissionStore resourcePermissionStore, + IPermissionChecker permissionChecker) + { + PermissionDefinitionManager = permissionDefinitionManager; + ResourcePermissionChecker = resourcePermissionChecker; + ResourcePermissionStore = resourcePermissionStore; + PermissionChecker = permissionChecker; + } + + public virtual async Task PopulateAsync(TResource resource, string resourceName) + where TResource : IHasResourcePermissions + { + await PopulateAsync([resource], resourceName); + } + + public virtual async Task PopulateAsync(List resources, string resourceName) + where TResource : IHasResourcePermissions + { + Check.NotNull(resources, nameof(resources)); + Check.NotNullOrWhiteSpace(resourceName, nameof(resourceName)); + + var resopurcePermissions = (await PermissionDefinitionManager.GetResourcePermissionsAsync()) + .Where(x => x.ResourceName == resourceName) + .ToArray(); + + foreach (var resource in resources) + { + var resourceKey = resource.GetObjectKey(); + if (resourceKey.IsNullOrEmpty()) + { + throw new AbpException("Resource key can not be null or empty."); + } + + var results = await ResourcePermissionChecker.IsGrantedAsync(resopurcePermissions.Select(x => x.Name).ToArray(), resourceName, resourceKey); + foreach (var resopurcePermission in resopurcePermissions) + { + if (resource.ResourcePermissions == null) + { + ObjectHelper.TrySetProperty(resource, x => x.ResourcePermissions, () => new Dictionary()); + } + + var hasPermission = results.Result.TryGetValue(resopurcePermission.Name, out var granted) && granted == PermissionGrantResult.Granted; + resource.ResourcePermissions![resopurcePermission.Name] = hasPermission; + } + } + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueProviderManager.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueProviderManager.cs new file mode 100644 index 0000000000..bab3180fea --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/ResourcePermissionValueProviderManager.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class ResourcePermissionValueProviderManager : IResourcePermissionValueProviderManager, ISingletonDependency +{ + public IReadOnlyList ValueProviders => _lazyProviders.Value; + private readonly Lazy> _lazyProviders; + + protected AbpPermissionOptions Options { get; } + protected IServiceProvider ServiceProvider { get; } + + public ResourcePermissionValueProviderManager( + IServiceProvider serviceProvider, + IOptions options) + { + Options = options.Value; + ServiceProvider = serviceProvider; + + _lazyProviders = new Lazy>(GetProviders, true); + } + + protected virtual List GetProviders() + { + var providers = Options + .ResourceValueProviders + .Select(type => (ServiceProvider.GetRequiredService(type) as IResourcePermissionValueProvider)!) + .ToList(); + + var multipleProviders = providers.GroupBy(p => p.Name).FirstOrDefault(x => x.Count() > 1); + if(multipleProviders != null) + { + throw new AbpException($"Duplicate resource permission value provider name detected: {multipleProviders.Key}. Providers:{Environment.NewLine}{multipleProviders.Select(p => p.GetType().FullName!).JoinAsString(Environment.NewLine)}"); + } + + return providers; + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/RoleResourcePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/RoleResourcePermissionValueProvider.cs new file mode 100644 index 0000000000..fc8e91e794 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/RoleResourcePermissionValueProvider.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Security.Claims; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class RoleResourcePermissionValueProvider : ResourcePermissionValueProvider +{ + public const string ProviderName = "R"; + + public override string Name => ProviderName; + + public RoleResourcePermissionValueProvider(IResourcePermissionStore resourcePermissionStore) + : base(resourcePermissionStore) + { + + } + + public override async Task CheckAsync(ResourcePermissionValueCheckContext context) + { + var roles = context.Principal?.FindAll(AbpClaimTypes.Role).Select(c => c.Value).ToArray(); + + if (roles == null || !roles.Any()) + { + return PermissionGrantResult.Undefined; + } + + foreach (var role in roles.Distinct()) + { + if (await ResourcePermissionStore.IsGrantedAsync(context.Permission.Name, context.ResourceName, context.ResourceKey, Name, role)) + { + return PermissionGrantResult.Granted; + } + } + + return PermissionGrantResult.Undefined; + } + + public override async Task CheckAsync(ResourcePermissionValuesCheckContext context) + { + var permissionNames = context.Permissions.Select(x => x.Name).Distinct().ToList(); + Check.NotNullOrEmpty(permissionNames, nameof(permissionNames)); + + var result = new MultiplePermissionGrantResult(permissionNames.ToArray()); + + var roles = context.Principal?.FindAll(AbpClaimTypes.Role).Select(c => c.Value).ToArray(); + if (roles == null || !roles.Any()) + { + return result; + } + + foreach (var role in roles.Distinct()) + { + var multipleResult = await ResourcePermissionStore.IsGrantedAsync(permissionNames.ToArray(), context.ResourceName, context.ResourceKey, Name, role); + + foreach (var grantResult in multipleResult.Result.Where(grantResult => + result.Result.ContainsKey(grantResult.Key) && + result.Result[grantResult.Key] == PermissionGrantResult.Undefined && + grantResult.Value != PermissionGrantResult.Undefined)) + { + result.Result[grantResult.Key] = grantResult.Value; + permissionNames.RemoveAll(x => x == grantResult.Key); + } + + if (result.AllGranted || result.AllProhibited) + { + break; + } + + if (permissionNames.IsNullOrEmpty()) + { + break; + } + } + + return result; + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/UserResourcePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/UserResourcePermissionValueProvider.cs new file mode 100644 index 0000000000..8cfcb8ca6f --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/Resources/UserResourcePermissionValueProvider.cs @@ -0,0 +1,46 @@ +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Security.Claims; + +namespace Volo.Abp.Authorization.Permissions.Resources; + +public class UserResourcePermissionValueProvider : ResourcePermissionValueProvider +{ + public const string ProviderName = "U"; + + public override string Name => ProviderName; + + public UserResourcePermissionValueProvider(IResourcePermissionStore resourcePermissionStore) + : base(resourcePermissionStore) + { + + } + + public override async Task CheckAsync(ResourcePermissionValueCheckContext context) + { + var userId = context.Principal?.FindFirst(AbpClaimTypes.UserId)?.Value; + + if (userId == null) + { + return PermissionGrantResult.Undefined; + } + + return await ResourcePermissionStore.IsGrantedAsync(context.Permission.Name, context.ResourceName, context.ResourceKey, Name, userId) + ? PermissionGrantResult.Granted + : PermissionGrantResult.Undefined; + } + + public override async Task CheckAsync(ResourcePermissionValuesCheckContext context) + { + var permissionNames = context.Permissions.Select(x => x.Name).Distinct().ToArray(); + Check.NotNullOrEmpty(permissionNames, nameof(permissionNames)); + + var userId = context.Principal?.FindFirst(AbpClaimTypes.UserId)?.Value; + if (userId == null) + { + return new MultiplePermissionGrantResult(permissionNames); + } + + return await ResourcePermissionStore.IsGrantedAsync(permissionNames, context.ResourceName, context.ResourceKey, Name, userId); + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/StaticPermissionDefinitionStore.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/StaticPermissionDefinitionStore.cs index 8329fde12e..2f95f3fef6 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/StaticPermissionDefinitionStore.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/StaticPermissionDefinitionStore.cs @@ -14,13 +14,13 @@ public class StaticPermissionDefinitionStore : IStaticPermissionDefinitionStore, { protected IServiceProvider ServiceProvider { get; } protected AbpPermissionOptions Options { get; } - protected IStaticDefinitionCache> GroupCache { get; } + protected IStaticDefinitionCache, List)> GroupCache { get; } protected IStaticDefinitionCache> DefinitionCache { get; } public StaticPermissionDefinitionStore( IServiceProvider serviceProvider, IOptions options, - IStaticDefinitionCache> groupCache, + IStaticDefinitionCache, List)> groupCache, IStaticDefinitionCache> definitionCache) { ServiceProvider = serviceProvider; @@ -41,56 +41,35 @@ public class StaticPermissionDefinitionStore : IStaticPermissionDefinitionStore, return defs.Values.ToImmutableList(); } - public async Task> GetGroupsAsync() + public virtual async Task GetResourcePermissionOrNullAsync(string resourceName, string name) { - var groups = await GetPermissionGroupDefinitionsAsync(); - return groups.Values.ToImmutableList(); + var (_, resourcePermissions) = await GetPermissionGroupDefinitionsAsync(); + return resourcePermissions.FirstOrDefault(p => p.ResourceName == resourceName && p.Name == name); } - protected virtual async Task> GetPermissionDefinitionsAsync() + public virtual async Task> GetResourcePermissionsAsync() { - return await DefinitionCache.GetOrCreateAsync(CreatePermissionDefinitionsAsync); + var (_, resourcePermissions) = await GetPermissionGroupDefinitionsAsync(); + return resourcePermissions.ToImmutableList(); } - protected virtual async Task> CreatePermissionDefinitionsAsync() + public async Task> GetGroupsAsync() { - var permissions = new Dictionary(); - - var groups = await GetPermissionGroupDefinitionsAsync(); - foreach (var groupDefinition in groups.Values) - { - foreach (var permission in groupDefinition.Permissions) - { - AddPermissionToDictionaryRecursively(permissions, permission); - } - } - - return permissions; + var (groups, _) = await GetPermissionGroupDefinitionsAsync(); + return groups.Values.ToImmutableList(); } - protected virtual void AddPermissionToDictionaryRecursively( - Dictionary permissions, - PermissionDefinition permission) + protected virtual async Task<(Dictionary, List)> GetPermissionGroupDefinitionsAsync() { - if (permissions.ContainsKey(permission.Name)) - { - throw new AbpException("Duplicate permission name: " + permission.Name); - } - - permissions[permission.Name] = permission; - - foreach (var child in permission.Children) - { - AddPermissionToDictionaryRecursively(permissions, child); - } + return await GroupCache.GetOrCreateAsync(CreatePermissionGroupDefinitionsAsync); } - protected virtual async Task> GetPermissionGroupDefinitionsAsync() + protected virtual async Task> GetPermissionDefinitionsAsync() { - return await GroupCache.GetOrCreateAsync(CreatePermissionGroupDefinitionsAsync); + return await DefinitionCache.GetOrCreateAsync(CreatePermissionDefinitionsAsync); } - protected virtual Task> CreatePermissionGroupDefinitionsAsync() + protected virtual Task<(Dictionary, List)> CreatePermissionGroupDefinitionsAsync() { using (var scope = ServiceProvider.CreateScope()) { @@ -121,7 +100,40 @@ public class StaticPermissionDefinitionStore : IStaticPermissionDefinitionStore, context.CurrentProvider = null; - return Task.FromResult(context.Groups); + return Task.FromResult((context.Groups, context.ResourcePermissions)); + } + } + + protected virtual async Task> CreatePermissionDefinitionsAsync() + { + var permissions = new Dictionary(); + + var (groups, _) = await GetPermissionGroupDefinitionsAsync(); + foreach (var groupDefinition in groups.Values) + { + foreach (var permission in groupDefinition.Permissions) + { + AddPermissionToDictionaryRecursively(permissions, permission); + } + } + + return permissions; + } + + protected virtual void AddPermissionToDictionaryRecursively( + Dictionary permissions, + PermissionDefinition permission) + { + if (permissions.ContainsKey(permission.Name)) + { + throw new AbpException("Duplicate permission name: " + permission.Name); + } + + permissions[permission.Name] = permission; + + foreach (var child in permission.Children) + { + AddPermissionToDictionaryRecursively(permissions, child); } } } diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj b/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj index 4a360e8389..fe6a6a9708 100644 --- a/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj +++ b/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj @@ -17,6 +17,7 @@ + diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ClientConfig.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ClientConfig.cs index 19db1beef7..2328018b74 100644 --- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ClientConfig.cs +++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ClientConfig.cs @@ -1,3 +1,4 @@ +using Azure.Core; using Azure.Messaging.ServiceBus; using Azure.Messaging.ServiceBus.Administration; @@ -5,7 +6,7 @@ namespace Volo.Abp.AzureServiceBus; public class ClientConfig { - public string ConnectionString { get; set; } = default!; + public string? ConnectionString { get; set; } public ServiceBusAdministrationClientOptions Admin { get; set; } = new(); @@ -15,4 +16,8 @@ public class ClientConfig { AutoCompleteMessages = false }; + + public TokenCredential? TokenCredential { get; set; } + + public string? FullyQualifiedNamespace { get; set; } } diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs index df830cde7a..ee4bfdf011 100644 --- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs +++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.Linq; using System.Threading.Tasks; +using Azure.Identity; using Azure.Messaging.ServiceBus; using Azure.Messaging.ServiceBus.Administration; using Microsoft.Extensions.Logging; @@ -35,7 +36,17 @@ public class ConnectionPool : IConnectionPool, ISingletonDependency connectionName, new Lazy(() => { var config = _options.Connections.GetOrDefault(connectionName); - return new ServiceBusClient(config.ConnectionString, config.Client); + if (!config.ConnectionString.IsNullOrWhiteSpace()) + { + return new ServiceBusClient(config.ConnectionString, config.Client); + } + + if (!config.FullyQualifiedNamespace.IsNullOrWhiteSpace() && config.TokenCredential != null) + { + return new ServiceBusClient(config.FullyQualifiedNamespace, config.TokenCredential, config.Client); + } + + throw new InvalidOperationException($"{connectionName} does not have a valid Service Bus connection configuration."); }) ).Value; } @@ -47,7 +58,17 @@ public class ConnectionPool : IConnectionPool, ISingletonDependency connectionName, new Lazy(() => { var config = _options.Connections.GetOrDefault(connectionName); - return new ServiceBusAdministrationClient(config.ConnectionString, config.Admin); + if (!config.ConnectionString.IsNullOrWhiteSpace()) + { + return new ServiceBusAdministrationClient(config.ConnectionString, config.Admin); + } + + if (!config.FullyQualifiedNamespace.IsNullOrWhiteSpace() && config.TokenCredential != null) + { + return new ServiceBusAdministrationClient(config.FullyQualifiedNamespace, config.TokenCredential, config.Admin); + } + + throw new InvalidOperationException($"{connectionName} does not have a valid Service Bus connection configuration."); }) ).Value; } diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xml new file mode 100644 index 0000000000..1715698ccd --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xsd new file mode 100644 index 0000000000..ffa6fc4b78 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj new file mode 100644 index 0000000000..df450f5ff6 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj @@ -0,0 +1,24 @@ + + + + + + + netstandard2.1;net8.0;net9.0;net10.0 + enable + Nullable + Volo.Abp.BackgroundJobs.TickerQ + Volo.Abp.BackgroundJobs.TickerQ + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs new file mode 100644 index 0000000000..b5ed598932 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using Volo.Abp.Modularity; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +[DependsOn( + typeof(AbpBackgroundJobsAbstractionsModule), + typeof(AbpTickerQModule) +)] +public class AbpBackgroundJobsTickerQModule : AbpModule +{ + private static readonly MethodInfo GetTickerFunctionDelegateMethod = + typeof(AbpBackgroundJobsTickerQModule).GetMethod(nameof(GetTickerFunctionDelegate), BindingFlags.NonPublic | BindingFlags.Static)!; + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var abpBackgroundJobOptions = context.ServiceProvider.GetRequiredService>(); + var abpBackgroundJobsTickerQOptions = context.ServiceProvider.GetRequiredService>(); + var tickerFunctionDelegates = new Dictionary(); + var requestTypes = new Dictionary(); + foreach (var jobConfiguration in abpBackgroundJobOptions.Value.GetJobs()) + { + var genericMethod = GetTickerFunctionDelegateMethod.MakeGenericMethod(jobConfiguration.ArgsType); + var tickerFunctionDelegate = (TickerFunctionDelegate)genericMethod.Invoke(null, [jobConfiguration.ArgsType])!; + var config = abpBackgroundJobsTickerQOptions.Value.GetConfigurationOrNull(jobConfiguration.JobType); + tickerFunctionDelegates.TryAdd(jobConfiguration.JobName, (string.Empty, config?.Priority ?? TickerTaskPriority.Normal, tickerFunctionDelegate)); + requestTypes.TryAdd(jobConfiguration.JobName, (jobConfiguration.ArgsType.FullName, jobConfiguration.ArgsType)!); + } + + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + foreach (var functionDelegate in tickerFunctionDelegates) + { + abpTickerQFunctionProvider.Functions.TryAdd(functionDelegate.Key, functionDelegate.Value); + } + + foreach (var requestType in requestTypes) + { + abpTickerQFunctionProvider.RequestTypes.TryAdd(requestType.Key, requestType.Value); + } + } + + private static TickerFunctionDelegate GetTickerFunctionDelegate(Type argsType) + { + return async (cancellationToken, serviceProvider, context) => + { + var options = serviceProvider.GetRequiredService>().Value; + if (!options.IsJobExecutionEnabled) + { + throw new AbpException( + "Background job execution is disabled. " + + "This method should not be called! " + + "If you want to enable the background job execution, " + + $"set {nameof(AbpBackgroundJobOptions)}.{nameof(AbpBackgroundJobOptions.IsJobExecutionEnabled)} to true! " + + "If you've intentionally disabled job execution and this seems a bug, please report it." + ); + } + + using (var scope = serviceProvider.CreateScope()) + { + var jobExecuter = serviceProvider.GetRequiredService(); + var args = await TickerRequestProvider.GetRequestAsync(serviceProvider, context.Id, context.Type); + var jobType = options.GetJob(typeof(TArgs)).JobType; + var jobExecutionContext = new JobExecutionContext(scope.ServiceProvider, jobType, args!, cancellationToken: cancellationToken); + await jobExecuter.ExecuteAsync(jobExecutionContext); + } + }; + } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQOptions.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQOptions.cs new file mode 100644 index 0000000000..f85b3e5fef --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQOptions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +public class AbpBackgroundJobsTickerQOptions +{ + private readonly Dictionary _configurations; + + public AbpBackgroundJobsTickerQOptions() + { + _configurations = new Dictionary(); + } + + public void AddConfiguration(AbpBackgroundJobsTimeTickerConfiguration configuration) + { + AddConfiguration(typeof(TJob), configuration); + } + + public void AddConfiguration(Type jobType, AbpBackgroundJobsTimeTickerConfiguration configuration) + { + _configurations[jobType] = configuration; + } + + public AbpBackgroundJobsTimeTickerConfiguration? GetConfigurationOrNull() + { + return GetConfigurationOrNull(typeof(TJob)); + } + + public AbpBackgroundJobsTimeTickerConfiguration? GetConfigurationOrNull(Type jobType) + { + return _configurations.GetValueOrDefault(jobType); + } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs new file mode 100644 index 0000000000..65b150ea48 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using TickerQ.Utilities.Enums; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +public class AbpBackgroundJobsTimeTickerConfiguration +{ + public int? Retries { get; set; } + + public int[]? RetryIntervals { get; set; } + + public TickerTaskPriority? Priority { get; set; } + + public Guid? BatchParent { get; set; } + + public BatchRunCondition? BatchRunCondition { get; set; } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs new file mode 100644 index 0000000000..b1a2dbe36d --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs @@ -0,0 +1,51 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using TickerQ.Utilities; +using TickerQ.Utilities.Interfaces.Managers; +using TickerQ.Utilities.Models.Ticker; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +[Dependency(ReplaceServices = true)] +public class AbpTickerQBackgroundJobManager : IBackgroundJobManager, ITransientDependency +{ + protected ITimeTickerManager TimeTickerManager { get; } + protected AbpBackgroundJobOptions Options { get; } + protected AbpBackgroundJobsTickerQOptions TickerQOptions { get; } + + public AbpTickerQBackgroundJobManager( + ITimeTickerManager timeTickerManager, + IOptions options, + IOptions tickerQOptions) + { + TimeTickerManager = timeTickerManager; + Options = options.Value; + TickerQOptions = tickerQOptions.Value; + } + + public virtual async Task EnqueueAsync(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) + { + var job = Options.GetJob(typeof(TArgs)); + var timeTicker = new TimeTicker + { + Id = Guid.NewGuid(), + Function = job.JobName, + ExecutionTime = delay == null ? DateTime.UtcNow : DateTime.UtcNow.Add(delay.Value), + Request = TickerHelper.CreateTickerRequest(args), + }; + + var config = TickerQOptions.GetConfigurationOrNull(job.JobType); + if (config != null) + { + timeTicker.Retries = config.Retries ?? timeTicker.Retries; + timeTicker.RetryIntervals = config.RetryIntervals ?? timeTicker.RetryIntervals; + timeTicker.BatchParent = config.BatchParent ?? timeTicker.BatchParent; + timeTicker.BatchRunCondition = config.BatchRunCondition ?? timeTicker.BatchRunCondition; + } + + var result = await TimeTickerManager.AddAsync(timeTicker); + return !result.IsSucceded ? timeTicker.Id.ToString() : result.Result.Id.ToString(); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xml new file mode 100644 index 0000000000..1715698ccd --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xsd new file mode 100644 index 0000000000..ffa6fc4b78 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj new file mode 100644 index 0000000000..2c4ab29c97 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj @@ -0,0 +1,24 @@ + + + + + + + netstandard2.1;net8.0;net9.0;net10.0 + enable + Nullable + Volo.Abp.BackgroundWorkers.TickerQ + Volo.Abp.BackgroundWorkers.TickerQ + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersCronTickerConfiguration.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersCronTickerConfiguration.cs new file mode 100644 index 0000000000..0e8ed89a14 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersCronTickerConfiguration.cs @@ -0,0 +1,12 @@ +using TickerQ.Utilities.Enums; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpBackgroundWorkersCronTickerConfiguration +{ + public int? Retries { get; set; } + + public int[]? RetryIntervals { get; set; } + + public TickerTaskPriority? Priority { get; set; } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs new file mode 100644 index 0000000000..3fb15a50b8 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs @@ -0,0 +1,37 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using TickerQ.Utilities.Interfaces.Managers; +using TickerQ.Utilities.Models.Ticker; +using Volo.Abp.Modularity; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +[DependsOn(typeof(AbpBackgroundWorkersModule), typeof(AbpTickerQModule))] +public class AbpBackgroundWorkersTickerQModule : AbpModule +{ + public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context) + { + var abpTickerQBackgroundWorkersProvider = context.ServiceProvider.GetRequiredService(); + var cronTickerManager = context.ServiceProvider.GetRequiredService>(); + var abpBackgroundWorkersTickerQOptions = context.ServiceProvider.GetRequiredService>().Value; + foreach (var backgroundWorker in abpTickerQBackgroundWorkersProvider.BackgroundWorkers) + { + var cronTicker = new CronTicker + { + Function = backgroundWorker.Value.Function, + Expression = backgroundWorker.Value.CronExpression + }; + + var config = abpBackgroundWorkersTickerQOptions.GetConfigurationOrNull(backgroundWorker.Value.WorkerType); + if (config != null) + { + cronTicker.Retries = config.Retries ?? cronTicker.Retries; + cronTicker.RetryIntervals = config.RetryIntervals ?? cronTicker.RetryIntervals; + } + + await cronTickerManager.AddAsync(cronTicker); + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQOptions.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQOptions.cs new file mode 100644 index 0000000000..6d48a21262 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQOptions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpBackgroundWorkersTickerQOptions +{ + private readonly Dictionary _onfigurations; + + public AbpBackgroundWorkersTickerQOptions() + { + _onfigurations = new Dictionary(); + } + + public void AddConfiguration(AbpBackgroundWorkersCronTickerConfiguration configuration) + { + AddConfiguration(typeof(TWorker), configuration); + } + + public void AddConfiguration(Type workerType, AbpBackgroundWorkersCronTickerConfiguration configuration) + { + _onfigurations[workerType] = configuration; + } + + public AbpBackgroundWorkersCronTickerConfiguration? GetConfigurationOrNull() + { + return GetConfigurationOrNull(typeof(TJob)); + } + + public AbpBackgroundWorkersCronTickerConfiguration? GetConfigurationOrNull(Type workerType) + { + return _onfigurations.GetValueOrDefault(workerType); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkerManager.cs new file mode 100644 index 0000000000..922cad294d --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkerManager.cs @@ -0,0 +1,105 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using TickerQ.Utilities.Enums; +using Volo.Abp.DependencyInjection; +using Volo.Abp.DynamicProxy; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +[Dependency(ReplaceServices = true)] +public class AbpTickerQBackgroundWorkerManager : BackgroundWorkerManager, ISingletonDependency +{ + protected AbpTickerQFunctionProvider AbpTickerQFunctionProvider { get; } + protected AbpTickerQBackgroundWorkersProvider AbpTickerQBackgroundWorkersProvider { get; } + protected AbpBackgroundWorkersTickerQOptions Options { get; } + + public AbpTickerQBackgroundWorkerManager( + AbpTickerQFunctionProvider abpTickerQFunctionProvider, + AbpTickerQBackgroundWorkersProvider abpTickerQBackgroundWorkersProvider, + IOptions options) + { + AbpTickerQFunctionProvider = abpTickerQFunctionProvider; + AbpTickerQBackgroundWorkersProvider = abpTickerQBackgroundWorkersProvider; + Options = options.Value; + } + + public override async Task AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default) + { + if (worker is AsyncPeriodicBackgroundWorkerBase or PeriodicBackgroundWorkerBase) + { + int? period = null; + string? cronExpression = null; + + if (worker is AsyncPeriodicBackgroundWorkerBase asyncPeriodicBackgroundWorkerBase) + { + period = asyncPeriodicBackgroundWorkerBase.Period; + cronExpression = asyncPeriodicBackgroundWorkerBase.CronExpression; + } + else if (worker is PeriodicBackgroundWorkerBase periodicBackgroundWorkerBase) + { + period = periodicBackgroundWorkerBase.Period; + cronExpression = periodicBackgroundWorkerBase.CronExpression; + } + + if (period == null && cronExpression.IsNullOrWhiteSpace()) + { + throw new AbpException($"Both 'Period' and 'CronExpression' are not set for {worker.GetType().FullName}. You must set at least one of them."); + } + + cronExpression = cronExpression ?? GetCron(period!.Value); + var name = BackgroundWorkerNameAttribute.GetNameOrNull(worker.GetType()) ?? worker.GetType().FullName; + + var config = Options.GetConfigurationOrNull(ProxyHelper.GetUnProxiedType(worker)); + AbpTickerQFunctionProvider.Functions.TryAdd(name!, (string.Empty, config?.Priority ?? TickerTaskPriority.LongRunning, async (tickerQCancellationToken, serviceProvider, tickerFunctionContext) => + { + var workerInvoker = new AbpTickerQPeriodicBackgroundWorkerInvoker(worker, serviceProvider); + await workerInvoker.DoWorkAsync(tickerFunctionContext, tickerQCancellationToken); + })); + + AbpTickerQBackgroundWorkersProvider.BackgroundWorkers.Add(name!, new AbpTickerQCronBackgroundWorker + { + Function = name!, + CronExpression = cronExpression, + WorkerType = ProxyHelper.GetUnProxiedType(worker) + }); + } + + await base.AddAsync(worker, cancellationToken); + } + + protected virtual string GetCron(int period) + { + var time = TimeSpan.FromMilliseconds(period); + if (time.TotalMinutes < 1) + { + // Less than 1 minute — 5-field cron doesn't support seconds, so run every minute + return "* * * * *"; + } + + if (time.TotalMinutes < 60) + { + // Run every N minutes + var minutes = (int)Math.Round(time.TotalMinutes); + return $"*/{minutes} * * * *"; + } + + if (time.TotalHours < 24) + { + // Run every N hours + var hours = (int)Math.Round(time.TotalHours); + return $"0 */{hours} * * *"; + } + + if (time.TotalDays <= 31) + { + // Run every N days + var days = (int)Math.Round(time.TotalDays); + return $"0 0 */{days} * *"; + } + + throw new AbpException($"Cannot convert period: {period} to cron expression."); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkersProvider.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkersProvider.cs new file mode 100644 index 0000000000..3c0fe763ec --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkersProvider.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpTickerQBackgroundWorkersProvider : ISingletonDependency +{ + public Dictionary BackgroundWorkers { get;} + + public AbpTickerQBackgroundWorkersProvider() + { + BackgroundWorkers = new Dictionary(); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQCronBackgroundWorker.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQCronBackgroundWorker.cs new file mode 100644 index 0000000000..55c97a00a6 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQCronBackgroundWorker.cs @@ -0,0 +1,12 @@ +using System; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpTickerQCronBackgroundWorker +{ + public string Function { get; set; } = null!; + + public string CronExpression { get; set; } = null!; + + public Type WorkerType { get; set; } = null!; +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs new file mode 100644 index 0000000000..17cf7cdc87 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs @@ -0,0 +1,73 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using TickerQ.Utilities.Models; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpTickerQPeriodicBackgroundWorkerInvoker +{ + private readonly Func? _doWorkAsyncDelegate; + private readonly Action? _doWorkDelegate; + + protected IBackgroundWorker Worker { get; } + protected IServiceProvider ServiceProvider { get; } + + public AbpTickerQPeriodicBackgroundWorkerInvoker(IBackgroundWorker worker, IServiceProvider serviceProvider) + { + Worker = worker; + ServiceProvider = serviceProvider; + + switch (worker) + { + case AsyncPeriodicBackgroundWorkerBase: + { + var workerType = worker.GetType(); + var method = workerType.GetMethod("DoWorkAsync", BindingFlags.Instance | BindingFlags.NonPublic); + if (method == null) + { + throw new AbpException($"Could not find 'DoWorkAsync' method on type '{workerType.FullName}'."); + } + + var instanceParam = Expression.Parameter(typeof(AsyncPeriodicBackgroundWorkerBase), "worker"); + var contextParam = Expression.Parameter(typeof(PeriodicBackgroundWorkerContext), "context"); + var call = Expression.Call(Expression.Convert(instanceParam, workerType), method, contextParam); + var lambda = Expression.Lambda>(call, instanceParam, contextParam); + _doWorkAsyncDelegate = lambda.Compile(); + break; + } + case PeriodicBackgroundWorkerBase: + { + var workerType = worker.GetType(); + var method = workerType.GetMethod("DoWork", BindingFlags.Instance | BindingFlags.NonPublic); + if (method == null) + { + throw new AbpException($"Could not find 'DoWork' method on type '{workerType.FullName}'."); + } + + var instanceParam = Expression.Parameter(typeof(PeriodicBackgroundWorkerBase), "worker"); + var contextParam = Expression.Parameter(typeof(PeriodicBackgroundWorkerContext), "context"); + var call = Expression.Call(Expression.Convert(instanceParam, workerType), method, contextParam); + var lambda = Expression.Lambda>(call, instanceParam, contextParam); + _doWorkDelegate = lambda.Compile(); + break; + } + } + } + + public virtual async Task DoWorkAsync(TickerFunctionContext context, CancellationToken cancellationToken = default) + { + var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider); + switch (Worker) + { + case AsyncPeriodicBackgroundWorkerBase asyncPeriodicBackgroundWorker: + await _doWorkAsyncDelegate!(asyncPeriodicBackgroundWorker, workerContext); + break; + case PeriodicBackgroundWorkerBase periodicBackgroundWorker: + _doWorkDelegate!(periodicBackgroundWorker, workerContext); + break; + } + } +} diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Microsoft/Extensions/DependencyInjection/MinioHttpClientFactoryServiceCollectionExtensions.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Microsoft/Extensions/DependencyInjection/MinioHttpClientFactoryServiceCollectionExtensions.cs new file mode 100644 index 0000000000..8838a1a7f1 --- /dev/null +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Microsoft/Extensions/DependencyInjection/MinioHttpClientFactoryServiceCollectionExtensions.cs @@ -0,0 +1,18 @@ +using System.Net.Http; + +namespace Microsoft.Extensions.DependencyInjection; +internal static class MinioHttpClientFactoryServiceCollectionExtensions +{ + private const string HttpClientName = "__MinioApiClient"; + public static IServiceCollection AddMinioHttpClient(this IServiceCollection services) + { + services.AddHttpClient(HttpClientName); + + return services; + } + + public static HttpClient CreateMinioHttpClient(this IHttpClientFactory httpClientFactory) + { + return httpClientFactory.CreateClient(HttpClientName); + } +} diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj index 0b5f33e146..98d3481999 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj @@ -18,6 +18,7 @@ + diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs index 31d023ecf2..b1746a0e34 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs @@ -1,9 +1,13 @@ -using Volo.Abp.Modularity; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; namespace Volo.Abp.BlobStoring.Minio; [DependsOn(typeof(AbpBlobStoringModule))] public class AbpBlobStoringMinioModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddMinioHttpClient(); + } } diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index 5fa1ceb0ce..82490c177a 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -1,22 +1,27 @@ -using Minio; -using Minio.Exceptions; -using System; +using System; using System.IO; +using System.Net.Http; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Minio; using Minio.DataModel.Args; +using Minio.Exceptions; using Volo.Abp.DependencyInjection; namespace Volo.Abp.BlobStoring.Minio; public class MinioBlobProvider : BlobProviderBase, ITransientDependency { + protected IHttpClientFactory HttpClientFactory { get; } protected IMinioBlobNameCalculator MinioBlobNameCalculator { get; } protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public MinioBlobProvider( + IHttpClientFactory httpClientFactory, IMinioBlobNameCalculator minioBlobNameCalculator, IBlobNormalizeNamingService blobNormalizeNamingService) { + HttpClientFactory = httpClientFactory; MinioBlobNameCalculator = minioBlobNameCalculator; BlobNormalizeNamingService = blobNormalizeNamingService; } @@ -81,21 +86,16 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency return null; } - var memoryStream = new MemoryStream(); - await client.GetObjectAsync(new GetObjectArgs().WithBucket(containerName).WithObject(blobName).WithCallbackStream(stream => - { - if (stream != null) - { - stream.CopyTo(memoryStream); - memoryStream.Seek(0, SeekOrigin.Begin); - } - else - { - memoryStream = null; - } - })); + var configuration = args.Configuration.GetMinioConfiguration(); + var downloadUrl = await client.PresignedGetObjectAsync( + new PresignedGetObjectArgs() + .WithBucket(containerName) + .WithObject(blobName) + .WithExpiry(configuration.PresignedGetExpirySeconds)); + + var httpClient = HttpClientFactory.CreateMinioHttpClient(); - return memoryStream; + return await httpClient.GetStreamAsync(downloadUrl, args.CancellationToken); } protected virtual IMinioClient GetMinioClient(BlobProviderArgs args) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs index e626a6837e..740a24f04f 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs @@ -47,6 +47,16 @@ public class MinioBlobProviderConfiguration set => _containerConfiguration.SetConfiguration(MinioBlobProviderConfigurationNames.CreateBucketIfNotExists, value); } + /// + /// Default value: 7 * 24 * 3600. + /// + public int PresignedGetExpirySeconds { + get => _containerConfiguration.GetConfigurationOrDefault(MinioBlobProviderConfigurationNames.PresignedGetExpirySeconds, _defaultExpirySeconds); + set => _containerConfiguration.SetConfiguration(MinioBlobProviderConfigurationNames.PresignedGetExpirySeconds, value); + } + + private int _defaultExpirySeconds = 7 * 24 * 3600; + private readonly BlobContainerConfiguration _containerConfiguration; public MinioBlobProviderConfiguration(BlobContainerConfiguration containerConfiguration) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs index 8a8a121ef7..1c32bd8aa0 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs @@ -8,4 +8,5 @@ public static class MinioBlobProviderConfigurationNames public const string SecretKey = "Minio.SecretKey"; public const string WithSSL = "Minio.WithSSL"; public const string CreateBucketIfNotExists = "Minio.CreateBucketIfNotExists"; + public const string PresignedGetExpirySeconds = "Minio.PresignedGetExpirySeconds"; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Internal/RecreateInitialMigrationCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Internal/RecreateInitialMigrationCommand.cs index 857edf6bd7..2b65b9d00b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Internal/RecreateInitialMigrationCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Internal/RecreateInitialMigrationCommand.cs @@ -47,6 +47,7 @@ public class RecreateInitialMigrationCommand : IConsoleCommand, ITransientDepend Directory.Delete(Path.Combine(projectDir, "Migrations"), true); } + CmdHelper.RunCmd($"dotnet build", workingDirectory: projectDir); var separateDbContext = false; if (Directory.Exists(Path.Combine(projectDir, "TenantMigrations"))) { diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionOptionsExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionOptionsExtensions.cs new file mode 100644 index 0000000000..43230c4dbb --- /dev/null +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionOptionsExtensions.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Options; +using Volo.Abp.Options; + +namespace Microsoft.Extensions.DependencyInjection; + +public static class ServiceCollectionOptionsExtensions +{ + /// + /// You should only use this method to register options if you need to continue using the ServiceProvider to get other options in your Options configuration method. + /// Otherwise, please use the default AddOptions method for better performance. + /// + /// + /// + /// + public static OptionsBuilder AddAbpOptions(this IServiceCollection services) + where TOptions : class + { + services.TryAddSingleton, AbpUnnamedOptionsManager>(); + return services.AddOptions(); + } +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/IKeyedObject.cs b/framework/src/Volo.Abp.Core/Volo/Abp/IKeyedObject.cs new file mode 100644 index 0000000000..d0cbb47790 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/IKeyedObject.cs @@ -0,0 +1,6 @@ +namespace Volo.Abp; + +public interface IKeyedObject +{ + string? GetObjectKey(); +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/KeyedObjectHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/KeyedObjectHelper.cs new file mode 100644 index 0000000000..9757e67ecc --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/KeyedObjectHelper.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Volo.Abp; + +public static class KeyedObjectHelper +{ + public static string EncodeCompositeKey(params object?[] keys) + { + var raw = keys.JoinAsString("||"); + var bytes = Encoding.UTF8.GetBytes(raw); + var base64 = Convert.ToBase64String(bytes); + var base64Url = base64 + .Replace("+", "-") + .Replace("/", "_") + .TrimEnd('='); + + return base64Url; + } + + public static string DecodeCompositeKey(string encoded) + { + var base64 = encoded + .Replace("-", "+") + .Replace("_", "/"); + + switch (encoded.Length % 4) + { + case 2: base64 += "=="; break; + case 3: base64 += "="; break; + } + + var bytes = Convert.FromBase64String(base64); + var raw = Encoding.UTF8.GetString(bytes); + + return raw; + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpUnnamedOptionsManager.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpUnnamedOptionsManager.cs new file mode 100644 index 0000000000..894df70e75 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpUnnamedOptionsManager.cs @@ -0,0 +1,34 @@ +using Microsoft.Extensions.Options; + +namespace Volo.Abp.Options; + +/// +/// This Options manager is similar to Microsoft UnnamedOptionsManager but without the locking mechanism. +/// Prevent deadlocks when accessing options in multiple threads. +/// +/// +public class AbpUnnamedOptionsManager : IOptions + where TOptions : class +{ + private readonly IOptionsFactory _factory; + private TOptions? _value; + + public AbpUnnamedOptionsManager(IOptionsFactory factory) + { + _factory = factory; + } + + public TOptions Value + { + get + { + if (_value is { } value) + { + return value; + } + + _value = _factory.Create(Microsoft.Extensions.Options.Options.DefaultName); + return _value; + } + } +} diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs index 656e63b0d5..16c81c2f92 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs @@ -23,4 +23,9 @@ public abstract class EntityDto : EntityDto, IEntityDto { return $"[DTO: {GetType().Name}] Id = {Id}"; } + + public virtual string? GetObjectKey() + { + return Id?.ToString(); + } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs index 9687af0cf7..16379f865c 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs @@ -27,6 +27,11 @@ public abstract class ExtensibleEntityDto : ExtensibleObject, IEntityDto : IEntityDto +public interface IEntityDto : IEntityDto, IKeyedObject { TKey Id { get; set; } } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/BasicAggregateRoot.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/BasicAggregateRoot.cs index e028b55844..5680f9e857 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/BasicAggregateRoot.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/BasicAggregateRoot.cs @@ -10,36 +10,38 @@ public abstract class BasicAggregateRoot : Entity, IAggregateRoot, IGeneratesDomainEvents { - private readonly ICollection _distributedEvents = new Collection(); - private readonly ICollection _localEvents = new Collection(); + private ICollection? _distributedEvents; + private ICollection? _localEvents; public virtual IEnumerable GetLocalEvents() { - return _localEvents; + return _localEvents ?? Array.Empty(); } public virtual IEnumerable GetDistributedEvents() { - return _distributedEvents; + return _distributedEvents ?? Array.Empty(); } public virtual void ClearLocalEvents() { - _localEvents.Clear(); + _localEvents?.Clear(); } public virtual void ClearDistributedEvents() { - _distributedEvents.Clear(); + _distributedEvents?.Clear(); } protected virtual void AddLocalEvent(object eventData) { + _localEvents ??= new Collection(); _localEvents.Add(new DomainEventRecord(eventData, EventOrderGenerator.GetNext())); } protected virtual void AddDistributedEvent(object eventData) { + _distributedEvents ??= new Collection(); _distributedEvents.Add(new DomainEventRecord(eventData, EventOrderGenerator.GetNext())); } } @@ -49,8 +51,8 @@ public abstract class BasicAggregateRoot : Entity, IAggregateRoot, IGeneratesDomainEvents { - private readonly ICollection _distributedEvents = new Collection(); - private readonly ICollection _localEvents = new Collection(); + private ICollection? _distributedEvents; + private ICollection? _localEvents; protected BasicAggregateRoot() { @@ -65,31 +67,33 @@ public abstract class BasicAggregateRoot : Entity, public virtual IEnumerable GetLocalEvents() { - return _localEvents; + return _localEvents ?? Array.Empty(); } public virtual IEnumerable GetDistributedEvents() { - return _distributedEvents; + return _distributedEvents ?? Array.Empty(); } public virtual void ClearLocalEvents() { - _localEvents.Clear(); + _localEvents?.Clear(); } public virtual void ClearDistributedEvents() { - _distributedEvents.Clear(); + _distributedEvents?.Clear(); } protected virtual void AddLocalEvent(object eventData) { + _localEvents ??= new Collection(); _localEvents.Add(new DomainEventRecord(eventData, EventOrderGenerator.GetNext())); } protected virtual void AddDistributedEvent(object eventData) { + _distributedEvents ??= new Collection(); _distributedEvents.Add(new DomainEventRecord(eventData, EventOrderGenerator.GetNext())); } } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs index 9e52d1abfd..93c5555a39 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs @@ -18,6 +18,17 @@ public abstract class Entity : IEntity return $"[ENTITY: {GetType().Name}] Keys = {GetKeys().JoinAsString(", ")}"; } + public virtual string? GetObjectKey() + { + var keys = GetKeys(); + return keys.Length switch + { + 0 => null, + 1 when keys[0] != null => keys[0]?.ToString(), + _ => KeyedObjectHelper.EncodeCompositeKey(keys) + }; + } + public abstract object?[] GetKeys(); public bool EntityEquals(IEntity other) @@ -45,7 +56,7 @@ public abstract class Entity : Entity, IEntity public override object?[] GetKeys() { - return new object?[] { Id }; + return [Id]; } /// diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs index 1df1b75696..db4a144539 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs @@ -4,7 +4,7 @@ /// Defines an entity. It's primary key may not be "Id" or it may have a composite primary key. /// Use where possible for better integration to repositories and other structures in the framework. /// -public interface IEntity +public interface IEntity : IKeyedObject { /// /// Returns an array of ordered keys for this entity. diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContextOptions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContextOptions.cs index 75cf409608..b87e9501d7 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContextOptions.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContextOptions.cs @@ -27,10 +27,10 @@ public class AbpDbContextOptions internal Action? DefaultOnModelCreatingAction { get; set; } - internal Action? DefaultOnConfiguringAction { get; set; } - internal Dictionary> OnModelCreatingActions { get; } + internal Action? DefaultOnConfiguringAction { get; set; } + internal Dictionary> OnConfiguringActions { get; } public AbpDbContextOptions() @@ -104,20 +104,6 @@ public class AbpDbContextOptions } } - public void ConfigureDefaultOnConfiguring([NotNull] Action action, bool overrideExisting = false) - { - Check.NotNull(action, nameof(action)); - - if (overrideExisting) - { - DefaultOnConfiguringAction = action; - } - else - { - DefaultOnConfiguringAction += action; - } - } - public void ConfigureOnModelCreating([NotNull] Action action) where TDbContext : AbpDbContext { @@ -136,6 +122,20 @@ public class AbpDbContextOptions actions.Add(action); } + public void ConfigureDefaultOnConfiguring([NotNull] Action action, bool overrideExisting = false) + { + Check.NotNull(action, nameof(action)); + + if (overrideExisting) + { + DefaultOnConfiguringAction = action; + } + else + { + DefaultOnConfiguringAction += action; + } + } + public void ConfigureOnConfiguring([NotNull] Action action) where TDbContext : AbpDbContext { diff --git a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs index 518de26437..8092107395 100644 --- a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs +++ b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs @@ -21,17 +21,20 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling; public class DefaultExceptionToErrorInfoConverter : IExceptionToErrorInfoConverter, ITransientDependency { + protected AbpExceptionHandlingOptions ExceptionHandlingOptions { get; } protected AbpExceptionLocalizationOptions LocalizationOptions { get; } protected IStringLocalizerFactory StringLocalizerFactory { get; } protected IStringLocalizer L { get; } protected IServiceProvider ServiceProvider { get; } public DefaultExceptionToErrorInfoConverter( + IOptions exceptionHandlingOptions, IOptions localizationOptions, IStringLocalizerFactory stringLocalizerFactory, IStringLocalizer stringLocalizer, IServiceProvider serviceProvider) { + ExceptionHandlingOptions = exceptionHandlingOptions.Value; ServiceProvider = serviceProvider; StringLocalizerFactory = stringLocalizerFactory; L = stringLocalizer; @@ -327,8 +330,8 @@ public class DefaultExceptionToErrorInfoConverter : IExceptionToErrorInfoConvert { return new AbpExceptionHandlingOptions { - SendExceptionsDetailsToClients = false, - SendStackTraceToClients = true + SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients, + SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients }; } } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/AbpFeaturesModule.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/AbpFeaturesModule.cs index cde88956b5..ab39c1aba7 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/AbpFeaturesModule.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/AbpFeaturesModule.cs @@ -31,6 +31,7 @@ public class AbpFeaturesModule : AbpModule context.Services.Configure(options => { options.ValueProviders.Add(); + options.ValueProviders.Add(); options.ValueProviders.Add(); options.ValueProviders.Add(); }); diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/ConfigurationFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/ConfigurationFeatureValueProvider.cs new file mode 100644 index 0000000000..7309e99b6f --- /dev/null +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/ConfigurationFeatureValueProvider.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; + +namespace Volo.Abp.Features; + +public class ConfigurationFeatureValueProvider : FeatureValueProvider +{ + public const string ConfigurationNamePrefix = "Features:"; + + public const string ProviderName = "C"; + + public override string Name => ProviderName; + + protected IConfiguration Configuration { get; } + + public ConfigurationFeatureValueProvider(IFeatureStore featureStore, IConfiguration configuration) + : base(featureStore) + { + Configuration = configuration; + } + + public override Task GetOrNullAsync(FeatureDefinition feature) + { + return Task.FromResult(Configuration[ConfigurationNamePrefix + feature.Name]); + } +} diff --git a/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs index ea35831d86..4b35ee5f25 100644 --- a/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs +++ b/framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs @@ -10,7 +10,7 @@ public class AbpJsonNewtonsoftModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { options.JsonSerializerSettings.ContractResolver = new AbpCamelCasePropertyNamesContractResolver( diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs index 0a5066cec1..2679cca96c 100644 --- a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs @@ -15,7 +15,7 @@ public class AbpJsonSystemTextJsonModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { // If the user hasn't explicitly configured the encoder, use the less strict encoder that does not encode all non-ASCII characters. diff --git a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs index 1238d766be..d63ca833eb 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using JetBrains.Annotations; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerUI; using Volo.Abp.Content; @@ -21,7 +21,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions { Func remoteStreamContentSchemaFactory = () => new OpenApiSchema() { - Type = "string", + Type = JsonSchemaType.String, Format = "binary" }; @@ -42,7 +42,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions { var authorizationUrl = new Uri($"{authority.TrimEnd('/')}{authorizationEndpoint.EnsureStartsWith('/')}"); var tokenUrl = new Uri($"{authority.TrimEnd('/')}{tokenEndpoint.EnsureStartsWith('/')}"); - + return services .AddAbpSwaggerGen() .AddSwaggerGen( @@ -62,19 +62,9 @@ public static class AbpSwaggerGenServiceCollectionExtensions } }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement + options.AddSecurityRequirement(document => new OpenApiSecurityRequirement() { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = "oauth2" - } - }, - Array.Empty() - } + [new OpenApiSecuritySchemeReference("oauth2", document)] = [] }); setupAction?.Invoke(options); @@ -100,7 +90,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions swaggerUiOptions.ConfigObject.AdditionalItems["oidcSupportedScopes"] = scopes; swaggerUiOptions.ConfigObject.AdditionalItems["oidcDiscoveryEndpoint"] = discoveryUrl; }); - + return services .AddAbpSwaggerGen() .AddSwaggerGen( @@ -112,24 +102,15 @@ public static class AbpSwaggerGenServiceCollectionExtensions OpenIdConnectUrl = new Uri(RemoveTenantPlaceholders(discoveryUrl)) }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement + options.AddSecurityRequirement(document => new OpenApiSecurityRequirement() { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = "oidc" - } - }, - Array.Empty() - } + [new OpenApiSecuritySchemeReference("oauth2", document)] = [] }); + setupAction?.Invoke(options); }); } - + private static string RemoveTenantPlaceholders(string url) { return url diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs index b6dc661410..8c4f06d786 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.SwaggerGen; namespace Volo.Abp.Swashbuckle; @@ -13,7 +13,7 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter protected virtual string[] ActionUrlPrefixes { get; set; } = new[] { "Volo." }; protected virtual string RegexConstraintPattern => @":regex\(([^()]*)\)"; - + public virtual void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) { var actionUrls = context.ApiDescriptions @@ -28,6 +28,20 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter swaggerDoc .Paths .RemoveAll(path => !actionUrls.Contains(path.Key)); + + var tags = new List(); + foreach (var path in swaggerDoc.Paths) + { + if (path.Value.Operations != null) + { + tags.AddRange(path.Value.Operations.SelectMany(x => + { + return x.Value.Tags?.Select(t => t.Name ?? string.Empty) ?? Array.Empty(); + })); + } + } + tags = tags.Distinct().ToList(); + swaggerDoc.Tags?.RemoveAll(tag => tag.Name == null || !tags.Contains(tag.Name)); } protected virtual string? RemoveRouteParameterConstraints(ActionDescriptor actionDescriptor) @@ -49,7 +63,7 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter { break; } - + route = route.Remove(startIndex, (endIndex - startIndex)); } diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs index b6a20d2ad2..afd6a141dc 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs @@ -1,22 +1,22 @@ -using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Models; +using System; +using System.Text.Json.Nodes; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.SwaggerGen; -using System; namespace Volo.Abp.Swashbuckle; public class AbpSwashbuckleEnumSchemaFilter : ISchemaFilter { - public void Apply(OpenApiSchema schema, SchemaFilterContext context) + public void Apply(IOpenApiSchema schema, SchemaFilterContext context) { - if (context.Type.IsEnum) + if (schema is OpenApiSchema openApiScheme && context.Type.IsEnum) { - schema.Enum.Clear(); - schema.Type = "string"; - schema.Format = null; + openApiScheme.Enum?.Clear(); + openApiScheme.Type = JsonSchemaType.String; + openApiScheme.Format = null; foreach (var name in Enum.GetNames(context.Type)) { - schema.Enum.Add(new OpenApiString($"{name}")); + openApiScheme.Enum?.Add(JsonNode.Parse($"\"{name}\"")!); } } } diff --git a/framework/src/Volo.Abp.TickerQ/FodyWeavers.xml b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xml new file mode 100644 index 0000000000..1715698ccd --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.TickerQ/FodyWeavers.xsd b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xsd new file mode 100644 index 0000000000..ffa6fc4b78 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs new file mode 100644 index 0000000000..4e81565e99 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.DependencyInjection; +using TickerQ.DependencyInjection; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using Volo.Abp.TickerQ; + +namespace Microsoft.AspNetCore.Builder; + +public static class AbpTickerQApplicationBuilderExtensions +{ + public static IApplicationBuilder UseAbpTickerQ(this IApplicationBuilder app, TickerQStartMode qStartMode = TickerQStartMode.Immediate) + { + var abpTickerQFunctionProvider = app.ApplicationServices.GetRequiredService(); + TickerFunctionProvider.RegisterFunctions(abpTickerQFunctionProvider.Functions); + TickerFunctionProvider.RegisterRequestType(abpTickerQFunctionProvider.RequestTypes); + + app.UseTickerQ(qStartMode); + return app; + } +} diff --git a/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj b/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj new file mode 100644 index 0000000000..89a037bab7 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj @@ -0,0 +1,27 @@ + + + + + + + netstandard2.1;net8.0;net9.0;net10.0 + enable + Nullable + Volo.Abp.TickerQ + Volo.Abp.TickerQ + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQFunctionProvider.cs b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQFunctionProvider.cs new file mode 100644 index 0000000000..b92888e533 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQFunctionProvider.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.TickerQ; + +public class AbpTickerQFunctionProvider : ISingletonDependency +{ + public Dictionary Functions { get;} + + public Dictionary RequestTypes { get; } + + public AbpTickerQFunctionProvider() + { + Functions = new Dictionary(); + RequestTypes = new Dictionary(); + } +} diff --git a/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs new file mode 100644 index 0000000000..b6c140e962 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.DependencyInjection; +using TickerQ.DependencyInjection; +using Volo.Abp.Modularity; + +namespace Volo.Abp.TickerQ; + +public class AbpTickerQModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddTickerQ(options => + { + options.SetInstanceIdentifier(context.Services.GetApplicationName()); + }); + } +} diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ar.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ar.json index 93cf62ab84..eb32a44fa2 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ar.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ar.json @@ -61,6 +61,7 @@ "ProfilePicture": "الصوره الشخصيه", "Theme": "سمة", "NotAssigned": "غيرمعتمد", - "EntityActionsDisabledTooltip": "ليس لديك إذن لتنفيذ أي إجراء." + "EntityActionsDisabledTooltip": "ليس لديك إذن لتنفيذ أي إجراء.", + "ResourcePermissions": "أذونات" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json index ff2d09fdf8..27a174cb49 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profilový obrázek", "Theme": "Téma", "NotAssigned": "Nepřiřazena", - "EntityActionsDisabledTooltip": "Nemáte oprávnění provést žádnou akci." + "EntityActionsDisabledTooltip": "Nemáte oprávnění provést žádnou akci.", + "ResourcePermissions": "Oprávnění" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de.json index 37c361c1e3..869d049be1 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profilbild", "Theme": "Thema", "NotAssigned": "Nicht zugeordnet", - "EntityActionsDisabledTooltip": "Sie haben keine Berechtigung, Aktionen auszuführen." + "EntityActionsDisabledTooltip": "Sie haben keine Berechtigung, Aktionen auszuführen.", + "ResourcePermissions": "Berechtigungen" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/el.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/el.json index f7d837a361..8c2dc2be1d 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/el.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/el.json @@ -55,6 +55,7 @@ "OthersGroup": "άλλος", "Today": "Σήμερα", "Apply": "Ισχύουν", - "EntityActionsDisabledTooltip": "Δεν έχετε δικαίωμα να εκτελέσετε καμία ενέργεια." + "EntityActionsDisabledTooltip": "Δεν έχετε δικαίωμα να εκτελέσετε καμία ενέργεια.", + "ResourcePermissions": "Δικαιώματα", } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en-GB.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en-GB.json index c5aaa5957c..ce9d962d5e 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en-GB.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en-GB.json @@ -56,6 +56,7 @@ "NotAssigned": "Not Assigned", "Today": "Today", "Apply": "Apply", - "EntityActionsDisabledTooltip": "You do not have permission to perform any action." + "EntityActionsDisabledTooltip": "You do not have permission to perform any action.", + "ResourcePermissions": "Permissions" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json index 7a5a806124..f328765a39 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profile picture", "Theme": "Theme", "NotAssigned": "Not Assigned", - "EntityActionsDisabledTooltip": "You do not have permission to perform any action." + "EntityActionsDisabledTooltip": "You do not have permission to perform any action.", + "ResourcePermissions": "Permissions" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json index 132243a740..9d341cb88f 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json @@ -61,6 +61,7 @@ "ProfilePicture": "Foto de perfil", "Theme": "Tema", "NotAssigned": "No asignado", - "EntityActionsDisabledTooltip": "No tienes permisos para realizar ninguna acción." + "EntityActionsDisabledTooltip": "No tienes permisos para realizar ninguna acción.", + "ResourcePermissions": "Permisos" } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fa.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fa.json index f1738957c9..5862eab90e 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fa.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fa.json @@ -55,6 +55,7 @@ "OthersGroup": "دیگر", "Today": "امروز", "Apply": "درخواست دادن", - "EntityActionsDisabledTooltip": "شما دسترسی به انجام هر گونه عملیات ندارید." + "EntityActionsDisabledTooltip": "شما دسترسی به انجام هر گونه عملیات ندارید.", + "ResourcePermissions": "مجوزها" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fi.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fi.json index 1af59eb720..51e356559b 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fi.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fi.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profiilikuva", "Theme": "Teema", "NotAssigned": "Ei määritetty", - "EntityActionsDisabledTooltip": "Sinulla ei ole oikeutta suorittaa mitään toimintoa." + "EntityActionsDisabledTooltip": "Sinulla ei ole oikeutta suorittaa mitään toimintoa.", + "ResourcePermissions": "Käyttöoikeudet" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fr.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fr.json index 8af5661d1a..79a40c57f9 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fr.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/fr.json @@ -61,6 +61,7 @@ "ProfilePicture": "Image de profil", "Theme": "Thème", "NotAssigned": "Non attribué", - "EntityActionsDisabledTooltip": "Vous n'avez pas les permissions pour effectuer une action." + "EntityActionsDisabledTooltip": "Vous n'avez pas les permissions pour effectuer une action.", + "ResourcePermissions": "Autorisations" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hi.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hi.json index ba873b7685..10c1e426c1 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hi.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hi.json @@ -61,6 +61,7 @@ "ProfilePicture": "प्रोफ़ाइल फोटो", "Theme": "विषय", "NotAssigned": "सौंपा नहीं गया है", - "EntityActionsDisabledTooltip": "आपके पास कोई कार्रवाई नहीं है जो करने के लिए है।" + "EntityActionsDisabledTooltip": "आपके पास कोई कार्रवाई नहीं है जो करने के लिए है।", + "ResourcePermissions": "अनुमतियाँ" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hr.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hr.json index 5b16c84963..c36751828c 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hr.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hr.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profilna slika", "Theme": "Tema", "NotAssigned": "Nije dodijeljeno", - "EntityActionsDisabledTooltip": "Nemate dozvolu za izvođenje bilo kakve akcije." + "EntityActionsDisabledTooltip": "Nemate dozvolu za izvođenje bilo kakve akcije.", + "ResourcePermissions": "Dozvole" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hu.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hu.json index 0539276498..e162a2c6c8 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hu.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/hu.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profil kép", "Theme": "Téma", "NotAssigned": "Nem kijelölt", - "EntityActionsDisabledTooltip": "Nincs jogosultsága bármely művelethez." + "EntityActionsDisabledTooltip": "Nincs jogosultsága bármely művelethez.", + "ResourcePermissions": "Engedélyek" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/is.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/is.json index 8a1eda9e4e..3d88d70d97 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/is.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/is.json @@ -61,6 +61,7 @@ "ProfilePicture": "Forsíðumynd", "Theme": "Þema", "NotAssigned": "Ekki skráður", - "EntityActionsDisabledTooltip": "Þú hefur ekki aðgang að þessum aðgerðum." + "EntityActionsDisabledTooltip": "Þú hefur ekki aðgang að þessum aðgerðum.", + "ResourcePermissions": "Aðgangsheimildir" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/it.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/it.json index 77d4742680..9bfffe181e 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/it.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/it.json @@ -61,6 +61,7 @@ "ProfilePicture": "Immagine del profilo", "Theme": "Tema", "NotAssigned": "Non assegnato", - "EntityActionsDisabledTooltip": "Non hai i permessi per eseguire alcuna azione." + "EntityActionsDisabledTooltip": "Non hai i permessi per eseguire alcuna azione.", + "ResourcePermissions": "Autorizzazioni" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json index 38182ec9e6..51ab0bcd31 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profielfoto", "Theme": "Thema", "NotAssigned": "Niet toegekend", - "EntityActionsDisabledTooltip": "U hebt geen toegang tot deze acties." + "EntityActionsDisabledTooltip": "U hebt geen toegang tot deze acties.", + "ResourcePermissions": "Machtigingen" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pl-PL.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pl-PL.json index d7f321f3d6..20b4daf7f0 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pl-PL.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pl-PL.json @@ -61,6 +61,7 @@ "ProfilePicture": "Zdjęcie profilowe", "Theme": "Temat", "NotAssigned": "Nie przypisano", - "EntityActionsDisabledTooltip": "Nie masz uprawnień do wykonania żadnej akcji." + "EntityActionsDisabledTooltip": "Nie masz uprawnień do wykonania żadnej akcji.", + "ResourcePermissions": "Uprawnienia" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json index 13c8380fa3..9764d99fe6 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json @@ -61,6 +61,7 @@ "ProfilePicture": "Foto do perfil", "Theme": "Tema", "NotAssigned": "Não atribuído", - "EntityActionsDisabledTooltip": "Você não tem permissão para executar qualquer ação." + "EntityActionsDisabledTooltip": "Você não tem permissão para executar qualquer ação.", + "ResourcePermissions": "Permissões" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ro-RO.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ro-RO.json index e03fd91f50..6b7367994c 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ro-RO.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ro-RO.json @@ -61,6 +61,7 @@ "ProfilePicture": "Poză de profil", "Theme": "Temă", "NotAssigned": "Nealocat", - "EntityActionsDisabledTooltip": "Nu aveți permisiune să efectuați nicio acțiune." + "EntityActionsDisabledTooltip": "Nu aveți permisiune să efectuați nicio acțiune.", + "ResourcePermissions": "Permisiuni" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ru.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ru.json index 57f3079cb4..d4f4acf5d6 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ru.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ru.json @@ -61,6 +61,7 @@ "ProfilePicture": "Изображение профиля", "Theme": "Тема", "NotAssigned": "Не назначен", - "EntityActionsDisabledTooltip": "У вас нет прав на выполнение каких-либо действий." + "EntityActionsDisabledTooltip": "У вас нет прав на выполнение каких-либо действий.", + "ResourcePermissions": "Разрешения" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sk.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sk.json index eb0ba2958f..59d8aecef4 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sk.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sk.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profilový obrázok", "Theme": "Téma", "NotAssigned": "Nepridelené", - "EntityActionsDisabledTooltip": "Nemáte oprávnenie vykonávať žiadnu akciu." + "EntityActionsDisabledTooltip": "Nemáte oprávnenie vykonávať žiadnu akciu.", + "ResourcePermissions": "Oprávnenia" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sl.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sl.json index bc3f795b34..89f2691a11 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sl.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sl.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profilna slika", "Theme": "Tema", "NotAssigned": "Ni dodeljena", - "EntityActionsDisabledTooltip": "Nimate pravic za izvajanje kakršne koli dejanje." + "EntityActionsDisabledTooltip": "Nimate pravic za izvajanje kakršne koli dejanje.", + "ResourcePermissions": "Dovoljenja" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sv.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sv.json index f0257637c1..fe4b692cdf 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sv.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/sv.json @@ -60,6 +60,7 @@ "ProfilePicture": "Profilbild", "Theme": "Tema", "NotAssigned": "Ej tilldelad", - "EntityActionsDisabledTooltip": "Du har inte tillgång till dessa åtgärder." + "EntityActionsDisabledTooltip": "Du har inte tillgång till dessa åtgärder.", + "ResourcePermissions": "Behörigheter" } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json index b21adf632a..73a4bb5cb4 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json @@ -61,6 +61,7 @@ "ProfilePicture": "Profil resmi", "Theme": "Tema", "NotAssigned": "Atanmadı", - "EntityActionsDisabledTooltip": "Bu işlemi gerçekleştirmek için yeterli yetkiniz yok." + "EntityActionsDisabledTooltip": "Bu işlemi gerçekleştirmek için yeterli yetkiniz yok.", + "ResourcePermissions": "İzinler" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/vi.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/vi.json index 700798895f..015ed883d3 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/vi.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/vi.json @@ -61,6 +61,7 @@ "ProfilePicture": "Ảnh đại diện", "Theme": "chủ đề", "NotAssigned": "Không được chỉ định", - "EntityActionsDisabledTooltip": "Bạn không có quyền thực hiện bất kỳ hành động nào." + "EntityActionsDisabledTooltip": "Bạn không có quyền thực hiện bất kỳ hành động nào.", + "ResourcePermissions": "Quyền" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json index 60f70e1545..b0759d7da9 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json @@ -61,6 +61,7 @@ "ProfilePicture": "个人资料图片", "Theme": "主题", "NotAssigned": "未分配", - "EntityActionsDisabledTooltip": "您没有权限执行任何操作。" + "EntityActionsDisabledTooltip": "您没有权限执行任何操作。", + "ResourcePermissions": "权限" } } diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json index 0f8fdeb254..e35bae3610 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json @@ -61,6 +61,7 @@ "ProfilePicture": "個人資料圖片", "Theme": "主題", "NotAssigned": "未分配", - "EntityActionsDisabledTooltip": "您沒有權限執行任何操作。" + "EntityActionsDisabledTooltip": "您沒有權限執行任何操作。", + "ResourcePermissions": "權限" } } diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AbpAuthorizationTestModule.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AbpAuthorizationTestModule.cs index fca3d209b0..15ec4e0641 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AbpAuthorizationTestModule.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/AbpAuthorizationTestModule.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.TestServices; +using Volo.Abp.Authorization.TestServices.Resources; using Volo.Abp.Autofac; using Volo.Abp.DynamicProxy; using Volo.Abp.ExceptionHandling; @@ -33,6 +34,9 @@ public class AbpAuthorizationTestModule : AbpModule options.ValueProviders.Add(); options.ValueProviders.Add(); options.ValueProviders.Add(); + + options.ResourceValueProviders.Add(); + options.ResourceValueProviders.Add(); }); } } diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/PermissionValueProviderManager_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/PermissionValueProviderManager_Tests.cs index 4144df2e1e..43736f0dce 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/PermissionValueProviderManager_Tests.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/PermissionValueProviderManager_Tests.cs @@ -2,12 +2,11 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; -using Volo.Abp.Authorization; using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.TestServices; using Xunit; -namespace Volo.Abp; +namespace Volo.Abp.Authorization; public class PermissionValueProviderManager_Tests: AuthorizationTestBase { @@ -17,7 +16,7 @@ public class PermissionValueProviderManager_Tests: AuthorizationTestBase { _permissionValueProviderManager = GetRequiredService(); } - + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) { options.Services.Configure(permissionOptions => @@ -25,7 +24,7 @@ public class PermissionValueProviderManager_Tests: AuthorizationTestBase permissionOptions.ValueProviders.Add(); }); } - + [Fact] public void Should_Throw_Exception_If_Duplicate_Provider_Name_Detected() { @@ -33,7 +32,7 @@ public class PermissionValueProviderManager_Tests: AuthorizationTestBase { var providers = _permissionValueProviderManager.ValueProviders; }); - + exception.Message.ShouldBe($"Duplicate permission value provider name detected: TestPermissionValueProvider1. Providers:{Environment.NewLine}{typeof(TestDuplicatePermissionValueProvider).FullName}{Environment.NewLine}{typeof(TestPermissionValueProvider1).FullName}"); } } @@ -55,4 +54,4 @@ public class TestDuplicatePermissionValueProvider : PermissionValueProvider { throw new NotImplementedException(); } -} \ No newline at end of file +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionChecker_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionChecker_Tests.cs new file mode 100644 index 0000000000..739968b603 --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionChecker_Tests.cs @@ -0,0 +1,62 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Authorization.TestServices.Resources; +using Xunit; + +namespace Volo.Abp.Authorization; + +public class ResourcePermissionChecker_Tests: AuthorizationTestBase +{ + private readonly IResourcePermissionChecker _resourcePermissionChecker; + + public ResourcePermissionChecker_Tests() + { + _resourcePermissionChecker = GetRequiredService(); + } + + [Fact] + public async Task IsGrantedAsync() + { + (await _resourcePermissionChecker.IsGrantedAsync("MyResourcePermission5", TestEntityResource.ResourceName, TestEntityResource.ResourceKey5)).ShouldBe(true); + (await _resourcePermissionChecker.IsGrantedAsync("UndefinedResourcePermission", TestEntityResource.ResourceName, TestEntityResource.ResourceKey5)).ShouldBe(false); + (await _resourcePermissionChecker.IsGrantedAsync("MyResourcePermission8", TestEntityResource.ResourceName, TestEntityResource.ResourceKey5)).ShouldBe(false); + } + + [Fact] + public async Task IsGranted_Multiple_Result_Async() + { + var result = await _resourcePermissionChecker.IsGrantedAsync(new [] + { + "MyResourcePermission1", + "MyResourcePermission2", + "UndefinedPermission", + "MyResourcePermission3", + "MyResourcePermission4", + "MyResourcePermission5", + "MyResourcePermission8" + }, TestEntityResource.ResourceName, TestEntityResource.ResourceKey5); + + result.Result["MyResourcePermission1"].ShouldBe(PermissionGrantResult.Undefined); + result.Result["MyResourcePermission2"].ShouldBe(PermissionGrantResult.Prohibited); + result.Result["UndefinedPermission"].ShouldBe(PermissionGrantResult.Prohibited); + result.Result["MyResourcePermission3"].ShouldBe(PermissionGrantResult.Granted); + result.Result["MyResourcePermission4"].ShouldBe(PermissionGrantResult.Prohibited); + result.Result["MyResourcePermission5"].ShouldBe(PermissionGrantResult.Granted); + result.Result["MyResourcePermission8"].ShouldBe(PermissionGrantResult.Prohibited); + + result = await _resourcePermissionChecker.IsGrantedAsync(new [] + { + "MyResourcePermission6", + }, TestEntityResource.ResourceName, TestEntityResource.ResourceKey6); + + result.Result["MyResourcePermission6"].ShouldBe(PermissionGrantResult.Granted); + + result = await _resourcePermissionChecker.IsGrantedAsync(new [] + { + "MyResourcePermission7", + }, TestEntityResource.ResourceName, TestEntityResource.ResourceKey7); + result.Result["MyResourcePermission7"].ShouldBe(PermissionGrantResult.Granted); + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionPopulator_Test.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionPopulator_Test.cs new file mode 100644 index 0000000000..2cc000c30a --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionPopulator_Test.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Authorization.TestServices.Resources; +using Xunit; + +namespace Volo.Abp.Authorization; + +public class ResourcePermissionPopulator_Tests : AuthorizationTestBase +{ + private readonly ResourcePermissionPopulator _resourcePermissionPopulator; + + public ResourcePermissionPopulator_Tests() + { + _resourcePermissionPopulator = GetRequiredService(); + } + + [Fact] + public async Task PopulateAsync() + { + var testResourceObject = new TestEntityResource(TestEntityResource.ResourceKey5); + testResourceObject.ResourcePermissions.IsNullOrEmpty().ShouldBeTrue(); + + await _resourcePermissionPopulator.PopulateAsync( + testResourceObject, + TestEntityResource.ResourceName + ); + + testResourceObject.ResourcePermissions.ShouldNotBeNull(); + testResourceObject.ResourcePermissions.Count.ShouldBe(8); + testResourceObject.ResourcePermissions["MyResourcePermission1"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission2"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission3"].ShouldBe(true); + testResourceObject.ResourcePermissions["MyResourcePermission4"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission5"].ShouldBe(true); + testResourceObject.ResourcePermissions["MyResourcePermission6"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission7"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission8"].ShouldBe(false); + + testResourceObject = new TestEntityResource(TestEntityResource.ResourceKey6); + testResourceObject.ResourcePermissions.IsNullOrEmpty().ShouldBeTrue(); + + await _resourcePermissionPopulator.PopulateAsync( + testResourceObject, + TestEntityResource.ResourceName + ); + + testResourceObject.ResourcePermissions.ShouldNotBeNull(); + testResourceObject.ResourcePermissions.Count.ShouldBe(8); + testResourceObject.ResourcePermissions["MyResourcePermission1"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission2"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission3"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission4"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission5"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission6"].ShouldBe(true); + testResourceObject.ResourcePermissions["MyResourcePermission7"].ShouldBe(false); + testResourceObject.ResourcePermissions["MyResourcePermission8"].ShouldBe(false); + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionValueProviderManager_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionValueProviderManager_Tests.cs new file mode 100644 index 0000000000..ceebc1ebac --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/ResourcePermissionValueProviderManager_Tests.cs @@ -0,0 +1,58 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Authorization.TestServices.Resources; +using Xunit; + +namespace Volo.Abp.Authorization; + +public class ResourcePermissionValueProviderManager_Tests: AuthorizationTestBase +{ + private readonly IResourcePermissionValueProviderManager _resourcePermissionValueProviderManager; + + public ResourcePermissionValueProviderManager_Tests() + { + _resourcePermissionValueProviderManager = GetRequiredService(); + } + + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.Services.Configure(permissionOptions => + { + permissionOptions.ResourceValueProviders.Add(); + }); + } + + [Fact] + public void Should_Throw_Exception_If_Duplicate_Provider_Name_Detected() + { + var exception = Assert.Throws(() => + { + var providers = _resourcePermissionValueProviderManager.ValueProviders; + }); + + exception.Message.ShouldBe($"Duplicate resource permission value provider name detected: TestResourcePermissionValueProvider1. Providers:{Environment.NewLine}{typeof(TestDuplicateResourcePermissionValueProvider).FullName}{Environment.NewLine}{typeof(TestResourcePermissionValueProvider1).FullName}"); + } +} + +public class TestDuplicateResourcePermissionValueProvider : ResourcePermissionValueProvider +{ + public TestDuplicateResourcePermissionValueProvider(IResourcePermissionStore permissionStore) : base(permissionStore) + { + } + + public override string Name => "TestResourcePermissionValueProvider1"; + + public override Task CheckAsync(ResourcePermissionValueCheckContext context) + { + throw new NotImplementedException(); + } + + public override Task CheckAsync(ResourcePermissionValuesCheckContext context) + { + throw new NotImplementedException(); + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/StaticPermissionDefinitionStore_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/StaticPermissionDefinitionStore_Tests.cs index d3a484c32f..0afaa34f10 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/StaticPermissionDefinitionStore_Tests.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/StaticPermissionDefinitionStore_Tests.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Shouldly; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.TestServices.Resources; using Xunit; namespace Volo.Abp.Authorization; @@ -44,4 +45,29 @@ public class StaticPermissionDefinitionStore_Tests : AuthorizationTestBase var groups = await _store.GetGroupsAsync(); groups.ShouldNotContain(x => x.Name == "TestGetGroup"); } + + [Fact] + public async Task GetResourcePermissionOrNullAsync() + { + var permission = await _store.GetResourcePermissionOrNullAsync(TestEntityResource.ResourceName, "MyResourcePermission1"); + permission.ShouldNotBeNull(); + permission.Name.ShouldBe("MyResourcePermission1"); + permission.StateCheckers.ShouldContain(x => x.GetType() == typeof(TestRequireEditionPermissionSimpleStateChecker)); + + permission = await _store.GetResourcePermissionOrNullAsync(TestEntityResource.ResourceName, "NotExists"); + permission.ShouldBeNull(); + } + + [Fact] + public async Task GetResourcePermissionsAsync() + { + var permissions = await _store.GetResourcePermissionsAsync(); + permissions.ShouldContain(x => x.Name == "MyResourcePermission1"); + permissions.ShouldContain(x => x.Name == "MyResourcePermission2"); + permissions.ShouldContain(x => x.Name == "MyResourcePermission3"); + permissions.ShouldContain(x => x.Name == "MyResourcePermission4"); + permissions.ShouldContain(x => x.Name == "MyResourcePermission5"); + permissions.ShouldContain(x => x.Name == "MyResourcePermission6"); + permissions.ShouldContain(x => x.Name == "MyResourcePermission7"); + } } diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/FakePermissionStore.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/FakePermissionStore.cs index 4582417d3b..608cf94428 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/FakePermissionStore.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/FakePermissionStore.cs @@ -8,7 +8,7 @@ public class FakePermissionStore : IPermissionStore, ITransientDependency { public Task IsGrantedAsync(string name, string providerName, string providerKey) { - return Task.FromResult(name == "MyPermission3" || name == "MyPermission5"); + return Task.FromResult(name == "MyPermission3" || name == "MyPermission5" || name == "TestEntityManagementPermission"); } public Task IsGrantedAsync(string[] names, string providerName, string providerKey) @@ -16,7 +16,7 @@ public class FakePermissionStore : IPermissionStore, ITransientDependency var result = new MultiplePermissionGrantResult(); foreach (var name in names) { - result.Result.Add(name, name == "MyPermission3" || name == "MyPermission5" + result.Result.Add(name, name == "MyPermission3" || name == "MyPermission5" || name == "TestEntityManagementPermission" ? PermissionGrantResult.Granted : PermissionGrantResult.Prohibited); } diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/AuthorizationTestResourcePermissionDefinitionProvider.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/AuthorizationTestResourcePermissionDefinitionProvider.cs new file mode 100644 index 0000000000..29a597c9b3 --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/AuthorizationTestResourcePermissionDefinitionProvider.cs @@ -0,0 +1,48 @@ +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Xunit; + +namespace Volo.Abp.Authorization.TestServices.Resources; + +public class AuthorizationTestResourcePermissionDefinitionProvider : PermissionDefinitionProvider +{ + public override void Define(IPermissionDefinitionContext context) + { + var getGroup = context.GetGroupOrNull("TestGroup"); + if (getGroup == null) + { + getGroup = context.AddGroup("TestGroup"); + } + getGroup.AddPermission("TestEntityManagementPermission"); + getGroup.AddPermission("TestEntityManagementPermission2"); + + var permission1 = context.AddResourcePermission("MyResourcePermission1", resourceName: TestEntityResource.ResourceName, "TestEntityManagementPermission"); + Assert.Throws(() => + { + permission1.AddChild("MyResourcePermission1.ChildPermission1"); + }).Message.ShouldBe($"Resource permission cannot have child permissions. Resource: {TestEntityResource.ResourceName}"); + permission1.StateCheckers.Add(new TestRequireEditionPermissionSimpleStateChecker());; + permission1[PermissionDefinitionContext.KnownPropertyNames.CurrentProviderName].ShouldBe(typeof(AuthorizationTestResourcePermissionDefinitionProvider).FullName); + + context.AddResourcePermission("MyResourcePermission2", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourcePermission3", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourcePermission4", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourcePermission5", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourcePermission6", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission").WithProviders(nameof(TestResourcePermissionValueProvider1)); + context.AddResourcePermission("MyResourcePermission7", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission").WithProviders(nameof(TestResourcePermissionValueProvider2)); + context.AddResourcePermission("MyResourcePermission8", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission2"); + + Assert.Throws(() => + { + context.AddResourcePermission("MyResourcePermission7", resourceName: typeof(TestEntityResource).FullName!, "TestEntityManagementPermission"); + }).Message.ShouldBe($"There is already an existing resource permission with name: MyResourcePermission7 for resource: {typeof(TestEntityResource).FullName}"); + + context.AddResourcePermission("MyResourcePermission7", resourceName: typeof(TestEntityResource2).FullName!, "TestEntityManagementPermission").WithProviders(nameof(TestResourcePermissionValueProvider2)); + + context.GetResourcePermissionOrNull(TestEntityResource.ResourceName, "MyResourcePermission1").ShouldNotBeNull(); + context.GetResourcePermissionOrNull(TestEntityResource.ResourceName, "MyResourcePermission7").ShouldNotBeNull(); + context.GetResourcePermissionOrNull(TestEntityResource2.ResourceName, "MyResourcePermission7").ShouldNotBeNull(); + context.GetResourcePermissionOrNull(TestEntityResource.ResourceName, "MyResourcePermission9").ShouldBeNull(); + context.GetResourcePermissionOrNull(TestEntityResource2.ResourceName, "MyResourcePermission6").ShouldBeNull(); + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/FakeResourcePermissionStore.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/FakeResourcePermissionStore.cs new file mode 100644 index 0000000000..40cd542ac7 --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/FakeResourcePermissionStore.cs @@ -0,0 +1,46 @@ +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Authorization.TestServices.Resources; + +public class FakeResourcePermissionStore : IResourcePermissionStore, ITransientDependency +{ + public Task IsGrantedAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + return Task.FromResult((name == "MyResourcePermission3" || name == "MyResourcePermission5") && + resourceName == TestEntityResource.ResourceName && + (resourceKey == TestEntityResource.ResourceKey3 || resourceKey == TestEntityResource.ResourceKey5)); + } + + public Task IsGrantedAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey) + { + var result = new MultiplePermissionGrantResult(); + foreach (var name in names) + { + result.Result.Add(name, ((name == "MyResourcePermission3" || name == "MyResourcePermission5") && + resourceName == TestEntityResource.ResourceName && + (resourceKey == TestEntityResource.ResourceKey3 || resourceKey == TestEntityResource.ResourceKey5) + ? PermissionGrantResult.Granted + : PermissionGrantResult.Prohibited)); + } + + return Task.FromResult(result); + } + + public Task GetPermissionsAsync(string resourceName, string resourceKey) + { + throw new System.NotImplementedException(); + } + + public Task GetGrantedPermissionsAsync(string resourceName, string resourceKey) + { + throw new System.NotImplementedException(); + } + + public Task GetGrantedResourceKeysAsync(string resourceName, string name) + { + throw new System.NotImplementedException(); + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestEntityResource.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestEntityResource.cs new file mode 100644 index 0000000000..f703007633 --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestEntityResource.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Authorization.Permissions.Resources; + +namespace Volo.Abp.Authorization.TestServices.Resources; + +public class TestEntityResource : IHasResourcePermissions +{ + public static readonly string ResourceName = typeof(TestEntityResource).FullName; + + public static readonly string ResourceKey1 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey2 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey3 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey4 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey5 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey6 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey7 = Guid.NewGuid().ToString(); + + private string Id { get; } + + public TestEntityResource(string id) + { + Id = id; + } + + public string GetObjectKey() + { + return Id; + } + + public Dictionary ResourcePermissions { get; set; } +} + +public class TestEntityResource2 +{ + public static readonly string ResourceName = typeof(TestEntityResource2).FullName; +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestResourcePermissionValueProvider1.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestResourcePermissionValueProvider1.cs new file mode 100644 index 0000000000..3c7dc49a83 --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestResourcePermissionValueProvider1.cs @@ -0,0 +1,43 @@ +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; + +namespace Volo.Abp.Authorization.TestServices.Resources; + +public class TestResourcePermissionValueProvider1 : ResourcePermissionValueProvider +{ + public TestResourcePermissionValueProvider1(IResourcePermissionStore permissionStore) : base(permissionStore) + { + } + + public override string Name => "TestResourcePermissionValueProvider1"; + + public override Task CheckAsync(ResourcePermissionValueCheckContext context) + { + var result = PermissionGrantResult.Undefined; + if (context.Permission.Name == "MyResourcePermission6" && + context.ResourceName == TestEntityResource.ResourceName && + context.ResourceKey == TestEntityResource.ResourceKey6) + { + result = PermissionGrantResult.Granted; + } + + return Task.FromResult(result); + } + + public override Task CheckAsync(ResourcePermissionValuesCheckContext context) + { + var result = new MultiplePermissionGrantResult(); + foreach (var name in context.Permissions.Select(x => x.Name)) + { + result.Result.Add(name, name == "MyResourcePermission6" && + context.ResourceName == TestEntityResource.ResourceName && + context.ResourceKey == TestEntityResource.ResourceKey6 + ? PermissionGrantResult.Granted + : PermissionGrantResult.Undefined); + } + + return Task.FromResult(result); + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestResourcePermissionValueProvider2.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestResourcePermissionValueProvider2.cs new file mode 100644 index 0000000000..c4ac61cb2c --- /dev/null +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/Resources/TestResourcePermissionValueProvider2.cs @@ -0,0 +1,43 @@ +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; + +namespace Volo.Abp.Authorization.TestServices.Resources; + +public class TestResourcePermissionValueProvider2 : ResourcePermissionValueProvider +{ + public TestResourcePermissionValueProvider2(IResourcePermissionStore permissionStore) : base(permissionStore) + { + } + + public override string Name => "TestResourcePermissionValueProvider2"; + + public override Task CheckAsync(ResourcePermissionValueCheckContext context) + { + var result = PermissionGrantResult.Undefined; + if (context.Permission.Name == "MyResourcePermission7" && + context.ResourceName == TestEntityResource.ResourceName && + context.ResourceKey == TestEntityResource.ResourceKey7) + { + result = PermissionGrantResult.Granted; + } + + return Task.FromResult(result); + } + + public override Task CheckAsync(ResourcePermissionValuesCheckContext context) + { + var result = new MultiplePermissionGrantResult(); + foreach (var name in context.Permissions.Select(x => x.Name)) + { + result.Result.Add(name, name == "MyResourcePermission7" && + context.ResourceName == TestEntityResource.ResourceName && + context.ResourceKey == TestEntityResource.ResourceKey7 + ? PermissionGrantResult.Granted + : PermissionGrantResult.Undefined); + } + + return Task.FromResult(result); + } +} diff --git a/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs b/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs index ce24894b5c..fc6b8e5841 100644 --- a/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs +++ b/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs @@ -57,6 +57,7 @@ public class AbpBlobStoringMinioTestModule : AbpModule minio.WithSSL = false; minio.BucketName = _randomContainerName; minio.CreateBucketIfNotExists = true; + minio.PresignedGetExpirySeconds = 3600; }); }); }); diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/ObjectWithKeyHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/ObjectWithKeyHelper_Tests.cs new file mode 100644 index 0000000000..d5f0186b3c --- /dev/null +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/ObjectWithKeyHelper_Tests.cs @@ -0,0 +1,31 @@ +using System; +using Shouldly; +using Xunit; + +namespace Volo.Abp; + +public class KeyedObjectHelper_Tests +{ + [Fact] + public void EncodeCompositeKey() + { + var encoded = KeyedObjectHelper.EncodeCompositeKey("Book", "123"); + encoded.ShouldBe("Qm9va3x8MTIz"); + } + + [Fact] + public void DecodeCompositeKey() + { + var decoded = KeyedObjectHelper.DecodeCompositeKey("Qm9va3x8MTIz"); + decoded.ShouldBe("Book||123"); + } + + [Fact] + public void Encode_Decode_CompositeKey() + { + var encoded = KeyedObjectHelper.EncodeCompositeKey("User", 42, Guid.Empty); + var decoded = KeyedObjectHelper.DecodeCompositeKey(encoded); + + decoded.ShouldBe($"User||42||{Guid.Empty}"); + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Entities/EntityHelper_Tests.cs b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Entities/EntityHelper_Tests.cs index 52ab34baee..adf82d74bd 100644 --- a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Entities/EntityHelper_Tests.cs +++ b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Entities/EntityHelper_Tests.cs @@ -55,6 +55,11 @@ public class EntityHelper_Tests { return new object[] { Id }; } + + public string GetObjectKey() + { + return Id.ToString(); + } } private class MyEntityDisablesIdGeneration : Entity diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestModule.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestModule.cs index 121ec62a85..5382d3db46 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestModule.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestModule.cs @@ -19,7 +19,7 @@ public class AbpJsonSystemTextJsonTestModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { if (options.JsonSerializerOptions.TypeInfoResolver != null) @@ -43,7 +43,7 @@ public class AbpJsonNewtonsoftTestModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { options.JsonSerializerSettings.ContractResolver = new AbpCamelCasePropertyNamesContractResolver( diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs index 4435f1dcf0..a2234aa14a 100644 --- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs +++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs @@ -34,7 +34,7 @@ public class AbpMemoryDbTestModule : AbpModule options.AddRepository(); }); - context.Services.AddOptions() + context.Services.AddAbpOptions() .Configure((options, rootServiceProvider) => { options.JsonSerializerOptions.Converters.Add(new EntityJsonConverter()); diff --git a/latest-versions.json b/latest-versions.json index 7b3e4c5e79..59f9c65cf3 100644 --- a/latest-versions.json +++ b/latest-versions.json @@ -1,4 +1,49 @@ [ + { + "version": "9.3.7", + "releaseDate": "", + "type": "stable", + "message": "", + "leptonx": { + "version": "4.3.7" + } + }, + { + "version": "10.0.1", + "releaseDate": "", + "type": "stable", + "message": "", + "leptonx": { + "version": "5.0.1" + } + }, + { + "version": "10.0.0", + "releaseDate": "", + "type": "stable", + "message": "", + "leptonx": { + "version": "5.0.0" + } + }, + { + "version": "9.3.6", + "releaseDate": "", + "type": "stable", + "message": "", + "leptonx": { + "version": "4.3.6" + } + }, + { + "version": "9.3.5", + "releaseDate": "", + "type": "stable", + "message": "", + "leptonx": { + "version": "4.3.5" + } + }, { "version": "9.3.4", "releaseDate": "", diff --git a/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx b/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx index d8a41ccb9d..9863504e7c 100644 --- a/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx +++ b/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx @@ -5,6 +5,7 @@ + @@ -19,4 +20,4 @@ - + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs index ad002a5e18..713355636f 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs @@ -1,12 +1,11 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs; using Volo.Abp.Modularity; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.BackgroundJobs.DemoApp.Shared { - [DependsOn( - typeof(AbpBackgroundJobsModule) - )] + [DependsOn(typeof(AbpMultiTenancyModule))] public class DemoAppSharedModule : AbpModule { public override void OnPostApplicationInitialization(ApplicationInitializationContext context) diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs new file mode 100644 index 0000000000..6eca55e09f --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs @@ -0,0 +1,15 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using TickerQ.Utilities.Models; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +public class CleanupJobs +{ + public async Task CleanupLogsAsync(TickerFunctionContext tickerContext, CancellationToken cancellationToken) + { + var logFileName = tickerContext.Request; + Console.WriteLine($"Cleaning up log file: {logFileName} at {DateTime.Now}"); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs new file mode 100644 index 0000000000..c9a3b957de --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using TickerQ.Dashboard.DependencyInjection; +using TickerQ.DependencyInjection; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using TickerQ.Utilities.Interfaces.Managers; +using TickerQ.Utilities.Models; +using TickerQ.Utilities.Models.Ticker; +using Volo.Abp.AspNetCore; +using Volo.Abp.Autofac; +using Volo.Abp.BackgroundJobs.DemoApp.Shared; +using Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs; +using Volo.Abp.BackgroundJobs.TickerQ; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.BackgroundWorkers.TickerQ; +using Volo.Abp.Modularity; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +[DependsOn( + typeof(AbpBackgroundJobsTickerQModule), + typeof(AbpBackgroundWorkersTickerQModule), + typeof(DemoAppSharedModule), + typeof(AbpAutofacModule), + typeof(AbpAspNetCoreModule) +)] +public class DemoAppTickerQModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddTickerQ(options => + { + options.UpdateMissedJobCheckDelay(TimeSpan.FromSeconds(30)); + + options.AddDashboard(x => + { + x.BasePath = "/tickerq-dashboard"; + + x.UseHostAuthentication = true; + }); + }); + + Configure(options => + { + options.AddConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min, + Priority = TickerTaskPriority.High + }); + + options.AddConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 5, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min + }); + }); + + Configure(options => + { + options.AddConfiguration(new AbpBackgroundWorkersCronTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min, + Priority = TickerTaskPriority.High + }); + }); + } + + public override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context) + { + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => + { + var service = new CleanupJobs(); + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); + }))); + abpTickerQFunctionProvider.RequestTypes.TryAdd(nameof(CleanupJobs), (typeof(string).FullName, typeof(string))); + return Task.CompletedTask; + } + + public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context) + { + var backgroundWorkerManager = context.ServiceProvider.GetRequiredService(); + await backgroundWorkerManager.AddAsync(context.ServiceProvider.GetRequiredService()); + + var app = context.GetApplicationBuilder(); + app.UseAbpTickerQ(); + + var timeTickerManager = context.ServiceProvider.GetRequiredService>(); + await timeTickerManager.AddAsync(new TimeTicker + { + Function = nameof(CleanupJobs), + ExecutionTime = DateTime.UtcNow.AddSeconds(5), + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 3, + RetryIntervals = new[] { 30, 60, 120 }, // Retry after 30s, 60s, then 2min + }); + + var cronTickerManager = context.ServiceProvider.GetRequiredService>(); + await cronTickerManager.AddAsync(new CronTicker + { + Function = nameof(CleanupJobs), + Expression = "* * * * *", // Every minute + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 2, + RetryIntervals = new[] { 60, 300 } + }); + + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapGet("/", async httpContext => + { + httpContext.Response.Redirect("/tickerq-dashboard", true); + }); + }); + + await CancelableBackgroundJobAsync(context.ServiceProvider); + } + + private async Task CancelableBackgroundJobAsync(IServiceProvider serviceProvider) + { + var backgroundJobManager = serviceProvider.GetRequiredService(); + var jobId = await backgroundJobManager.EnqueueAsync(new LongRunningJobArgs { Value = "test-cancel-job" }); + await backgroundJobManager.EnqueueAsync(new LongRunningJobArgs { Value = "test-3" }); + + await Task.Delay(1000); + + var timeTickerManager = serviceProvider.GetRequiredService>(); + var result = await timeTickerManager.DeleteAsync(Guid.Parse(jobId)); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/MyBackgroundWorker.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/MyBackgroundWorker.cs new file mode 100644 index 0000000000..cd35b42bb4 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/MyBackgroundWorker.cs @@ -0,0 +1,22 @@ +using System; +using System.Threading.Tasks; +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +public class MyBackgroundWorker : AsyncPeriodicBackgroundWorkerBase +{ + public MyBackgroundWorker([NotNull] AbpAsyncTimer timer, [NotNull] IServiceScopeFactory serviceScopeFactory) : base(timer, serviceScopeFactory) + { + timer.Period = 60 * 1000; // 60 seconds + CronExpression = "* * * * *"; // every minute + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + Console.WriteLine($"MyBackgroundWorker executed at {DateTime.Now}"); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Program.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Program.cs new file mode 100644 index 0000000000..72e7f9090c --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Program.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +public class Program +{ + public static async Task Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + builder.Host.UseAutofac(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Properties/launchSettings.json b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Properties/launchSettings.json new file mode 100644 index 0000000000..1b8cdbbc25 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Properties/launchSettings.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Volo.Abp.BackgroundJobs.DemoApp.TickerQ": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Volo.Abp.BackgroundJobs.DemoApp.TickerQ.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Volo.Abp.BackgroundJobs.DemoApp.TickerQ.csproj new file mode 100644 index 0000000000..f30eba83dd --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Volo.Abp.BackgroundJobs.DemoApp.TickerQ.csproj @@ -0,0 +1,26 @@ + + + + Exe + net10.0 + + + + + + + + + + + + + + Always + + + Always + + + + diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/appsettings.json b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/appsettings.json new file mode 100644 index 0000000000..1b2d3bafd8 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} \ No newline at end of file diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml index 1e5f1b1fe7..5dc1619ec8 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml @@ -62,7 +62,7 @@
- +

@BrandingProvider.AppName

diff --git a/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs b/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs index 47447e1fdf..c239da4234 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs +++ b/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs @@ -11,7 +11,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.Account; diff --git a/modules/cms-kit/.abpstudio/state.json b/modules/cms-kit/.abpstudio/state.json new file mode 100644 index 0000000000..b0ef88d2f2 --- /dev/null +++ b/modules/cms-kit/.abpstudio/state.json @@ -0,0 +1,11 @@ +{ + "selectedKubernetesProfile": null, + "solutionRunner": { + "selectedProfile": null, + "targetFrameworks": [], + "applicationsStartingWithoutBuild": [], + "applicationsWithoutAutoRefreshBrowserOnRestart": [], + "applicationBatchStartStates": [], + "folderBatchStartStates": [] + } +} \ No newline at end of file diff --git a/modules/cms-kit/Volo.CmsKit.abpsln b/modules/cms-kit/Volo.CmsKit.abpsln index 3448e82475..ede7cc2be4 100644 --- a/modules/cms-kit/Volo.CmsKit.abpsln +++ b/modules/cms-kit/Volo.CmsKit.abpsln @@ -3,5 +3,6 @@ "Volo.CmsKit": { "path": "Volo.CmsKit.abpmdl" } - } + }, + "id": "aa47056c-6303-419e-bd08-cfcf1dc93ca0" } \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs index 1f451f58d9..bfc910c7c6 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.Hosting; using Volo.CmsKit.EntityFrameworkCore; using Volo.CmsKit.MultiTenancy; using StackExchange.Redis; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.AspNetCore.MultiTenancy; diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20251024065316_Status_Field_Added_To_Pages.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20251024065316_Status_Field_Added_To_Pages.Designer.cs new file mode 100644 index 0000000000..d7e470083f --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20251024065316_Status_Field_Added_To_Pages.Designer.cs @@ -0,0 +1,999 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +#nullable disable + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))] + [Migration("20251024065316_Status_Field_Added_To_Pages")] + partial class Status_Field_Added_To_Pages + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FeatureName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogFeatures", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CoverImageMediaId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IdempotencyToken") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.GlobalResources.GlobalResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CmsGlobalResources", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.MarkedItems.UserMarkedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId"); + + b.ToTable("CmsUserMarkedItems", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Menus.MenuItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CssClass") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ElementId") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Icon") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("PageId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequiredPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Target") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("Id"); + + b.ToTable("CmsMenuItems", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsHomePage") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LayoutName") + .HasColumnType("nvarchar(max)"); + + b.Property("Script") + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Style") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Slug"); + + b.ToTable("CmsPages", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags", (string)null); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("bit") + .HasColumnName("IsActive"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20251024065316_Status_Field_Added_To_Pages.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20251024065316_Status_Field_Added_To_Pages.cs new file mode 100644 index 0000000000..059824f63a --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20251024065316_Status_Field_Added_To_Pages.cs @@ -0,0 +1,632 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Volo.CmsKit.Migrations +{ + /// + public partial class Status_Field_Added_To_Pages : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsUsers", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsUsers", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsTags", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsTags", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsPages", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsPages", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "CmsPages", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "IsHomePage", + table: "CmsPages", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "LayoutName", + table: "CmsPages", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Status", + table: "CmsPages", + type: "int", + nullable: false, + defaultValue: 1); + + migrationBuilder.AlterColumn( + name: "Status", + table: "CmsPages", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsMenuItems", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsMenuItems", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AddColumn( + name: "RequiredPermissionName", + table: "CmsMenuItems", + type: "nvarchar(128)", + maxLength: 128, + nullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsMediaDescriptors", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsMediaDescriptors", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsGlobalResources", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsGlobalResources", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsComments", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsComments", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AddColumn( + name: "IdempotencyToken", + table: "CmsComments", + type: "nvarchar(32)", + maxLength: 32, + nullable: true); + + migrationBuilder.AddColumn( + name: "IsApproved", + table: "CmsComments", + type: "bit", + nullable: true); + + migrationBuilder.AddColumn( + name: "Url", + table: "CmsComments", + type: "nvarchar(512)", + maxLength: 512, + nullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsBlogs", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsBlogs", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsBlogPosts", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsBlogPosts", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "CmsBlogPosts", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsBlogFeatures", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsBlogFeatures", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "AbpBlobs", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "AbpBlobs", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "AbpBlobContainers", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "AbpBlobContainers", + type: "nvarchar(40)", + maxLength: 40, + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40, + oldNullable: true); + + migrationBuilder.CreateTable( + name: "CmsUserMarkedItems", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + EntityId = table.Column(type: "nvarchar(450)", nullable: false), + EntityType = table.Column(type: "nvarchar(450)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsUserMarkedItems", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUserMarkedItems_TenantId_CreatorId_EntityType_EntityId", + table: "CmsUserMarkedItems", + columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUserMarkedItems_TenantId_EntityType_EntityId", + table: "CmsUserMarkedItems", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CmsUserMarkedItems"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "CmsPages"); + + migrationBuilder.DropColumn( + name: "IsHomePage", + table: "CmsPages"); + + migrationBuilder.DropColumn( + name: "LayoutName", + table: "CmsPages"); + + migrationBuilder.DropColumn( + name: "Status", + table: "CmsPages"); + + migrationBuilder.DropColumn( + name: "RequiredPermissionName", + table: "CmsMenuItems"); + + migrationBuilder.DropColumn( + name: "IdempotencyToken", + table: "CmsComments"); + + migrationBuilder.DropColumn( + name: "IsApproved", + table: "CmsComments"); + + migrationBuilder.DropColumn( + name: "Url", + table: "CmsComments"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "CmsBlogPosts"); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsUsers", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsUsers", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsTags", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsTags", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsPages", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsPages", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsMenuItems", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsMenuItems", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsMediaDescriptors", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsMediaDescriptors", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsGlobalResources", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsGlobalResources", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsComments", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsComments", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsBlogs", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsBlogs", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsBlogPosts", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsBlogPosts", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "CmsBlogFeatures", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "CmsBlogFeatures", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "AbpBlobs", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "AbpBlobs", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + + migrationBuilder.AlterColumn( + name: "ExtraProperties", + table: "AbpBlobContainers", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "ConcurrencyStamp", + table: "AbpBlobContainers", + type: "nvarchar(40)", + maxLength: 40, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(40)", + oldMaxLength: 40); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs index 13ddfd47b2..09c7b6f4c2 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -19,10 +19,10 @@ namespace Volo.CmsKit.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") .HasAnnotation("Relational:MaxIdentifierLength", 128); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => { @@ -32,6 +32,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -44,6 +45,7 @@ namespace Volo.CmsKit.Migrations .HasColumnType("varbinary(max)"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -73,11 +75,13 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -105,6 +109,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -126,6 +131,7 @@ namespace Volo.CmsKit.Migrations .HasColumnName("DeletionTime"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -173,6 +179,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -194,6 +201,7 @@ namespace Volo.CmsKit.Migrations .HasColumnName("DeletionTime"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -238,6 +246,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -265,7 +274,11 @@ namespace Volo.CmsKit.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -321,6 +334,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -344,9 +358,17 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(64)"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); + b.Property("IdempotencyToken") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + b.Property("RepliedCommentId") .HasColumnType("uniqueidentifier"); @@ -359,6 +381,10 @@ namespace Volo.CmsKit.Migrations .HasMaxLength(512) .HasColumnType("nvarchar(512)"); + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + b.HasKey("Id"); b.HasIndex("TenantId", "RepliedCommentId"); @@ -376,6 +402,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -389,6 +416,7 @@ namespace Volo.CmsKit.Migrations .HasColumnName("CreatorId"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -419,6 +447,41 @@ namespace Volo.CmsKit.Migrations b.ToTable("CmsGlobalResources", (string)null); }); + modelBuilder.Entity("Volo.CmsKit.MarkedItems.UserMarkedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId"); + + b.ToTable("CmsUserMarkedItems", (string)null); + }); + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => { b.Property("Id") @@ -427,6 +490,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -453,6 +517,7 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(64)"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -501,6 +566,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -525,6 +591,7 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(max)"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -551,6 +618,10 @@ namespace Volo.CmsKit.Migrations b.Property("ParentId") .HasColumnType("uniqueidentifier"); + b.Property("RequiredPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("Target") .HasColumnType("nvarchar(max)"); @@ -576,6 +647,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -600,7 +672,11 @@ namespace Volo.CmsKit.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -610,6 +686,9 @@ namespace Volo.CmsKit.Migrations .HasDefaultValue(false) .HasColumnName("IsDeleted"); + b.Property("IsHomePage") + .HasColumnType("bit"); + b.Property("LastModificationTime") .HasColumnType("datetime2") .HasColumnName("LastModificationTime"); @@ -618,6 +697,9 @@ namespace Volo.CmsKit.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); + b.Property("LayoutName") + .HasColumnType("nvarchar(max)"); + b.Property("Script") .HasColumnType("nvarchar(max)"); @@ -626,6 +708,9 @@ namespace Volo.CmsKit.Migrations .HasMaxLength(256) .HasColumnType("nvarchar(256)"); + b.Property("Status") + .HasColumnType("int"); + b.Property("Style") .HasColumnType("nvarchar(max)"); @@ -751,6 +836,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -777,6 +863,7 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(64)"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -818,6 +905,7 @@ namespace Volo.CmsKit.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() + .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); @@ -835,6 +923,7 @@ namespace Volo.CmsKit.Migrations .HasColumnName("EmailConfirmed"); b.Property("ExtraProperties") + .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); diff --git a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs index 623b417bc7..933dc8f50b 100644 --- a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs @@ -8,7 +8,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Volo.CmsKit.MultiTenancy; using StackExchange.Redis; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.Account; diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs index 522771c77b..7054a6f1fe 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs @@ -2,7 +2,7 @@ using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using System.IO; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.DataProtection; diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index c216a6ba38..e8169fbfef 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -3,7 +3,7 @@ using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Volo.Abp; using Volo.Abp.Account; using Volo.Abp.Account.Web; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Menus/PageLookupInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Menus/PageLookupInputDto.cs index 12fc847917..299c116ece 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Menus/PageLookupInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Menus/PageLookupInputDto.cs @@ -1,5 +1,6 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Menus; @@ -7,4 +8,6 @@ namespace Volo.CmsKit.Admin.Menus; public class PageLookupInputDto : PagedAndSortedResultRequestDto { public string Filter { get; set; } + + public PageStatus? Status { get; set; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs index a62ede1f05..c5b92d5e6d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs @@ -28,4 +28,6 @@ public class CreatePageInputDto: ExtensibleObject [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxStyleLength))] public string Style { get; set; } + + public PageStatus Status { get; set; } = PageStatus.Draft; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs index 7275db931e..1fe3440ef2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs @@ -1,5 +1,6 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Pages; @@ -7,4 +8,6 @@ namespace Volo.CmsKit.Admin.Pages; public class GetPagesInputDto : PagedAndSortedResultRequestDto { public string Filter { get; set; } + + public PageStatus? Status { get; set; } = null; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs index 6fbcbd1866..c5e52e5369 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs @@ -1,6 +1,7 @@ using System; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Pages; @@ -21,5 +22,7 @@ public class PageDto : ExtensibleAuditedEntityDto, IHasConcurrencyStamp public bool IsHomePage { get; set; } + public PageStatus Status { get; set; } + public string ConcurrencyStamp { get; set; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs index 9e47ce54f0..5bca78fe1e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs @@ -30,5 +30,7 @@ public class UpdatePageInputDto : ExtensibleObject, IHasConcurrencyStamp [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxStyleLength))] public string Style { get; set; } + public PageStatus Status { get; set; } + public string ConcurrencyStamp { get; set; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Menus/MenuItemAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Menus/MenuItemAdminAppService.cs index d35579c6cf..5cca8553da 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Menus/MenuItemAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Menus/MenuItemAdminAppService.cs @@ -135,6 +135,7 @@ public class MenuItemAdminAppService : CmsKitAdminAppServiceBase, IMenuItemAdmin var pages = await PageRepository.GetListAsync( input.Filter, + input.Status, input.MaxResultCount, input.SkipCount, input.Sorting diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs index 2860946490..f3fed0642f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs @@ -49,10 +49,11 @@ public class PageAdminAppService : CmsKitAdminAppServiceBase, IPageAdminAppServi public virtual async Task> GetListAsync(GetPagesInputDto input) { - var count = await PageRepository.GetCountAsync(input.Filter); + var count = await PageRepository.GetCountAsync(input.Filter, input.Status); var pages = await PageRepository.GetListAsync( input.Filter, + input.Status, input.MaxResultCount, input.SkipCount, input.Sorting @@ -67,7 +68,7 @@ public class PageAdminAppService : CmsKitAdminAppServiceBase, IPageAdminAppServi [Authorize(CmsKitAdminPermissions.Pages.Create)] public virtual async Task CreateAsync(CreatePageInputDto input) { - var page = await PageManager.CreateAsync(input.Title, input.Slug, input.Content, input.Script, input.Style, input.LayoutName); + var page = await PageManager.CreateAsync(input.Title, input.Slug, input.Content, input.Script, input.Style, input.LayoutName, input.Status); input.MapExtraPropertiesTo(page); await PageRepository.InsertAsync(page); @@ -94,6 +95,7 @@ public class PageAdminAppService : CmsKitAdminAppServiceBase, IPageAdminAppServi page.SetScript(input.Script); page.SetStyle(input.Style); page.SetLayoutName(input.LayoutName); + await PageManager.SetStatusAsync(page, input.Status); page.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); input.MapExtraPropertiesTo(page); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json index 0b3a4ffb71..dc870f6878 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json @@ -37,7 +37,7 @@ }, { "name": "assignToBlogId", - "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", + "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", "type": "System.Guid?", "typeSimple": "string?", "isOptional": true, @@ -419,7 +419,7 @@ }, { "name": "assignToBlogId", - "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", + "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", "type": "System.Guid?", "typeSimple": "string?", "isOptional": false, @@ -1011,8 +1011,8 @@ "nameOnMethod": "input", "name": "Status", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "Volo.CmsKit.Blogs.BlogPostStatus?", + "typeSimple": "enum?", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -1532,8 +1532,8 @@ "nameOnMethod": "input", "name": "CommentApproveState", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "Volo.CmsKit.Comments.CommentApproveState", + "typeSimple": "enum", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -2190,7 +2190,7 @@ "parametersOnMethod": [ { "name": "parentId", - "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", + "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", "type": "System.Guid?", "typeSimple": "string?", "isOptional": true, @@ -2475,6 +2475,18 @@ "bindingSourceId": "ModelBinding", "descriptorName": "input" }, + { + "nameOnMethod": "input", + "name": "Status", + "jsonName": null, + "type": "Volo.CmsKit.Pages.PageStatus?", + "typeSimple": "enum?", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, { "nameOnMethod": "input", "name": "Sorting", @@ -2565,7 +2577,7 @@ "parametersOnMethod": [ { "name": "parentId", - "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", + "typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", "type": "System.Guid?", "typeSimple": "string?", "isOptional": true, @@ -2787,6 +2799,18 @@ "bindingSourceId": "ModelBinding", "descriptorName": "input" }, + { + "nameOnMethod": "input", + "name": "Status", + "jsonName": null, + "type": "Volo.CmsKit.Pages.PageStatus?", + "typeSimple": "enum?", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, { "nameOnMethod": "input", "name": "Sorting", diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/Volo.CmsKit.Admin.HttpApi.Client.abppkg b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/Volo.CmsKit.Admin.HttpApi.Client.abppkg index 7deef5e383..6e9b2ad635 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/Volo.CmsKit.Admin.HttpApi.Client.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/Volo.CmsKit.Admin.HttpApi.Client.abppkg @@ -1,3 +1,15 @@ { - "role": "lib.http-api-client" + "role": "lib.http-api-client", + "proxies": { + "csharp": { + "Volo.CmsKit.Web.Unified-cms-kit-admin": { + "applicationName": "Volo.CmsKit.Web.Unified", + "module": "cms-kit-admin", + "url": "https://localhost:44349", + "folder": "ClientProxies", + "serviceType": "all", + "withoutContracts": true + } + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml index 7aabd2e3f2..989de47cab 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml @@ -38,7 +38,7 @@ \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs index 96d3f218c6..86c855ca26 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs @@ -56,5 +56,8 @@ public class CreateModel : CmsKitAdminPageModel [TextArea(Rows = 6)] [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxStyleLength))] public string Style { get; set; } + + [HiddenInput] + public PageStatus Status { get; set; } = PageStatus.Draft; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml index 710f703798..6c7a85855f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml @@ -69,6 +69,8 @@ + + @@ -126,7 +128,8 @@ - + + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs index fff1f814e5..09f431938f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs @@ -69,6 +69,9 @@ public class UpdateModel : CmsKitAdminPageModel [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxStyleLength))] public string Style { get; set; } + [HiddenInput] + public PageStatus Status { get; set; } + [HiddenInput] public string ConcurrencyStamp { get; set; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js index 1b3ccea05f..ca7ab72cdc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js @@ -4,7 +4,8 @@ $(function () { var $createForm = $('#form-page-create'); var $title = $('#ViewModel_Title'); var $slug = $('#ViewModel_Slug'); - var $buttonSubmit = $('#button-page-create'); + var $buttonSaveDraft = $('#button-page-save-draft'); + var $buttonPublish = $('#button-page-publish'); var widgetModal = new abp.ModalManager({ viewUrl: abp.appPath + "CmsKit/Contents/AddWidgetModal", modalClass: "addWidgetModal" }); @@ -49,8 +50,15 @@ $(function () { } }); - $buttonSubmit.click(function (e) { + $buttonSaveDraft.click(function (e) { e.preventDefault(); + $('#ViewModel_Status').val(0); // Draft = 0 + $createForm.submit(); + }); + + $buttonPublish.click(function (e) { + e.preventDefault(); + $('#ViewModel_Status').val(1); // Published = 1 $createForm.submit(); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js index 30d807df48..c2d3d2afd0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js @@ -75,6 +75,14 @@ $(function () { orderable: true, data: "slug" }, + { + title: l("Status"), + orderable: true, + data: "status", + render: function (data) { + return l('Enum:PageStatus:' + data); + } + }, { title: l("IsHomePage"), orderable: true, diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js index d75fb9bdda..a58e601135 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js @@ -3,7 +3,8 @@ $(function () { var l = abp.localization.getResource("CmsKit"); var $formUpdate = $('#form-page-update'); - var $buttonSubmit = $('#button-page-update'); + var $buttonSaveDraft = $('#button-page-save-draft'); + var $buttonPublish = $('#button-page-publish'); var widgetModal = new abp.ModalManager({ viewUrl: abp.appPath + "CmsKit/Contents/AddWidgetModal", modalClass: "addWidgetModal" }); $formUpdate.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; @@ -43,8 +44,15 @@ $(function () { } }); - $buttonSubmit.click(function (e) { + $buttonSaveDraft.click(function (e) { e.preventDefault(); + $('#ViewModel_Status').val(0); // Draft = 0 + $formUpdate.submit(); + }); + + $buttonPublish.click(function (e) { + e.preventDefault(); + $('#ViewModel_Status').val(1); // Published = 1 $formUpdate.submit(); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg index 33a45483d7..6a728eb0d6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.abppkg @@ -2,7 +2,18 @@ "role": "lib.mvc", "npmDependencies": { "@abp/cms-kit.admin": { - "version": "" + "version": "" + } + }, + "proxies": { + "Javascript": { + "Volo.CmsKit.Web.Unified-cms-kit-admin": { + "applicationName": "Volo.CmsKit.Web.Unified", + "module": "cms-kit-admin", + "url": "https://localhost:44349", + "output": "wwwroot/client-proxies/", + "serviceType": "application" + } } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js index 928d7c11b9..875fd5c948 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/wwwroot/client-proxies/cms-kit-admin-proxy.js @@ -340,7 +340,7 @@ volo.cmsKit.admin.menus.menuItemAdmin.getPageLookup = function(input, ajaxParams) { return abp.ajax($.extend(true, { - url: abp.appPath + 'api/cms-kit-admin/menu-items/lookup/pages' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', + url: abp.appPath + 'api/cms-kit-admin/menu-items/lookup/pages' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'status', value: input.status }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', type: 'GET' }, ajaxParams)); }; @@ -376,7 +376,7 @@ volo.cmsKit.admin.pages.pageAdmin.getList = function(input, ajaxParams) { return abp.ajax($.extend(true, { - url: abp.appPath + 'api/cms-kit-admin/pages' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', + url: abp.appPath + 'api/cms-kit-admin/pages' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'status', value: input.status }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', type: 'GET' }, ajaxParams)); }; diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs index e81a882baa..e00ec6bb34 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs @@ -1,5 +1,6 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Contents; @@ -16,4 +17,6 @@ public class PageDto : ExtensibleEntityDto public string Script { get; set; } public string Style { get; set; } + + public PageStatus Status { get; set; } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi.Client/Volo.CmsKit.Common.HttpApi.Client.abppkg b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi.Client/Volo.CmsKit.Common.HttpApi.Client.abppkg index 7deef5e383..97cf7d524f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi.Client/Volo.CmsKit.Common.HttpApi.Client.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi.Client/Volo.CmsKit.Common.HttpApi.Client.abppkg @@ -1,3 +1,15 @@ { - "role": "lib.http-api-client" + "role": "lib.http-api-client", + "proxies": { + "csharp": { + "Volo.CmsKit.Web.Unified-cms-kit-common": { + "applicationName": "Volo.CmsKit.Web.Unified", + "module": "cms-kit-common", + "url": "https://localhost:44349", + "folder": "ClientProxies", + "serviceType": "all", + "withoutContracts": true + } + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs index 754f2263a0..7d081b09d9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs @@ -7,6 +7,8 @@ using Volo.CmsKit.Reactions; using Volo.CmsKit.Web.Icons; using Markdig; using Microsoft.Extensions.DependencyInjection; +using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Web.Contents; namespace Volo.CmsKit.Web; @@ -54,6 +56,11 @@ public class CmsKitCommonWebModule : AbpModule { options.DisableModule(CmsKitCommonRemoteServiceConsts.ModuleName); }); + + Configure(options => + { + options.AddWidgetIfFeatureEnabled(typeof(CommentsFeature), "Comment", "CmsCommenting", "CmsKitCommentConfiguration"); + }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfiguration.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfiguration.cshtml new file mode 100644 index 0000000000..08b46e4e61 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfiguration.cshtml @@ -0,0 +1,11 @@ +@using Microsoft.Extensions.Localization +@using Volo.CmsKit.Localization +@using Volo.CmsKit.Web.Pages.CmsKit.Components.Comments +@inject IStringLocalizer L +@model CmsKitCommentConfigurationViewModel + +
+ + + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfigurationViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfigurationViewComponent.cs new file mode 100644 index 0000000000..1c4f847bf9 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfigurationViewComponent.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.Comments; + +[Widget] +[ViewComponent(Name = "CmsKitCommentConfiguration")] +public class CmsKitCommentConfigurationViewComponent : AbpViewComponent +{ + public IViewComponentResult Invoke() + { + return View("~/Pages/CmsKit/Components/Comments/CmsKitCommentConfiguration.cshtml", new CmsKitCommentConfigurationViewModel()); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfigurationViewModel.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfigurationViewModel.cs new file mode 100644 index 0000000000..721a4dd2a2 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Comments/CmsKitCommentConfigurationViewModel.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.Comments; + +public class CmsKitCommentConfigurationViewModel +{ + [Required] + public string EntityType { get; set; } + + [Required] + public string EntityId { get; set; } + + public bool IsReadOnly { get; set; } = false; +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/CmsKitContentWidgetOptions.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/CmsKitContentWidgetOptions.cs index ad643f7770..d879eb9dce 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/CmsKitContentWidgetOptions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/CmsKitContentWidgetOptions.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Reflection; +using Volo.Abp; +using Volo.Abp.GlobalFeatures; namespace Volo.CmsKit.Web.Contents; @@ -16,4 +20,21 @@ public class CmsKitContentWidgetOptions var config = new ContentWidgetConfig(widgetName, parameterWidgetName); WidgetConfigs.Add(widgetType, config); } + + public void AddWidgetIfFeatureEnabled(Type globalFeatureType, string widgetType, string widgetName, string parameterWidgetName = null) + { + Check.NotNull(globalFeatureType, nameof(globalFeatureType)); + + if (globalFeatureType.GetCustomAttribute() == null) + { + throw new ArgumentException($"The type {globalFeatureType.Name} must have a {nameof(GlobalFeatureNameAttribute)} attribute.", nameof(globalFeatureType)); + } + + if (!GlobalFeatureManager.Instance.IsEnabled(globalFeatureType)) + { + return; + } + + AddWidget(widgetType, widgetName, parameterWidgetName); + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.abppkg b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.abppkg index 930c4018b3..1b83a52bfe 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.abppkg @@ -1,3 +1,14 @@ { - "role": "lib.mvc" + "role": "lib.mvc", + "proxies": { + "Javascript": { + "Volo.CmsKit.Web.Unified-cms-kit-common": { + "applicationName": "Volo.CmsKit.Web.Unified", + "module": "cms-kit-common", + "url": "https://localhost:44349", + "output": "wwwroot/client-proxies/", + "serviceType": "application" + } + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ar.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ar.json index 5c80242f60..c051fe6f3b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ar.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ar.json @@ -262,5 +262,7 @@ "SelectAnBlogToAssign": "حدد مدونة لتعيين مشاركات المدونة إليها", "DeleteAllBlogPostsOfThisBlog": "حذف جميع مشاركات المدونة", "RequiredPermissionName": "اسم الإذن المطلوب", + "AllPosts": "جميع المشاركات", + "IsReadOnly": "للقراءة فقط" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/cs.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/cs.json index 17e549f7a7..f7040b3044 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/cs.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/cs.json @@ -280,6 +280,8 @@ "AssignBlogPostsToOtherBlog": "Přiřaďte blogové příspěvky k jinému blogu", "SelectAnBlogToAssign": "Vyberte blog, ke kterému chcete přiřadit blogové příspěvky", "DeleteAllBlogPostsOfThisBlog": "Smazat všechny blogové příspěvky tohoto blogu", - "RequiredPermissionName": "Je vyžadováno oprávnění" + "RequiredPermissionName": "Je vyžadováno oprávnění", + "AllPosts": "Všechny příspěvky", + "IsReadOnly": "Pouze pro čtení" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de-DE.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de-DE.json index 452ccdc80e..6d87ffcc99 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de-DE.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de-DE.json @@ -168,6 +168,8 @@ "AssignBlogPostsToOtherBlog": "Blogbeiträge einem anderen Blog zuweisen", "SelectAnBlogToAssign": "Wählen Sie einen Blog aus, um Blogbeiträge zuzuweisen", "DeleteAllBlogPostsOfThisBlog": "Alle Blogbeiträge dieses Blogs löschen", - "RequiredPermissionName": "Erforderlicher Berechtigungsname" + "RequiredPermissionName": "Erforderlicher Berechtigungsname", + "AllPosts": "Alle Beiträge", + "IsReadOnly": "Schreibgeschützt" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de.json index 2acbea186c..d5d9d8d1b0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/de.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Blogbeiträge einem anderen Blog zuweisen", "SelectAnBlogToAssign": "Wählen Sie einen Blog aus, um Blogbeiträge zuzuweisen", "DeleteAllBlogPostsOfThisBlog": "Alle Blogbeiträge dieses Blogs löschen", - "RequiredPermissionName": "Erforderlicher Berechtigungsname" + "RequiredPermissionName": "Erforderlicher Berechtigungsname", + "AllPosts": "Alle Beiträge", + "IsReadOnly": "Schreibgeschützt" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/el.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/el.json index d21bc31626..897e02a07d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/el.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/el.json @@ -191,6 +191,8 @@ "AssignBlogPostsToOtherBlog": "Ανάθεση αναρτήσεων ιστολογίου σε άλλο ιστολόγιο", "SelectAnBlogToAssign": "Επιλέξτε ένα ιστολόγιο για να αναθέσετε αναρτήσεις ιστολογίου", "DeleteAllBlogPostsOfThisBlog": "Διαγραφή όλων των αναρτήσεων ιστολογίου αυτού του ιστολογίου", - "RequiredPermissionName": "Απαιτούμενο όνομα δικαιώματος" + "RequiredPermissionName": "Απαιτούμενο όνομα δικαιώματος", + "AllPosts": "Όλες οι δημοσιεύσεις", + "IsReadOnly": "Μόνο για ανάγνωση" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en-GB.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en-GB.json index 76125e555a..290dc26fe5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en-GB.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en-GB.json @@ -33,6 +33,8 @@ "AssignBlogPostsToOtherBlog": "Assign blog posts to another blog", "SelectAnBlogToAssign": "Select a blog to assign", "DeleteAllBlogPostsOfThisBlog": "Delete all blog posts of this blog", - "RequiredPermissionName": "Required permission name" + "RequiredPermissionName": "Required permission name", + "AllPosts": "All posts", + "IsReadOnly": "Readonly" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 5fe1f311c9..364df5ab2d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -3,6 +3,7 @@ "texts": { "AddSubMenuItem": "Add Sub Menu Item", "AreYouSure": "Are You Sure?", + "AverageRating": "Average Rating", "BlogDeletionConfirmationMessage": "The blog '{0}' will be deleted. Are you sure?", "BlogFeatureNotAvailable": "This feature is not available now. Enable with 'GlobalFeatureManager' to use it.", "BlogId": "Blog", @@ -168,6 +169,7 @@ "Text": "Text", "ThankYou": "Thank you", "Title": "Title", + "TotalRatings": "Total Ratings", "Undo": "Undo", "Update": "Update", "UpdatePreferenceSuccessMessage": "Your preferences have been saved.", @@ -279,6 +281,10 @@ "AssignBlogPostsToOtherBlog": "Assign blog posts to another blog", "SelectAnBlogToAssign": "Select a blog to assign", "DeleteAllBlogPostsOfThisBlog": "Delete all blog posts of this blog", - "RequiredPermissionName": "Required permission name" + "RequiredPermissionName": "Required permission name", + "Enum:PageStatus:0": "Draft", + "Enum:PageStatus:1": "Publish", + "AllPosts": "All posts", + "IsReadOnly": "Readonly" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/es.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/es.json index cd0338627e..5396f02fd4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/es.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/es.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Asignar publicaciones de blog a otro blog", "SelectAnBlogToAssign": "Seleccione un blog para asignar publicaciones de blog", "DeleteAllBlogPostsOfThisBlog": "Eliminar todas las publicaciones de blog de este blog", - "RequiredPermissionName": "Nombre de permiso requerido" + "RequiredPermissionName": "Nombre de permiso requerido", + "AllPosts": "Todas las publicaciones", + "IsReadOnly": "Solo lectura" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fa.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fa.json index ec12f091bc..8769a8cb4c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fa.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fa.json @@ -190,6 +190,8 @@ "AssignBlogPostsToOtherBlog": "پست های وبلاگ را به وبلاگ دیگری اختصاص دهید", "SelectAnBlogToAssign": "یک وبلاگ برای اختصاص دادن انتخاب کنید", "DeleteAllBlogPostsOfThisBlog": "تمام پست های وبلاگ این وبلاگ را حذف کنید", - "RequiredPermissionName": "نام مجوز مورد نیاز" + "RequiredPermissionName": "نام مجوز مورد نیاز", + "AllPosts": "همه پست ها", + "IsReadOnly": "فقط خواندنی" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fi.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fi.json index 1559b2f85b..4e9eb5123f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fi.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fi.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Määritä blogiviestit toiseen blogiin", "SelectAnBlogToAssign": "Valitse blogi, johon haluat määrittää", "DeleteAllBlogPostsOfThisBlog": "Poista tämän blogin kaikki blogiviestit", - "RequiredPermissionName": "Tarvittava lupa" + "RequiredPermissionName": "Tarvittava lupa", + "AllPosts": "Kaikki viestit", + "IsReadOnly": "Vain luku" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fr.json index 96594d2e58..2d2ff61a3c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/fr.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Attribuer des articles de blog à un autre blog", "SelectAnBlogToAssign": "Sélectionnez un blog à attribuer", "DeleteAllBlogPostsOfThisBlog": "Supprimer tous les articles de blog de ce blog", - "RequiredPermissionName": "Nom de permission requis" + "RequiredPermissionName": "Nom de permission requis", + "AllPosts": "Tous les messages", + "IsReadOnly": "Lecture seule" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hi.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hi.json index fb0f9c902d..d0ba97001c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hi.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hi.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "अन्य ब्लॉग को ब्लॉग पोस्ट असाइन करें", "SelectAnBlogToAssign": "असाइन करने के लिए एक ब्लॉग चुनें", "DeleteAllBlogPostsOfThisBlog": "इस ब्लॉग के सभी ब्लॉग पोस्ट हटाएं", - "RequiredPermissionName": "आवश्यक अनुमति नाम" + "RequiredPermissionName": "आवश्यक अनुमति नाम", + "AllPosts": "सभी पोस्ट", + "IsReadOnly": "केवल पढ़ने के लिए" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hr.json index 87e8f6c01e..30f65f12c9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hr.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Dodijelite postove na blogu drugom blogu", "SelectAnBlogToAssign": "Odaberite blog za dodjelu", "DeleteAllBlogPostsOfThisBlog": "Izbrišite sve postove na blogu", - "RequiredPermissionName": "Potrebno ime dozvole" + "RequiredPermissionName": "Potrebno ime dozvole", + "AllPosts": "Sve objave", + "IsReadOnly": "Samo za čitanje" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hu.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hu.json index d02aeb6f02..1505e39597 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hu.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/hu.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Blogbejegyzések hozzárendelése egy másik bloghoz", "SelectAnBlogToAssign": "Válasszon egy blogot a hozzárendeléshez", "DeleteAllBlogPostsOfThisBlog": "Ez a művelet törli az összes blogbejegyzést ebből a blogból. Biztos vagy benne?", - "RequiredPermissionName": "Szükséges engedély neve" + "RequiredPermissionName": "Szükséges engedély neve", + "AllPosts": "Minden bejegyzés", + "IsReadOnly": "Csak olvasható" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/is.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/is.json index fcb661cfc4..d31c9316ea 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/is.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/is.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Úthluta bloggfærslum til annars bloggs", "SelectAnBlogToAssign": "Veldu blogg til að úthluta", "DeleteAllBlogPostsOfThisBlog": "Eyða öllum bloggfærslum þessa bloggs", - "RequiredPermissionName": "Nafn á nauðsynlegri leyfi" + "RequiredPermissionName": "Nafn á nauðsynlegri leyfi", + "AllPosts": "Allar færslur", + "IsReadOnly": "Skrifvarið" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/it.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/it.json index 7a2c4a1e37..da69759dff 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/it.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/it.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Assegna i post del blog ad un altro blog", "SelectAnBlogToAssign": "Seleziona un blog a cui assegnare i post del blog", "DeleteAllBlogPostsOfThisBlog": "Elimina tutti i post del blog di questo blog", - "RequiredPermissionName": "Nome del permesso richiesto" + "RequiredPermissionName": "Nome del permesso richiesto", + "AllPosts": "Tutti i post", + "IsReadOnly": "Sola lettura" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json index 54b5baa48f..6d95e6aa36 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Wijs blogberichten toe aan een andere blog", "SelectAnBlogToAssign": "Selecteer een blog om toe te wijzen", "DeleteAllBlogPostsOfThisBlog": "Verwijder alle blogberichten van deze blog", - "RequiredPermissionName": "Vereiste toestemming" + "RequiredPermissionName": "Vereiste toestemming", + "AllPosts": "Alle berichten", + "IsReadOnly": "Alleen-lezen" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pl-PL.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pl-PL.json index 5ab1453c8a..7bb4e8e471 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pl-PL.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pl-PL.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Przypisz posty na blogu do innego bloga", "SelectAnBlogToAssign": "Wybierz blog, do którego chcesz przypisać posty na blogu", "DeleteAllBlogPostsOfThisBlog": "Usuń wszystkie posty na blogu tego bloga", - "RequiredPermissionName": "Wymagana nazwa uprawnienia" + "RequiredPermissionName": "Wymagana nazwa uprawnienia", + "AllPosts": "Wszystkie posty", + "IsReadOnly": "Tylko do odczytu" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pt-BR.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pt-BR.json index 0b1f87b2f3..3b3fa3db92 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pt-BR.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/pt-BR.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Atribuir postagens de blog a outro blog", "SelectAnBlogToAssign": "Selecione um blog para atribuir", "DeleteAllBlogPostsOfThisBlog": "Excluir todas as postagens de blog deste blog", - "RequiredPermissionName": "Nome da permissão necessária" + "RequiredPermissionName": "Nome da permissão necessária", + "AllPosts": "Todas as postagens", + "IsReadOnly": "Somente leitura" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ro-RO.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ro-RO.json index 5ab74bd0b3..0a283006be 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ro-RO.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ro-RO.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Atribuiţi postările de blog la alt blog", "SelectAnBlogToAssign": "Selectaţi un blog pentru a atribui postările de blog", "DeleteAllBlogPostsOfThisBlog": "Ştergeţi toate postările de blog ale acestui blog", - "RequiredPermissionName": "Numele permisiunii necesare" + "RequiredPermissionName": "Numele permisiunii necesare", + "AllPosts": "Toate postările", + "IsReadOnly": "Doar citire" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ru.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ru.json index f731f20b79..8123f37403 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ru.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/ru.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Назначить сообщения в блоге другому блогу", "SelectAnBlogToAssign": "Выберите блог для назначения", "DeleteAllBlogPostsOfThisBlog": "Удалить все сообщения в блоге этого блога", - "RequiredPermissionName": "Имя требуемого разрешения" + "RequiredPermissionName": "Имя требуемого разрешения", + "AllPosts": "Все записи", + "IsReadOnly": "Только для чтения" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sk.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sk.json index ea95b5fb1c..ddc10c923c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sk.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sk.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Priradiť blogové príspevky k inému blogu", "SelectAnBlogToAssign": "Vyberte blog, na ktorý chcete priradiť blogové príspevky", "DeleteAllBlogPostsOfThisBlog": "Zmazať všetky blogové príspevky tohto blogu", - "RequiredPermissionName": "Požadovaný názov oprávnenia" + "RequiredPermissionName": "Požadovaný názov oprávnenia", + "AllPosts": "Všetky príspevky", + "IsReadOnly": "Iba na čítanie" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sl.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sl.json index 038a70314f..83c9ec57b4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sl.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sl.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Dodeli objave v blogu drugemu blogu", "SelectAnBlogToAssign": "Izberite blog, ki mu želite dodeliti objave", "DeleteAllBlogPostsOfThisBlog": "Izbriši vse objave v tem blogu", - "RequiredPermissionName": "Ime zahtevane dovoljenja" + "RequiredPermissionName": "Ime zahtevane dovoljenja", + "AllPosts": "Vse objave", + "IsReadOnly": "Samo za branje" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sv.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sv.json index 7ef69c9280..3b6d296da4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sv.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/sv.json @@ -261,6 +261,8 @@ "AssignBlogPostsToOtherBlog": "Tilldela blogginlägg till en annan blogg", "SelectAnBlogToAssign": "Välj en blogg att tilldela", "DeleteAllBlogPostsOfThisBlog": "Radera alla blogginlägg i denna blogg", - "RequiredPermissionName": "Nödvändigt behörighetsnamn" + "RequiredPermissionName": "Nödvändigt behörighetsnamn", + "AllPosts": "Alla inlägg", + "IsReadOnly": "Skrivskyddad" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index a807465682..e338aaff68 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -225,6 +225,8 @@ "AssignBlogPostsToOtherBlog": "Diğer bloglara blog yazıları atayın", "SelectAnBlogToAssign": "Atanacak bir blog seçin", "DeleteAllBlogPostsOfThisBlog": "Bu blogun tüm blog yazılarını sil", - "RequiredPermissionName": "Gerekli izin adı" + "RequiredPermissionName": "Gerekli izin adı", + "AllPosts": "Tüm gönderiler", + "IsReadOnly": "Salt okunur" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/vi.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/vi.json index b37066739b..d7d608659f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/vi.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/vi.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "Gán bài đăng trên blog cho blog khác", "SelectAnBlogToAssign": "Chọn một blog để gán", "DeleteAllBlogPostsOfThisBlog": "Xóa tất cả bài đăng trên blog của blog này", - "RequiredPermissionName": "Tên quyền cần thiết" + "RequiredPermissionName": "Tên quyền cần thiết", + "AllPosts": "Tất cả bài viết", + "IsReadOnly": "Chỉ đọc" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json index 017cb60592..3b4edf6e8f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "将博客文章分配给其他博客", "SelectAnBlogToAssign": "选择要分配的博客", "DeleteAllBlogPostsOfThisBlog": "删除此博客的所有博客文章", - "RequiredPermissionName": "所需权限名称" + "RequiredPermissionName": "所需权限名称", + "AllPosts": "所有帖子", + "IsReadOnly": "只读" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hant.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hant.json index 0f7a486a02..d8b0ed9f67 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hant.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hant.json @@ -234,6 +234,8 @@ "AssignBlogPostsToOtherBlog": "將部落格文章分配給其他部落格", "SelectAnBlogToAssign": "選擇要分配的部落格", "DeleteAllBlogPostsOfThisBlog": "刪除此部落格的所有部落格文章", - "RequiredPermissionName": "所需權限名稱" + "RequiredPermissionName": "所需權限名稱", + "AllPosts": "所有文章", + "IsReadOnly": "唯讀" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageCacheItem.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageCacheItem.cs index d4d662a8a6..5696b2566e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageCacheItem.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageCacheItem.cs @@ -20,6 +20,8 @@ public class PageCacheItem : ExtensibleObject public string Style { get; set; } + public PageStatus Status { get; set; } + public static string GetKey(string slug) { return $"CmsPage_{slug}"; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageStatus.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageStatus.cs new file mode 100644 index 0000000000..037b4f8d48 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageStatus.cs @@ -0,0 +1,8 @@ +namespace Volo.CmsKit.Pages; + +public enum PageStatus +{ + Draft = 0, + Publish = 1 +} + diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs index 2add03f1fd..e2a95d0b03 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs @@ -8,10 +8,11 @@ namespace Volo.CmsKit.Pages; public interface IPageRepository : IBasicRepository { - Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default); + Task GetCountAsync(string filter = null, PageStatus? status = null, CancellationToken cancellationToken = default); Task> GetListAsync( string filter = null, + PageStatus? status = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs index b1f611abc6..f73031fbfe 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs @@ -27,6 +27,8 @@ public class Page : FullAuditedAggregateRoot, IMultiTenant, IHasEntityVers public virtual string LayoutName { get; protected set; } + public virtual PageStatus Status { get; protected set; } + protected Page() { } @@ -39,7 +41,8 @@ public class Page : FullAuditedAggregateRoot, IMultiTenant, IHasEntityVers string script = null, string style = null, string layoutName = null, - Guid? tenantId = null) : base(id) + Guid? tenantId = null, + PageStatus status = PageStatus.Draft) : base(id) { TenantId = tenantId; @@ -49,6 +52,7 @@ public class Page : FullAuditedAggregateRoot, IMultiTenant, IHasEntityVers SetScript(script); SetStyle(style); SetLayoutName(layoutName); + SetStatus(status); } public virtual void SetTitle(string title) @@ -85,4 +89,9 @@ public class Page : FullAuditedAggregateRoot, IMultiTenant, IHasEntityVers { IsHomePage = isHomePage; } + + public virtual void SetStatus(PageStatus status) + { + Status = status; + } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageManager.cs index a94602c54a..73393ba56b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageManager.cs @@ -21,7 +21,8 @@ public class PageManager : DomainService [CanBeNull] string content = null, [CanBeNull] string script = null, [CanBeNull] string style = null, - [CanBeNull] string layoutName = null) + [CanBeNull] string layoutName = null, + PageStatus status = PageStatus.Draft) { Check.NotNullOrEmpty(title, nameof(title)); Check.NotNullOrEmpty(slug, nameof(slug)); @@ -36,7 +37,8 @@ public class PageManager : DomainService script, style, layoutName, - CurrentTenant.Id); + CurrentTenant.Id, + status); } public virtual async Task SetSlugAsync(Page page, [NotNull] string newSlug) @@ -48,6 +50,12 @@ public class PageManager : DomainService } } + public virtual Task SetStatusAsync(Page page, PageStatus status) + { + page.SetStatus(status); + return Task.CompletedTask; + } + public virtual async Task SetHomePageAsync(Page page) { var homePage = await GetHomePageAsync(); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index c5b93022c6..91a5da82b8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -168,6 +168,7 @@ public static class CmsKitDbContextModelCreatingExtensions b.Property(x => x.Title).IsRequired().HasMaxLength(PageConsts.MaxTitleLength); b.Property(x => x.Slug).IsRequired().HasMaxLength(PageConsts.MaxSlugLength); b.Property(x => x.Content).HasMaxLength(PageConsts.MaxContentLength); + b.Property(x => x.Status).IsRequired(); b.HasIndex(x => new { x.TenantId, Url = x.Slug }); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 4af6bf18f3..a8fdc22f84 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -20,17 +20,20 @@ public class EfCorePageRepository : EfCoreRepository GetCountAsync(string filter = null, + PageStatus? status = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).WhereIf( !filter.IsNullOrWhiteSpace(), x => - x.Title.ToLower().Contains(filter.ToLower()) || x.Slug.Contains(filter) - ).CountAsync(GetCancellationToken(cancellationToken)); + x.Title.ToLower().Contains(filter.ToLower()) || x.Slug.ToLower().Contains(filter.ToLower()) + ).WhereIf(status.HasValue, x => x.Status == status) + .CountAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( string filter = null, + PageStatus? status = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -39,7 +42,8 @@ public class EfCorePageRepository : EfCoreRepository - x.Title.ToLower().Contains(filter.ToLower()) || x.Slug.Contains(filter)) + x.Title.ToLower().Contains(filter.ToLower()) || x.Slug.ToLower().Contains(filter.ToLower())) + .WhereIf(status.HasValue, x => x.Status == status) .OrderBy(sorting.IsNullOrEmpty() ? nameof(Page.Title) : sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs index 7c2f9a3891..7f51c79b3d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -22,6 +22,7 @@ public class MongoPageRepository : MongoDbRepository GetCountAsync(string filter = null, + PageStatus? status = null, CancellationToken cancellationToken = default) { var cancellation = GetCancellationToken(cancellationToken); @@ -30,12 +31,14 @@ public class MongoPageRepository : MongoDbRepository - u.Title.ToLower().Contains(filter.ToLower()) || u.Slug.Contains(filter) - ).CountAsync(cancellation); + u.Title.ToLower().Contains(filter.ToLower()) || u.Slug.ToLower().Contains(filter.ToLower()) + ).WhereIf(status.HasValue, u => u.Status == status) + .CountAsync(cancellation); } public virtual async Task> GetListAsync( string filter = null, + PageStatus? status = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -46,7 +49,8 @@ public class MongoPageRepository : MongoDbRepository u.Title.ToLower().Contains(filter) || u.Slug.Contains(filter)) + u => u.Title.ToLower().Contains(filter.ToLower()) || u.Slug.ToLower().Contains(filter.ToLower())) + .WhereIf(status.HasValue, u => u.Status == status) .OrderBy(sorting.IsNullOrEmpty() ? nameof(Page.Title) : sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(cancellation); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PagePublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PagePublicAppService.cs index cd0191e20d..b69a2e18d6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PagePublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PagePublicAppService.cs @@ -54,6 +54,12 @@ public class PagePublicAppService : CmsKitPublicAppServiceBase, IPagePublicAppSe return null; } + // Only return published home page + if (page.Status != PageStatus.Publish) + { + return null; + } + pageCacheItem = ObjectMapper.Map(page); await PageCache.SetAsync(PageCacheItem.GetKey(PageConsts.DefaultHomePageCacheKey), pageCacheItem, @@ -81,6 +87,12 @@ public class PagePublicAppService : CmsKitPublicAppServiceBase, IPagePublicAppSe return null; } + // Only return published pages + if (page.Status != PageStatus.Publish) + { + return null; + } + return ObjectMapper.Map(page); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json index 3bee77cf96..84211158e3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json @@ -256,6 +256,18 @@ "bindingSourceId": "ModelBinding", "descriptorName": "input" }, + { + "nameOnMethod": "input", + "name": "FilterOnFavorites", + "jsonName": null, + "type": "System.Boolean?", + "typeSimple": "boolean?", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, { "nameOnMethod": "input", "name": "Sorting", diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/Volo.CmsKit.Public.HttpApi.Client.abppkg b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/Volo.CmsKit.Public.HttpApi.Client.abppkg index 7deef5e383..07b3df7494 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/Volo.CmsKit.Public.HttpApi.Client.abppkg +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/Volo.CmsKit.Public.HttpApi.Client.abppkg @@ -1,3 +1,15 @@ { - "role": "lib.http-api-client" + "role": "lib.http-api-client", + "proxies": { + "csharp": { + "Volo.CmsKit.Web.Unified-cms-kit": { + "applicationName": "Volo.CmsKit.Web.Unified", + "module": "cms-kit", + "url": "https://localhost:44349", + "folder": "ClientProxies", + "serviceType": "all", + "withoutContracts": true + } + } + } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/Default.cshtml index 95879128a7..0c0a1dc8f5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/Default.cshtml @@ -5,32 +5,37 @@ @model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating.RatingViewModel @inject IHtmlLocalizer L +@{ + var modalId = "ratingDetail_" + Model.EntityType + "_" + Model.EntityId; + modalId = modalId.Replace(".", "-").Replace(":", "-").Replace("/", "-").Replace(" ", "-"); + var modalLabelId = modalId + "_label"; +} +
@if (CurrentUser.IsAuthenticated) { - @if (!Model.IsReadOnly && Model.CurrentRating != null) + @if (Model.Ratings != null) { - - @L["Undo"] - - } - if (Model.Ratings != null) - { - + -
public virtual DateTimeOffset? LastPasswordChangeTime { get; protected set; } + /// + /// Gets or sets the last sign-in time for the user. + /// + public virtual DateTimeOffset? LastSignInTime { get; protected set; } + //TODO: Can we make collections readonly collection, which will provide encapsulation. But... can work for all ORMs? /// @@ -154,6 +159,16 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer /// public virtual ICollection OrganizationUnits { get; protected set; } + /// + /// Navigation property for this users password history. + /// + public virtual ICollection PasswordHistories { get; protected set; } + + /// + /// Navigation property for this users passkeys. + /// + public virtual ICollection Passkeys { get; protected set; } + protected IdentityUser() { } @@ -182,6 +197,8 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer Logins = new Collection(); Tokens = new Collection(); OrganizationUnits = new Collection(); + PasswordHistories = new Collection(); + Passkeys = new Collection(); } public virtual void AddRole(Guid roleId) @@ -345,6 +362,15 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer ); } + public virtual void AddPasswordHistory(string password) + { + PasswordHistories.Add(new IdentityUserPasswordHistory( + Id, + password, + TenantId) + ); + } + /// /// Use for regular email confirmation. /// Using this skips the confirmation process and directly sets the . @@ -388,6 +414,27 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer LastPasswordChangeTime = lastPasswordChangeTime; } + public virtual void SetLastSignInTime(DateTimeOffset? lastSignInTime) + { + LastSignInTime = lastSignInTime; + } + + [CanBeNull] + public virtual IdentityUserPasskey FindPasskey(byte[] credentialId) + { + return Passkeys.FirstOrDefault(x => x.UserId == Id && x.CredentialId.SequenceEqual(credentialId)); + } + + public virtual void AddPasskey(byte[] credentialId, IdentityPasskeyData passkeyData) + { + Passkeys.Add(new IdentityUserPasskey(Id, credentialId, passkeyData, TenantId)); + } + + public virtual void RemovePasskey(byte[] credentialId) + { + Passkeys.RemoveAll(x => x.CredentialId.SequenceEqual(credentialId)); + } + public override string ToString() { return $"{base.ToString()}, UserName = {UserName}"; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasskey.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasskey.cs new file mode 100644 index 0000000000..59aad98ea6 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasskey.cs @@ -0,0 +1,53 @@ +using System; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.Identity; + +/// +/// Represents a passkey credential for a user in the identity system. +/// +/// +/// See . +/// +public class IdentityUserPasskey : Entity, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + + /// + /// Gets or sets the primary key of the user that owns this passkey. + /// + public virtual Guid UserId { get; protected set; } + + /// + /// Gets or sets the credential ID for this passkey. + /// + public virtual byte[] CredentialId { get; set; } + + /// + /// Gets or sets additional data associated with this passkey. + /// + public virtual IdentityPasskeyData Data { get; set; } + + protected IdentityUserPasskey() + { + + } + + public IdentityUserPasskey( + Guid userId, + byte[] credentialId, + IdentityPasskeyData data, + Guid? tenantId) + { + UserId = userId; + CredentialId = credentialId; + Data = data; + TenantId = tenantId; + } + + public override object[] GetKeys() + { + return new object[] { UserId, CredentialId }; + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasskeyExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasskeyExtensions.cs new file mode 100644 index 0000000000..fd1bd3fbf5 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasskeyExtensions.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Identity; + +namespace Volo.Abp.Identity; + +public static class IdentityUserPasskeyExtensions +{ + public static void UpdateFromUserPasskeyInfo(this IdentityUserPasskey passkey, UserPasskeyInfo passkeyInfo) + { + passkey.Data.Name = passkeyInfo.Name; + passkey.Data.SignCount = passkeyInfo.SignCount; + passkey.Data.IsBackedUp = passkeyInfo.IsBackedUp; + passkey.Data.IsUserVerified = passkeyInfo.IsUserVerified; + } + + public static UserPasskeyInfo ToUserPasskeyInfo(this IdentityUserPasskey passkey) + { + return new UserPasskeyInfo( + passkey.CredentialId, + passkey.Data.PublicKey, + passkey.Data.CreatedAt, + passkey.Data.SignCount, + passkey.Data.Transports, + passkey.Data.IsUserVerified, + passkey.Data.IsBackupEligible, + passkey.Data.IsBackedUp, + passkey.Data.AttestationObject, + passkey.Data.ClientDataJson) + { + Name = passkey.Data.Name + }; + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasswordHistory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasswordHistory.cs new file mode 100644 index 0000000000..cdfd94b35d --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasswordHistory.cs @@ -0,0 +1,49 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.Identity; + +/// +/// Represents a password history entry for a user. +/// +public class IdentityUserPasswordHistory : Entity, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + + /// + /// Gets or sets the primary key of the user associated with this password history entry. + /// + public virtual Guid UserId { get; protected set; } + + /// + /// Gets or sets the password. + /// + public virtual string Password { get; protected set; } + + public virtual DateTimeOffset CreatedAt { get; protected set; } + + protected IdentityUserPasswordHistory() + { + + } + + protected internal IdentityUserPasswordHistory( + Guid userId, + [NotNull] string password, + Guid? tenantId) + { + Check.NotNull(password, nameof(password)); + + UserId = userId; + Password = password; + CreatedAt = DateTimeOffset.UtcNow; + TenantId = tenantId; + } + + public override object[] GetKeys() + { + return new object[] { UserId, Password }; + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs index 83fe745677..f407e6c977 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs @@ -32,6 +32,7 @@ public class IdentityUserStore : IUserAuthenticationTokenStore, IUserAuthenticatorKeyStore, IUserTwoFactorRecoveryCodeStore, + IUserPasskeyStore, ITransientDependency { private const string InternalLoginProvider = "[AspNetUserStore]"; @@ -1123,6 +1124,110 @@ public class IdentityUserStore : return Task.FromResult(RecoveryCodeTokenName); } + /// + /// Creates a new passkey credential in the store for the specified , + /// or updates an existing passkey. + /// + /// The user to create the passkey credential for. + /// + /// The used to propagate notifications that the operation should be canceled. + /// The that represents the asynchronous operation. + public virtual async Task AddOrUpdatePasskeyAsync(IdentityUser user, UserPasskeyInfo passkey, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Passkeys, cancellationToken); + + var userPasskey = user.FindPasskey(passkey.CredentialId); + if (userPasskey != null) + { + userPasskey.UpdateFromUserPasskeyInfo(passkey); + } + else + { + user.AddPasskey(passkey.CredentialId, new IdentityPasskeyData() + { + PublicKey = passkey.PublicKey, + Name = passkey.Name, + CreatedAt = passkey.CreatedAt, + Transports = passkey.Transports, + SignCount = passkey.SignCount, + IsUserVerified = passkey.IsUserVerified, + IsBackupEligible = passkey.IsBackupEligible, + IsBackedUp = passkey.IsBackedUp, + AttestationObject = passkey.AttestationObject, + ClientDataJson = passkey.ClientDataJson, + }); + } + } + + /// + /// Gets the passkey credentials for the specified . + /// + /// The user whose passkeys should be retrieved. + /// The used to propagate notifications that the operation should be canceled. + /// The that represents the asynchronous operation, containing a list of the user's passkeys. + public virtual async Task> GetPasskeysAsync(IdentityUser user, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + Check.NotNull(user, nameof(user)); + + await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Passkeys, cancellationToken); + + return user.Passkeys.Select(p => p.ToUserPasskeyInfo()).ToList(); + } + + /// + /// Finds and returns a user, if any, associated with the specified passkey credential identifier. + /// + /// The passkey credential id to search for. + /// The used to propagate notifications that the operation should be canceled. + /// + /// The that represents the asynchronous operation, containing the user, if any, associated with the specified passkey credential id. + /// + public virtual async Task FindByPasskeyIdAsync(byte[] credentialId, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + return await UserRepository.FindByPasskeyIdAsync(credentialId, cancellationToken: cancellationToken); + } + + /// + /// Finds a passkey for the specified user with the specified credential id. + /// + /// The user whose passkey should be retrieved. + /// The credential id to search for. + /// The used to propagate notifications that the operation should be canceled. + /// The that represents the asynchronous operation, containing the user's passkey information. + public virtual async Task FindPasskeyAsync(IdentityUser user, byte[] credentialId, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + Check.NotNull(user, nameof(user)); + Check.NotNull(credentialId, nameof(credentialId)); + + await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Passkeys, cancellationToken); + return user.FindPasskey(credentialId)?.ToUserPasskeyInfo(); + } + + /// + /// Removes a passkey credential from the specified . + /// + /// The user to remove the passkey credential from. + /// The credential id of the passkey to remove. + /// The used to propagate notifications that the operation should be canceled. + /// The that represents the asynchronous operation. + public virtual async Task RemovePasskeyAsync(IdentityUser user, byte[] credentialId, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + Check.NotNull(user, nameof(user)); + Check.NotNull(credentialId, nameof(credentialId)); + + await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Passkeys, cancellationToken); + user.RemovePasskey(credentialId); + } + public virtual void Dispose() { diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs index 3ec1b2fbb1..48d8b01a73 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs @@ -1,16 +1,21 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; namespace Volo.Abp.Identity; public class UserRoleFinder : IUserRoleFinder, ITransientDependency { protected IIdentityUserRepository IdentityUserRepository { get; } + protected IIdentityRoleRepository IdentityRoleRepository { get; } - public UserRoleFinder(IIdentityUserRepository identityUserRepository) + public UserRoleFinder(IIdentityUserRepository identityUserRepository, IIdentityRoleRepository identityRoleRepository) { IdentityUserRepository = identityUserRepository; + IdentityRoleRepository = identityRoleRepository; } [Obsolete("Use GetRoleNamesAsync instead.")] @@ -19,8 +24,62 @@ public class UserRoleFinder : IUserRoleFinder, ITransientDependency return (await IdentityUserRepository.GetRoleNamesAsync(userId)).ToArray(); } - public async Task GetRoleNamesAsync(Guid userId) + public virtual async Task GetRoleNamesAsync(Guid userId) { return (await IdentityUserRepository.GetRoleNamesAsync(userId)).ToArray(); } + + public virtual async Task> SearchUserAsync(string filter, int page = 1) + { + using (IdentityUserRepository.DisableTracking()) + { + page = page < 1 ? 1 : page; + var users = await IdentityUserRepository.GetListAsync(filter: filter, skipCount: (page - 1) * 10, maxResultCount: 10); + return users.Select(user => new UserFinderResult + { + Id = user.Id, + UserName = user.UserName + }).ToList(); + } + } + + public virtual async Task> SearchRoleAsync(string filter, int page = 1) + { + using (IdentityUserRepository.DisableTracking()) + { + page = page < 1 ? 1 : page; + var roles = await IdentityRoleRepository.GetListAsync(filter: filter, skipCount: (page - 1) * 10, maxResultCount: 10); + return roles.Select(user => new RoleFinderResult + { + Id = user.Id, + RoleName = user.Name + }).ToList(); + } + } + + public virtual async Task> SearchUserByIdsAsync(Guid[] ids) + { + using (IdentityUserRepository.DisableTracking()) + { + var users = await IdentityUserRepository.GetListByIdsAsync(ids); + return users.Select(user => new UserFinderResult + { + Id = user.Id, + UserName = user.UserName + }).ToList(); + } + } + + public virtual async Task> SearchRoleByNamesAsync(string[] names) + { + using (IdentityUserRepository.DisableTracking()) + { + var roles = await IdentityRoleRepository.GetListAsync(names); + return roles.Select(user => new RoleFinderResult + { + Id = user.Id, + RoleName = user.Name + }).ToList(); + } + } } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs index ca6dc42d6f..1da7758f19 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs @@ -72,6 +72,13 @@ public class EfCoreIdentityRoleRepository : EfCoreRepository> GetListAsync(IEnumerable names, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(t => names.Contains(t.Name)) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetDefaultOnesAsync( bool includeDetails = false, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index 25646ac90a..68c05738db 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -94,6 +94,15 @@ public class EfCoreIdentityUserRepository : EfCoreRepository x.Id).Select(x => new IdentityUserIdWithRoleNames { Id = x.Key, RoleNames = x.SelectMany(y => y.RoleNames).Distinct().ToArray() }).ToList(); } + public virtual async Task FindByPasskeyIdAsync(byte[] credentialId, bool includeDetails = true, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .IncludeDetails(includeDetails) + .Where(u => u.Passkeys.Any(x => x.CredentialId.SequenceEqual(credentialId))) + .OrderBy(x => x.Id) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetRoleNamesInOrganizationUnitAsync( Guid id, CancellationToken cancellationToken = default) @@ -468,11 +477,11 @@ public class EfCoreIdentityUserRepository : EfCoreRepository x.Id == id); - } + } if (roleId.HasValue) { diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index f94f4690cc..2b302e4cf8 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -46,6 +46,8 @@ public static class IdentityDbContextModelBuilderExtensions b.HasMany(u => u.Roles).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); b.HasMany(u => u.Tokens).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); b.HasMany(u => u.OrganizationUnits).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); + b.HasMany(u => u.PasswordHistories).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); + b.HasMany(u => u.Passkeys).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); b.HasIndex(u => u.NormalizedUserName); b.HasIndex(u => u.NormalizedEmail); @@ -175,6 +177,20 @@ public static class IdentityDbContextModelBuilderExtensions }); } + builder.Entity(b => + { + b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "UserPasskeys", AbpIdentityDbProperties.DbSchema); + + b.ConfigureByConvention(); + + b.HasKey(p => p.CredentialId); + + b.Property(p => p.CredentialId).HasMaxLength(IdentityUserPasskeyConsts.MaxCredentialIdLength); // Defined in WebAuthn spec to be no longer than 1023 bytes + b.OwnsOne(p => p.Data).ToJson(); + + b.ApplyObjectExtensionMappings(); + }); + builder.Entity(b => { b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "OrganizationUnits", AbpIdentityDbProperties.DbSchema); @@ -224,6 +240,19 @@ public static class IdentityDbContextModelBuilderExtensions b.ApplyObjectExtensionMappings(); }); + builder.Entity(b => + { + b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "UserPasswordHistories", AbpIdentityDbProperties.DbSchema); + + b.ConfigureByConvention(); + + b.HasKey(x => new { x.UserId, x.Password }); + + b.Property(x => x.Password).HasMaxLength(IdentityUserPasswordHistoriesConsts.MaxPasswordLength).IsRequired(); + + b.ApplyObjectExtensionMappings(); + }); + builder.Entity(b => { b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "SecurityLogs", AbpIdentityDbProperties.DbSchema); diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs index 2f04fbbe62..b5ce878a4f 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs @@ -17,7 +17,9 @@ public static class IdentityEfCoreQueryableExtensions .Include(x => x.Logins) .Include(x => x.Claims) .Include(x => x.Tokens) - .Include(x => x.OrganizationUnits); + .Include(x => x.OrganizationUnits) + .Include(x => x.PasswordHistories) + .Include(x => x.Passkeys); } public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/Volo/Abp/Identity/Integration/IdentityUserIntegrationClientProxy.Generated.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/Volo/Abp/Identity/Integration/IdentityUserIntegrationClientProxy.Generated.cs index 1c2f1b61cb..ddbb2cfc55 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/Volo/Abp/Identity/Integration/IdentityUserIntegrationClientProxy.Generated.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/Volo/Abp/Identity/Integration/IdentityUserIntegrationClientProxy.Generated.cs @@ -52,6 +52,14 @@ public partial class IdentityUserIntegrationClientProxy : ClientProxyBase> SearchByIdsAsync(Guid[] ids) + { + return await RequestAsync>(nameof(SearchByIdsAsync), new ClientProxyRequestTypeValue + { + { typeof(Guid[]), ids } + }); + } + public virtual async Task GetCountAsync(UserLookupCountInputDto input) { return await RequestAsync(nameof(GetCountAsync), new ClientProxyRequestTypeValue @@ -59,4 +67,28 @@ public partial class IdentityUserIntegrationClientProxy : ClientProxyBase> SearchRoleAsync(RoleLookupSearchInputDto input) + { + return await RequestAsync>(nameof(SearchRoleAsync), new ClientProxyRequestTypeValue + { + { typeof(RoleLookupSearchInputDto), input } + }); + } + + public virtual async Task> SearchRoleByNamesAsync(String[] names) + { + return await RequestAsync>(nameof(SearchRoleByNamesAsync), new ClientProxyRequestTypeValue + { + { typeof(String[]), names } + }); + } + + public virtual async Task GetRoleCountAsync(RoleLookupCountInputDto input) + { + return await RequestAsync(nameof(GetRoleCountAsync), new ClientProxyRequestTypeValue + { + { typeof(RoleLookupCountInputDto), input } + }); + } } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json index 33efd0a6e7..3937d99aa9 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json @@ -200,6 +200,18 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { @@ -673,6 +685,18 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { @@ -1220,6 +1244,18 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { @@ -1348,6 +1384,23 @@ "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" } }, + { + "name": "SearchByIdsAsync", + "parametersOnMethod": [ + { + "name": "ids", + "typeAsString": "System.Guid[], System.Private.CoreLib", + "type": "System.Guid[]", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, { "name": "GetCountAsync", "parametersOnMethod": [ @@ -1364,6 +1417,57 @@ "type": "System.Int64", "typeSimple": "number" } + }, + { + "name": "SearchRoleAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.RoleLookupSearchInputDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.RoleLookupSearchInputDto", + "typeSimple": "Volo.Abp.Identity.RoleLookupSearchInputDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, + { + "name": "SearchRoleByNamesAsync", + "parametersOnMethod": [ + { + "name": "ids", + "typeAsString": "System.String[], System.Private.CoreLib", + "type": "System.String[]", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, + { + "name": "GetRoleCountAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.RoleLookupCountInputDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.RoleLookupCountInputDto", + "typeSimple": "Volo.Abp.Identity.RoleLookupCountInputDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Int64", + "typeSimple": "number" + } } ] } @@ -1544,6 +1648,55 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Identity.Integration.IIdentityUserIntegrationService" + }, + "SearchByIdsAsyncByIds": { + "uniqueName": "SearchByIdsAsyncByIds", + "name": "SearchByIdsAsync", + "httpMethod": "GET", + "url": "integration-api/identity/users/search/by-ids", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "ids", + "typeAsString": "System.Guid[], System.Private.CoreLib", + "type": "System.Guid[]", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "ids", + "name": "ids", + "jsonName": null, + "type": "System.Guid[]", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" } ], "returnValue": { @@ -1589,6 +1742,165 @@ }, "allowAnonymous": null, "implementFrom": "Volo.Abp.Identity.Integration.IIdentityUserIntegrationService" + }, + "SearchRoleAsyncByInput": { + "uniqueName": "SearchRoleAsyncByInput", + "name": "SearchRoleAsync", + "httpMethod": "GET", + "url": "integration-api/identity/users/search/roles", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.RoleLookupSearchInputDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.RoleLookupSearchInputDto", + "typeSimple": "Volo.Abp.Identity.RoleLookupSearchInputDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "Sorting", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Identity.Integration.IIdentityUserIntegrationService" + }, + "SearchRoleByNamesAsyncByNames": { + "uniqueName": "SearchRoleByNamesAsyncByNames", + "name": "SearchRoleByNamesAsync", + "httpMethod": "GET", + "url": "integration-api/identity/users/search/roles/by-names", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "names", + "typeAsString": "System.String[], System.Private.CoreLib", + "type": "System.String[]", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "names", + "name": "names", + "jsonName": null, + "type": "System.String[]", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Identity.Integration.IIdentityUserIntegrationService" + }, + "GetRoleCountAsyncByInput": { + "uniqueName": "GetRoleCountAsyncByInput", + "name": "GetRoleCountAsync", + "httpMethod": "GET", + "url": "integration-api/identity/users/count/roles", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.RoleLookupCountInputDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.RoleLookupCountInputDto", + "typeSimple": "Volo.Abp.Identity.RoleLookupCountInputDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "System.Int64", + "typeSimple": "number" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Identity.Integration.IIdentityUserIntegrationService" } } } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs index 201c9f3eb0..ed7f0f5382 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; @@ -25,8 +26,59 @@ public class HttpClientUserRoleFinder : IUserRoleFinder, ITransientDependency return output.Items.Select(r => r.Name).ToArray(); } - public async Task GetRoleNamesAsync(Guid userId) + public virtual async Task GetRoleNamesAsync(Guid userId) { return await _userIntegrationService.GetRoleNamesAsync(userId); } + + public virtual async Task> SearchUserAsync(string filter, int page = 1) + { + page = page < 1 ? 1 : page; + var users = await _userIntegrationService.SearchAsync(new UserLookupSearchInputDto() + { + Filter = filter, + SkipCount = (page - 1) * 10 + }); + return users.Items.Select(u => new UserFinderResult + { + Id = u.Id, + UserName = u.UserName + }).ToList(); + } + + public virtual async Task> SearchRoleAsync(string filter, int page = 1) + { + page = page < 1 ? 1 : page; + var roles = await _userIntegrationService.SearchRoleAsync(new RoleLookupSearchInputDto() + { + Filter = filter, + SkipCount = (page - 1) * 10 + }); + + return roles.Items.Select(r => new RoleFinderResult + { + Id = r.Id, + RoleName = r.Name + }).ToList(); + } + + public virtual async Task> SearchUserByIdsAsync(Guid[] ids) + { + var users = await _userIntegrationService.SearchByIdsAsync(ids); + return users.Items.Select(u => new UserFinderResult + { + Id = u.Id, + UserName = u.UserName + }).ToList(); + } + + public virtual async Task> SearchRoleByNamesAsync(string[] names) + { + var roles = await _userIntegrationService.SearchRoleByNamesAsync(names); + return roles.Items.Select(r => new RoleFinderResult + { + Id = r.Id, + RoleName = r.Name + }).ToList(); + } } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs index 2a84385e48..a30b73d5cd 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs @@ -20,7 +20,7 @@ public class IdentityUserIntegrationController : AbpControllerBase, IIdentityUse { UserIntegrationService = userIntegrationService; } - + [HttpGet] [Route("{id}/role-names")] public virtual Task GetRoleNamesAsync(Guid id) @@ -49,10 +49,38 @@ public class IdentityUserIntegrationController : AbpControllerBase, IIdentityUse return UserIntegrationService.SearchAsync(input); } + [HttpGet] + [Route("search/by-ids")] + public virtual Task> SearchByIdsAsync(Guid[] ids) + { + return UserIntegrationService.SearchByIdsAsync(ids); + } + [HttpGet] [Route("count")] public Task GetCountAsync(UserLookupCountInputDto input) { return UserIntegrationService.GetCountAsync(input); } -} \ No newline at end of file + + [HttpGet] + [Route("search/roles")] + public virtual Task> SearchRoleAsync(RoleLookupSearchInputDto input) + { + return UserIntegrationService.SearchRoleAsync(input); + } + + [HttpGet] + [Route("search/roles/by-names")] + public virtual Task> SearchRoleByNamesAsync(string[] names) + { + return UserIntegrationService.SearchRoleByNamesAsync(names); + } + + [HttpGet] + [Route("count/roles")] + public virtual Task GetRoleCountAsync(RoleLookupCountInputDto input) + { + return UserIntegrationService.GetRoleCountAsync(input); + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs index 7deee94160..f613a3ee88 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs @@ -78,6 +78,13 @@ public class MongoIdentityRoleRepository : MongoDbRepository> GetListAsync(IEnumerable names, CancellationToken cancellationToken = default) + { + return await (await GetQueryableAsync(cancellationToken)) + .Where(x => names.Contains(x.Name)) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetDefaultOnesAsync( bool includeDetails = false, CancellationToken cancellationToken = default) diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index 29b9817e05..2a8654cd3b 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -443,6 +443,14 @@ public class MongoIdentityUserRepository : MongoDbRepository FindByPasskeyIdAsync(byte[] credentialId, bool includeDetails = true, CancellationToken cancellationToken = default) + { + return await (await GetQueryableAsync(cancellationToken)) + .Where(u => u.Passkeys.Any(x => x.CredentialId == credentialId)) + .OrderBy(x => x.Id) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + protected virtual async Task> GetFilteredQueryableAsync( string filter = null, Guid? roleId = null, diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js index 250abbc47b..6de3aeb8d5 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js @@ -20,7 +20,7 @@ volo.abp.identity.identityRole.getList = function(input, ajaxParams) { return abp.ajax($.extend(true, { - url: abp.appPath + 'api/identity/roles' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', + url: abp.appPath + 'api/identity/roles' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'extraProperties', value: input.extraProperties }]) + '', type: 'GET' }, ajaxParams)); }; @@ -73,7 +73,7 @@ volo.abp.identity.identityUser.getList = function(input, ajaxParams) { return abp.ajax($.extend(true, { - url: abp.appPath + 'api/identity/users' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', + url: abp.appPath + 'api/identity/users' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'extraProperties', value: input.extraProperties }]) + '', type: 'GET' }, ajaxParams)); }; @@ -163,7 +163,7 @@ volo.abp.identity.identityUserLookup.search = function(input, ajaxParams) { return abp.ajax($.extend(true, { - url: abp.appPath + 'api/identity/users/lookup/search' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '', + url: abp.appPath + 'api/identity/users/lookup/search' + abp.utils.buildQueryString([{ name: 'filter', value: input.filter }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'extraProperties', value: input.extraProperties }]) + '', type: 'GET' }, ajaxParams)); }; diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs index 973577ccff..43399a134d 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/AbpPermissionManagementDomainIdentityModule.cs @@ -1,4 +1,5 @@ using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.Users; @@ -22,6 +23,12 @@ public class AbpPermissionManagementDomainIdentityModule : AbpModule //TODO: Can we prevent duplication of permission names without breaking the design and making the system complicated options.ProviderPolicies[UserPermissionValueProvider.ProviderName] = "AbpIdentity.Users.ManagePermissions"; options.ProviderPolicies[RolePermissionValueProvider.ProviderName] = "AbpIdentity.Roles.ManagePermissions"; + + options.ResourceManagementProviders.Add(); + options.ResourceManagementProviders.Add(); + + options.ResourcePermissionProviderKeyLookupServices.Add(); + options.ResourcePermissionProviderKeyLookupServices.Add(); }); } } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs index cb63b2681a..82200f763f 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus; @@ -14,15 +15,18 @@ public class RoleDeletedEventHandler : ITransientDependency { protected IPermissionManager PermissionManager { get; } + protected IResourcePermissionManager ResourcePermissionManager { get; } - public RoleDeletedEventHandler(IPermissionManager permissionManager) + public RoleDeletedEventHandler(IPermissionManager permissionManager, IResourcePermissionManager resourcePermissionManager) { PermissionManager = permissionManager; + ResourcePermissionManager = resourcePermissionManager; } [UnitOfWork] public virtual async Task HandleEventAsync(EntityDeletedEto eventData) { await PermissionManager.DeleteAsync(RolePermissionValueProvider.ProviderName, eventData.Entity.Name); + await ResourcePermissionManager.DeleteAsync(RoleResourcePermissionValueProvider.ProviderName, eventData.Entity.Name); } } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs index e97d524cd7..5cd2dda193 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs @@ -49,9 +49,8 @@ public class RolePermissionManagementProvider : PermissionManagementProvider } - if (providerName == UserPermissionValueProvider.ProviderName) + if (providerName == UserPermissionValueProvider.ProviderName && Guid.TryParse(providerKey, out var userId)) { - var userId = Guid.Parse(providerKey); var roleNames = await UserRoleFinder.GetRoleNamesAsync(userId); foreach (var roleName in roleNames) diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleResourcePermissionManagementProvider.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleResourcePermissionManagementProvider.cs new file mode 100644 index 0000000000..bce070130c --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleResourcePermissionManagementProvider.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; +using Volo.Abp.Identity; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement.Identity; + +public class RoleResourcePermissionManagementProvider : ResourcePermissionManagementProvider +{ + public override string Name => RoleResourcePermissionValueProvider.ProviderName; + + protected IUserRoleFinder UserRoleFinder { get; } + + public RoleResourcePermissionManagementProvider( + IResourcePermissionGrantRepository resourcepPrmissionGrantRepository, + IGuidGenerator guidGenerator, + ICurrentTenant currentTenant, + IUserRoleFinder userRoleFinder) + : base( + resourcepPrmissionGrantRepository, + guidGenerator, + currentTenant) + { + UserRoleFinder = userRoleFinder; + } + + public override async Task CheckAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + var multipleGrantInfo = await CheckAsync(new[] { name }, resourceName, resourceKey, providerName, providerKey); + + return multipleGrantInfo.Result.Values.First(); + } + + public override async Task CheckAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey) + { + using (ResourcePermissionGrantRepository.DisableTracking()) + { + var multiplePermissionValueProviderGrantInfo = new MultipleResourcePermissionValueProviderGrantInfo(names); + var resourcePermissionGrants = new List(); + + if (providerName == Name) + { + resourcePermissionGrants.AddRange(await ResourcePermissionGrantRepository.GetListAsync(names, resourceName, resourceKey, providerName, providerKey)); + } + + if (providerName == UserResourcePermissionValueProvider.ProviderName && Guid.TryParse(providerKey, out var userId)) + { + var roleNames = await UserRoleFinder.GetRoleNamesAsync(userId); + + foreach (var roleName in roleNames) + { + resourcePermissionGrants.AddRange(await ResourcePermissionGrantRepository.GetListAsync(names, resourceName, resourceKey, Name, roleName)); + } + } + + resourcePermissionGrants = resourcePermissionGrants.Distinct().ToList(); + if (!resourcePermissionGrants.Any()) + { + return multiplePermissionValueProviderGrantInfo; + } + + foreach (var permissionName in names) + { + var resourcePermissionGrant = resourcePermissionGrants.FirstOrDefault(x => x.Name == permissionName); + if (resourcePermissionGrant != null) + { + multiplePermissionValueProviderGrantInfo.Result[permissionName] = new ResourcePermissionValueProviderGrantInfo(true, resourcePermissionGrant.ProviderKey); + } + } + + return multiplePermissionValueProviderGrantInfo; + } + } +} diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleResourcePermissionProviderKeyLookupService.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleResourcePermissionProviderKeyLookupService.cs new file mode 100644 index 0000000000..fa9fc31f79 --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleResourcePermissionProviderKeyLookupService.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Identity; +using Volo.Abp.Identity.Localization; +using Volo.Abp.Localization; + +namespace Volo.Abp.PermissionManagement.Identity; + +public class RoleResourcePermissionProviderKeyLookupService : IResourcePermissionProviderKeyLookupService, ITransientDependency +{ + public string Name => RoleResourcePermissionValueProvider.ProviderName; + + public ILocalizableString DisplayName { get; } + + protected IUserRoleFinder UserRoleFinder { get; } + + public RoleResourcePermissionProviderKeyLookupService(IUserRoleFinder userRoleFinder) + { + UserRoleFinder = userRoleFinder; + DisplayName = LocalizableString.Create(nameof(RoleResourcePermissionProviderKeyLookupService)); + } + + public virtual async Task> SearchAsync(string filter = null, int page = 1, CancellationToken cancellationToken = default) + { + var roles = await UserRoleFinder.SearchRoleAsync(filter, page); + return roles.Select(r => new ResourcePermissionProviderKeyInfo(r.RoleName, r.RoleName)).ToList(); + } + + public virtual async Task> SearchAsync(string[] keys, CancellationToken cancellationToken = default) + { + var roles = await UserRoleFinder.SearchRoleByNamesAsync(keys.Distinct().ToArray()); + return roles.Select(r => new ResourcePermissionProviderKeyInfo(r.RoleName, r.RoleName)).ToList(); + } +} diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs index ca865063e0..bf9a86c06d 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; using Volo.Abp.DependencyInjection; using Volo.Abp.EventBus.Distributed; using Volo.Abp.Identity; @@ -12,13 +13,19 @@ public class RoleUpdateEventHandler : { protected IPermissionManager PermissionManager { get; } protected IPermissionGrantRepository PermissionGrantRepository { get; } + protected IResourcePermissionManager ResourcePermissionManager { get; } + protected IResourcePermissionGrantRepository ResourcePermissionGrantRepository { get; } public RoleUpdateEventHandler( IPermissionManager permissionManager, - IPermissionGrantRepository permissionGrantRepository) + IPermissionGrantRepository permissionGrantRepository, + IResourcePermissionManager resourcePermissionManager, + IResourcePermissionGrantRepository resourcePermissionGrantRepository) { PermissionManager = permissionManager; PermissionGrantRepository = permissionGrantRepository; + ResourcePermissionManager = resourcePermissionManager; + ResourcePermissionGrantRepository = resourcePermissionGrantRepository; } public async Task HandleEventAsync(IdentityRoleNameChangedEto eventData) @@ -28,5 +35,11 @@ public class RoleUpdateEventHandler : { await PermissionManager.UpdateProviderKeyAsync(permissionGrant, eventData.Name); } + + var resourcePermissionGrantsInRole = await ResourcePermissionGrantRepository.GetListAsync(RoleResourcePermissionValueProvider.ProviderName, eventData.OldName); + foreach (var resourcePermissionGrant in resourcePermissionGrantsInRole) + { + await ResourcePermissionManager.UpdateProviderKeyAsync(resourcePermissionGrant, eventData.Name); + } } } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs index 35aaba29ae..b10cef8fe4 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserDeletedEventHandler.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus.Distributed; @@ -13,15 +14,18 @@ public class UserDeletedEventHandler : ITransientDependency { protected IPermissionManager PermissionManager { get; } + protected IResourcePermissionManager ResourcePermissionManager { get; } - public UserDeletedEventHandler(IPermissionManager permissionManager) + public UserDeletedEventHandler(IPermissionManager permissionManager, IResourcePermissionManager resourcePermissionManager) { PermissionManager = permissionManager; + ResourcePermissionManager = resourcePermissionManager; } [UnitOfWork] public virtual async Task HandleEventAsync(EntityDeletedEto eventData) { await PermissionManager.DeleteAsync(UserPermissionValueProvider.ProviderName, eventData.Entity.Id.ToString()); + await ResourcePermissionManager.DeleteAsync(UserResourcePermissionValueProvider.ProviderName, eventData.Entity.Id.ToString()); } } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserResourcePermissionManagementProvider.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserResourcePermissionManagementProvider.cs new file mode 100644 index 0000000000..ef165d422d --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserResourcePermissionManagementProvider.cs @@ -0,0 +1,22 @@ +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Guids; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement.Identity; + +public class UserResourcePermissionManagementProvider : ResourcePermissionManagementProvider +{ + public override string Name => UserResourcePermissionValueProvider.ProviderName; + + public UserResourcePermissionManagementProvider( + IResourcePermissionGrantRepository resourcePermissionGrantRepository, + IGuidGenerator guidGenerator, + ICurrentTenant currentTenant) + : base( + resourcePermissionGrantRepository, + guidGenerator, + currentTenant) + { + + } +} diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserResourcePermissionProviderKeyLookupService.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserResourcePermissionProviderKeyLookupService.cs new file mode 100644 index 0000000000..83f0e79099 --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/UserResourcePermissionProviderKeyLookupService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Identity; +using Volo.Abp.Identity.Localization; +using Volo.Abp.Localization; + +namespace Volo.Abp.PermissionManagement.Identity; + +public class UserResourcePermissionProviderKeyLookupService : IResourcePermissionProviderKeyLookupService, ITransientDependency +{ + public string Name => UserResourcePermissionValueProvider.ProviderName; + + public ILocalizableString DisplayName { get; } + + protected IUserRoleFinder UserRoleFinder { get; } + + public UserResourcePermissionProviderKeyLookupService(IUserRoleFinder userRoleFinder) + { + UserRoleFinder = userRoleFinder; + DisplayName = LocalizableString.Create(nameof(UserResourcePermissionProviderKeyLookupService)); + } + + public virtual async Task> SearchAsync(string filter = null, int page = 1, CancellationToken cancellationToken = default) + { + var users = await UserRoleFinder.SearchUserAsync(filter, page); + return users.Select(u => new ResourcePermissionProviderKeyInfo(u.Id.ToString(), u.UserName)).ToList(); + } + + public virtual async Task> SearchAsync(string[] keys, CancellationToken cancellationToken = default) + { + var ids = keys + .Select(key => Guid.TryParse(key, out var id) ? (Guid?)id : null) + .Where(id => id.HasValue) + .Select(id => id.Value) + .Distinct() + .ToArray(); + var users = await UserRoleFinder.SearchUserByIdsAsync(ids.ToArray()); + return users.Select(u => new ResourcePermissionProviderKeyInfo(u.Id.ToString(), u.UserName)).ToList(); + } +} diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/RoleResourcePermissionManagerExtensions.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/RoleResourcePermissionManagerExtensions.cs new file mode 100644 index 0000000000..53ff327f7b --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/RoleResourcePermissionManagerExtensions.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using JetBrains.Annotations; +using Volo.Abp.Authorization.Permissions; + +namespace Volo.Abp.PermissionManagement; + +public static class RoleResourceresourcePermissionManagerExtensions +{ + public static Task GetForRoleAsync([NotNull] this IResourcePermissionManager resourcePermissionManager, string roleName, string permissionName, [NotNull] string resourceName, [NotNull] string resourceKey) + { + Check.NotNull(resourcePermissionManager, nameof(resourcePermissionManager)); + + return resourcePermissionManager.GetAsync(permissionName, resourceName, resourceKey, RolePermissionValueProvider.ProviderName, roleName); + } + + public static Task> GetAllForRoleAsync([NotNull] this IResourcePermissionManager resourcePermissionManager, string roleName, [NotNull] string resourceName, [NotNull] string resourceKey) + { + Check.NotNull(resourcePermissionManager, nameof(resourcePermissionManager)); + + return resourcePermissionManager.GetAllAsync(resourceName, resourceKey, RolePermissionValueProvider.ProviderName, roleName); + } + + public static Task SetForRoleAsync([NotNull] this IResourcePermissionManager resourcePermissionManager, string roleName, [NotNull] string permissionName, [NotNull] string resourceName, [NotNull] string resourceKey, bool isGranted) + { + Check.NotNull(resourcePermissionManager, nameof(resourcePermissionManager)); + + return resourcePermissionManager.SetAsync(permissionName, resourceName, resourceKey, RolePermissionValueProvider.ProviderName, roleName, isGranted); + } +} diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/UserResourcePermissionManagerExtensions.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/UserResourcePermissionManagerExtensions.cs new file mode 100644 index 0000000000..c0fe2eb845 --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/UserResourcePermissionManagerExtensions.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using JetBrains.Annotations; +using Volo.Abp.Authorization.Permissions.Resources; + +namespace Volo.Abp.PermissionManagement; + +public static class UserResourcePermissionManagerExtensions +{ + public static Task> GetAllForUserAsync([NotNull] this IResourcePermissionManager resourcePermissionManager, Guid userId, [NotNull] string resourceName, [NotNull] string resourceKey) + { + Check.NotNull(resourcePermissionManager, nameof(resourcePermissionManager)); + + return resourcePermissionManager.GetAllAsync(resourceName, resourceKey, UserResourcePermissionValueProvider.ProviderName, userId.ToString()); + } + + public static Task SetForUserAsync([NotNull] this IResourcePermissionManager resourcePermissionManager, Guid userId, [NotNull] string name, [NotNull] string resourceName, [NotNull] string resourceKey, bool isGranted) + { + Check.NotNull(resourcePermissionManager, nameof(resourcePermissionManager)); + + return resourcePermissionManager.SetAsync(name, resourceName, resourceKey, UserResourcePermissionValueProvider.ProviderName, userId.ToString(), isGranted); + } +} diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs index 65c3ff5a39..b3285a4353 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Security.Claims; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Shouldly; @@ -766,4 +768,103 @@ public class IdentityUserStore_Tests : AbpIdentityDomainTestBase await uow.CompleteAsync(); } } + + [Fact] + public async Task AddOrUpdatePasskeyAsync() + { + using (var uow = _unitOfWorkManager.Begin()) + { + var credentialId = (byte[]) [1, 2]; + var user = await _identityUserStore.FindByIdAsync(_testData.UserBobId.ToString()); + user.Passkeys.ShouldBeEmpty(); + + var passkey = new UserPasskeyInfo(credentialId, null!, default, 0, null, false, false, false, null!, null!); + await _identityUserStore.AddOrUpdatePasskeyAsync(user, passkey, CancellationToken.None); + + user = await _identityUserStore.FindByIdAsync(_testData.UserBobId.ToString()); + user.Passkeys.ShouldNotBeEmpty(); + user.FindPasskey(credentialId).ShouldNotBeNull(); + + await uow.CompleteAsync(); + } + } + + [Fact] + public async Task GetPasskeysAsync() + { + using (var uow = _unitOfWorkManager.Begin()) + { + var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()); + var passkeys = await _identityUserStore.GetPasskeysAsync(user, CancellationToken.None); + passkeys.Count.ShouldBe(2); + + user = await _identityUserStore.FindByIdAsync(_testData.UserBobId.ToString()); + passkeys = await _identityUserStore.GetPasskeysAsync(user, CancellationToken.None); + passkeys.ShouldBeEmpty(); + + await uow.CompleteAsync(); + } + } + + [Fact] + public async Task FindByPasskeyIdAsync() + { + using (var uow = _unitOfWorkManager.Begin()) + { + var user = await _identityUserStore.FindByPasskeyIdAsync(_testData.PasskeyCredentialId1, CancellationToken.None); + user.ShouldNotBeNull(); + user.Id.ShouldBe(_testData.UserJohnId); + + user = await _identityUserStore.FindByPasskeyIdAsync(_testData.PasskeyCredentialId2, CancellationToken.None); + user.ShouldNotBeNull(); + user.Id.ShouldBe(_testData.UserJohnId); + + user = await _identityUserStore.FindByPasskeyIdAsync(_testData.PasskeyCredentialId3, CancellationToken.None); + user.ShouldNotBeNull(); + user.Id.ShouldBe(_testData.UserNeoId); + + await uow.CompleteAsync(); + } + } + + [Fact] + public async Task FindPasskeyAsync() + { + using (var uow = _unitOfWorkManager.Begin()) + { + var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()); + var passkey = await _identityUserStore.FindPasskeyAsync(user, _testData.PasskeyCredentialId1, CancellationToken.None); + passkey.ShouldNotBeNull(); + passkey.CredentialId.ShouldBe(_testData.PasskeyCredentialId1); + + passkey = await _identityUserStore.FindPasskeyAsync(user, _testData.PasskeyCredentialId2, CancellationToken.None); + passkey.ShouldNotBeNull(); + passkey.CredentialId.ShouldBe(_testData.PasskeyCredentialId2); + + passkey = await _identityUserStore.FindPasskeyAsync(user, _testData.PasskeyCredentialId3, CancellationToken.None); + passkey.ShouldBeNull(); + + await uow.CompleteAsync(); + } + } + + [Fact] + public async Task RemovePasskeyAsync() + { + using (var uow = _unitOfWorkManager.Begin()) + { + var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()); + user.Passkeys.Count.ShouldBe(2); + + var credentialId = user.Passkeys.First().CredentialId; + + await _identityUserStore.RemovePasskeyAsync(user, credentialId, CancellationToken.None); + + user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()); + user.Passkeys.Count.ShouldBe(1); + user.FindPasskey(credentialId).ShouldBeNull(); + + await uow.CompleteAsync(); + } + } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs index 524c7c25f3..56f9049b92 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using Shouldly; using Xunit; @@ -19,11 +16,47 @@ public class UserRoleFinder_Tests : AbpIdentityDomainTestBase } [Fact] - public async Task GetRolesAsync() + public async Task GetRoleNamesAsync() { - var roleNames = await _userRoleFinder.GetRolesAsync(_testData.UserJohnId); + var roleNames = await _userRoleFinder.GetRoleNamesAsync(_testData.UserJohnId); roleNames.ShouldNotBeEmpty(); roleNames.ShouldContain(x => x == "moderator"); roleNames.ShouldContain(x => x == "supporter"); } + + [Fact] + public async Task SearchUserAsync() + { + var userResults = await _userRoleFinder.SearchUserAsync("john"); + userResults.ShouldNotBeEmpty(); + userResults.ShouldContain(x => x.Id == _testData.UserJohnId); + } + + [Fact] + public async Task SearchRoleAsync() + { + var roleResults = await _userRoleFinder.SearchRoleAsync("moderator"); + roleResults.ShouldNotBeEmpty(); + roleResults.ShouldContain(x => x.RoleName == "moderator"); + } + + [Fact] + public async Task SearchUserByIdsAsync() + { + var userResults = await _userRoleFinder.SearchUserByIdsAsync(new[] { _testData.UserJohnId, _testData.UserBobId }); + userResults.ShouldNotBeEmpty(); + userResults.Count.ShouldBe(2); + userResults.ShouldContain(x => x.Id == _testData.UserJohnId && x.UserName == "john.nash"); + userResults.ShouldContain(x => x.Id == _testData.UserBobId && x.UserName == "bob"); + } + + [Fact] + public async Task SearchRoleByNamesAsync() + { + var roleResults = await _userRoleFinder.SearchRoleByNamesAsync(new[] { "moderator", "manager" }); + roleResults.ShouldNotBeEmpty(); + roleResults.Count.ShouldBe(2); + roleResults.ShouldContain(x => x.RoleName == "moderator"); + roleResults.ShouldContain(x => x.RoleName == "manager"); + } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs index 944c6928c1..15ef80b4c4 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs @@ -140,6 +140,8 @@ public class AbpIdentityTestDataBuilder : ITransientDependency john.AddLogin(new UserLoginInfo("twitter", "johnx", "John Nash")); john.AddClaim(_guidGenerator, new Claim("TestClaimType", "42")); john.SetToken("test-provider", "test-name", "test-value"); + john.AddPasskey(_testData.PasskeyCredentialId1, new IdentityPasskeyData()); + john.AddPasskey(_testData.PasskeyCredentialId2, new IdentityPasskeyData()); await _userRepository.InsertAsync(john); var david = new IdentityUser(_testData.UserDavidId, "david", "david@abp.io"); @@ -152,6 +154,7 @@ public class AbpIdentityTestDataBuilder : ITransientDependency neo.AddRole(_supporterRole.Id); neo.AddClaim(_guidGenerator, new Claim("TestClaimType", "43")); neo.AddOrganizationUnit(_ou111.Id); + neo.AddPasskey(_testData.PasskeyCredentialId3, new IdentityPasskeyData()); await _userRepository.InsertAsync(neo); var bob = new IdentityUser(_testData.UserBobId, "bob", "bob@abp.io"); diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityTestData.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityTestData.cs index 0172dc016a..b6cb14de5c 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityTestData.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityTestData.cs @@ -15,4 +15,7 @@ public class IdentityTestData : ISingletonDependency public Guid UserBobId { get; } = Guid.NewGuid(); public Guid AgeClaimId { get; } = Guid.NewGuid(); public Guid EducationClaimId { get; } = Guid.NewGuid(); + public byte[] PasskeyCredentialId1 { get; } = (byte[])[1, 2, 3, 4, 5, 6, 7, 8]; + public byte[] PasskeyCredentialId2 { get; } = (byte[])[8, 7, 6, 5, 4, 3, 2, 1]; + public byte[] PasskeyCredentialId3 { get; } = (byte[])[1, 2, 3, 4, 8, 7, 6, 5,]; } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs index e81c0cbd38..58dc072359 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs @@ -159,7 +159,7 @@ public abstract class IdentityUserRepository_Tests : AbpIdentity StringComparison.OrdinalIgnoreCase ).ShouldBeGreaterThan(0); } - + users = await UserRepository.GetListAsync(null, 5, 0, null, roleId: TestData.RoleManagerId); users.ShouldContain(x => x.UserName == "john.nash"); users.ShouldContain(x => x.UserName == "neo"); @@ -294,4 +294,23 @@ public abstract class IdentityUserRepository_Tests : AbpIdentity ou112Users.ShouldContain(x => x.UserName == "john.nash"); ou112Users.ShouldContain(x => x.UserName == "neo"); } + + + [Fact] + public async Task FindByPasskeyIdAsync() + { + var user = await UserRepository.FindByPasskeyIdAsync(TestData.PasskeyCredentialId1); + user.ShouldNotBeNull(); + user.Id.ShouldBe(TestData.UserJohnId); + + user = await UserRepository.FindByPasskeyIdAsync(TestData.PasskeyCredentialId2); + user.ShouldNotBeNull(); + user.Id.ShouldBe(TestData.UserJohnId); + + user = await UserRepository.FindByPasskeyIdAsync(TestData.PasskeyCredentialId3); + user.ShouldNotBeNull(); + user.Id.ShouldBe(TestData.UserNeoId); + + (await UserRepository.FindByPasskeyIdAsync((byte[])[1, 2, 3])).ShouldBeNull(); + } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs index d4e0fb5490..b5694cb2fa 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs @@ -322,6 +322,9 @@ public class AbpResourceOwnerPasswordValidator : IResourceOwnerPasswordValidator additionalClaims.ToArray() ); + user.SetLastSignInTime(DateTimeOffset.UtcNow); + await UserManager.UpdateAsync(user); + await IdentitySecurityLogManager.SaveAsync( new IdentitySecurityLogContext { diff --git a/modules/openiddict/app/OpenIddict.Demo.API/Program.cs b/modules/openiddict/app/OpenIddict.Demo.API/Program.cs index 0938f87e6c..c565273532 100644 --- a/modules/openiddict/app/OpenIddict.Demo.API/Program.cs +++ b/modules/openiddict/app/OpenIddict.Demo.API/Program.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using OpenIddict.Demo.API; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerUI; @@ -42,19 +42,9 @@ builder.Services.AddSwaggerGen(options => } }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement + options.AddSecurityRequirement(document => new OpenApiSecurityRequirement() { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = "oauth2" - } - }, - Array.Empty() - } + [new OpenApiSecuritySchemeReference("oauth2", document)] = [] }); }); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs index 5059c7c5ca..07be60da44 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs @@ -405,6 +405,9 @@ public partial class TokenController } ); + user.SetLastSignInTime(DateTimeOffset.UtcNow); + await UserManager.UpdateAsync(user); + return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionDefinitionListResultDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionDefinitionListResultDto.cs new file mode 100644 index 0000000000..ea1ce882df --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionDefinitionListResultDto.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class GetResourcePermissionDefinitionListResultDto +{ + public List Permissions { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionListResultDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionListResultDto.cs new file mode 100644 index 0000000000..b9c4db2190 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionListResultDto.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class GetResourcePermissionListResultDto +{ + public List Permissions { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionWithProviderListResultDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionWithProviderListResultDto.cs new file mode 100644 index 0000000000..dcf4556d04 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourcePermissionWithProviderListResultDto.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class GetResourcePermissionWithProviderListResultDto +{ + public List Permissions { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourceProviderListResultDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourceProviderListResultDto.cs new file mode 100644 index 0000000000..ede31a6ca5 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GetResourceProviderListResultDto.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class GetResourceProviderListResultDto +{ + public List Providers { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GrantedResourcePermissionDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GrantedResourcePermissionDto.cs new file mode 100644 index 0000000000..bbb1de112a --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/GrantedResourcePermissionDto.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.PermissionManagement; + +public class GrantedResourcePermissionDto +{ + public string Name { get; set; } + + public string DisplayName { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/IPermissionAppService.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/IPermissionAppService.cs index 819d643a21..dd24d436be 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/IPermissionAppService.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/IPermissionAppService.cs @@ -11,4 +11,18 @@ public interface IPermissionAppService : IApplicationService Task GetByGroupAsync([NotNull] string groupName, [NotNull] string providerName, [NotNull] string providerKey); Task UpdateAsync([NotNull] string providerName, [NotNull] string providerKey, UpdatePermissionsDto input); + + Task GetResourceProviderKeyLookupServicesAsync(string resourceName); + + Task SearchResourceProviderKeyAsync(string resourceName, string serviceName, string filter, int page); + + Task GetResourceDefinitionsAsync([NotNull] string resourceName); + + Task GetResourceAsync([NotNull] string resourceName, [NotNull] string resourceKey); + + Task GetResourceByProviderAsync([NotNull] string resourceName, [NotNull] string resourceKey, [NotNull] string providerName, [NotNull] string providerKey); + + Task UpdateResourceAsync([NotNull] string resourceName, [NotNull] string resourceKey, UpdateResourcePermissionsDto input); + + Task DeleteResourceAsync([NotNull] string resourceName, [NotNull] string resourceKey, [NotNull] string providerName, [NotNull] string providerKey); } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionDefinitionDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionDefinitionDto.cs new file mode 100644 index 0000000000..b8218b562c --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionDefinitionDto.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionDefinitionDto +{ + public string Name { get; set; } + + public string DisplayName { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionGrantInfoDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionGrantInfoDto.cs new file mode 100644 index 0000000000..cf286815a5 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionGrantInfoDto.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionGrantInfoDto +{ + public string ProviderName { get; set; } + + public string ProviderKey { get; set; } + + public string ProviderDisplayName { get; set; } + + public string ProviderNameDisplayName { get; set; } + + public List Permissions { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionWithProdiverGrantInfoDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionWithProdiverGrantInfoDto.cs new file mode 100644 index 0000000000..d56e217cd6 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourcePermissionWithProdiverGrantInfoDto.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionWithProdiverGrantInfoDto +{ + public string Name { get; set; } + + public string DisplayName { get; set; } + + public List Providers { get; set; } + + public bool IsGranted { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourceProviderDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourceProviderDto.cs new file mode 100644 index 0000000000..98ee22c6b7 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/ResourceProviderDto.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.PermissionManagement; + +public class ResourceProviderDto +{ + public string Name { get; set; } + + public string DisplayName { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/SearchProviderKeyInfo.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/SearchProviderKeyInfo.cs new file mode 100644 index 0000000000..efc6ae2b18 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/SearchProviderKeyInfo.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.PermissionManagement; + +public class SearchProviderKeyInfo +{ + public string ProviderKey { get; set; } + + public string ProviderDisplayName { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/SearchProviderKeyListResultDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/SearchProviderKeyListResultDto.cs new file mode 100644 index 0000000000..7fe4edd6e7 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/SearchProviderKeyListResultDto.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class SearchProviderKeyListResultDto +{ + public List Keys { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/UpdateResourcePermissionsDto.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/UpdateResourcePermissionsDto.cs new file mode 100644 index 0000000000..f82c27ff02 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/UpdateResourcePermissionsDto.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class UpdateResourcePermissionsDto +{ + public string ProviderName { get; set; } + + public string ProviderKey { get; set; } + + public List Permissions { get; set; } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs index e628c39644..e26e387fae 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs @@ -18,12 +18,18 @@ public class PermissionAppService : ApplicationService, IPermissionAppService { protected PermissionManagementOptions Options { get; } protected IPermissionManager PermissionManager { get; } + protected IPermissionChecker PermissionChecker { get; } + protected IResourcePermissionManager ResourcePermissionManager { get; } + protected IResourcePermissionGrantRepository ResourcePermissionGrantRepository { get; } protected IPermissionDefinitionManager PermissionDefinitionManager { get; } protected ISimpleStateCheckerManager SimpleStateCheckerManager { get; } public PermissionAppService( IPermissionManager permissionManager, + IPermissionChecker permissionChecker, IPermissionDefinitionManager permissionDefinitionManager, + IResourcePermissionManager resourcePermissionManager, + IResourcePermissionGrantRepository resourcePermissionGrantRepository, IOptions options, ISimpleStateCheckerManager simpleStateCheckerManager) { @@ -32,6 +38,9 @@ public class PermissionAppService : ApplicationService, IPermissionAppService Options = options.Value; PermissionManager = permissionManager; + PermissionChecker = permissionChecker; + ResourcePermissionManager = resourcePermissionManager; + ResourcePermissionGrantRepository = resourcePermissionGrantRepository; PermissionDefinitionManager = permissionDefinitionManager; SimpleStateCheckerManager = simpleStateCheckerManager; } @@ -160,6 +169,206 @@ public class PermissionAppService : ApplicationService, IPermissionAppService } } + public virtual async Task GetResourceProviderKeyLookupServicesAsync(string resourceName) + { + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + if (!resourcePermissions.Any() || + !await AuthorizationService.IsGrantedAnyAsync(resourcePermissions.Select(p => p.ManagementPermissionName!).ToArray())) + { + return new GetResourceProviderListResultDto + { + Providers = new List() + }; + } + + var lookupServices = await ResourcePermissionManager.GetProviderKeyLookupServicesAsync(); + return new GetResourceProviderListResultDto + { + Providers = lookupServices.Select(s => new ResourceProviderDto + { + Name = s.Name, + DisplayName = s.DisplayName.Localize(StringLocalizerFactory), + }).ToList() + }; + } + + public virtual async Task SearchResourceProviderKeyAsync(string resourceName, string serviceName, string filter, int page) + { + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + if (resourcePermissions.IsNullOrEmpty() || + !await AuthorizationService.IsGrantedAnyAsync(resourcePermissions.Select(p => p.ManagementPermissionName!).ToArray())) + { + return new SearchProviderKeyListResultDto(); + } + + var lookupService = await ResourcePermissionManager.GetProviderKeyLookupServiceAsync(serviceName); + var keys = await lookupService.SearchAsync(filter, page); + return new SearchProviderKeyListResultDto + { + Keys = keys.Select(x => new SearchProviderKeyInfo + { + ProviderKey = x.ProviderKey, + ProviderDisplayName = x.ProviderDisplayName, + }).ToList() + }; + } + + public virtual async Task GetResourceDefinitionsAsync(string resourceName) + { + var result = new GetResourcePermissionDefinitionListResultDto + { + Permissions = new List() + }; + + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + var permissionGrants = (await PermissionChecker.IsGrantedAsync(resourcePermissions + .Select(rp => rp.ManagementPermissionName!) + .Distinct().ToArray())).Result.Where(x => x.Value == PermissionGrantResult.Granted).Select(x => x.Key) + .ToHashSet(); + foreach (var resourcePermission in resourcePermissions) + { + if (!permissionGrants.Contains(resourcePermission.ManagementPermissionName)) + { + continue; + } + + result.Permissions.Add(new ResourcePermissionDefinitionDto + { + Name = resourcePermission.Name, + DisplayName = resourcePermission.DisplayName?.Localize(StringLocalizerFactory), + }); + } + + return result; + } + + public virtual async Task GetResourceAsync(string resourceName, string resourceKey) + { + var result = new GetResourcePermissionListResultDto + { + Permissions = new List() + }; + + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + var resourcePermissionGrants = await ResourcePermissionManager.GetAllGroupAsync(resourceName, resourceKey); + var permissionGrants = (await PermissionChecker.IsGrantedAsync(resourcePermissions + .Select(rp => rp.ManagementPermissionName!) + .Distinct().ToArray())).Result.Where(x => x.Value == PermissionGrantResult.Granted).Select(x => x.Key) + .ToHashSet(); + foreach (var resourcePermissionGrant in resourcePermissionGrants) + { + var resourcePermissionGrantInfoDto = new ResourcePermissionGrantInfoDto + { + ProviderName = resourcePermissionGrant.ProviderName, + ProviderKey = resourcePermissionGrant.ProviderKey, + ProviderDisplayName = resourcePermissionGrant.ProviderDisplayName, + ProviderNameDisplayName = resourcePermissionGrant.ProviderNameDisplayName?.Localize(StringLocalizerFactory), + Permissions = new List() + }; + foreach (var permission in resourcePermissionGrant.Permissions) + { + var resourcePermission = resourcePermissions.FirstOrDefault(x => x.Name == permission); + if (resourcePermission == null) + { + continue; + } + + if (!permissionGrants.Contains(resourcePermission.ManagementPermissionName)) + { + continue; + } + + resourcePermissionGrantInfoDto.Permissions.Add(new GrantedResourcePermissionDto() + { + Name = permission, + DisplayName = resourcePermission?.DisplayName.Localize(StringLocalizerFactory), + }); + } + + if(resourcePermissionGrantInfoDto.Permissions.Any()) + { + result.Permissions.Add(resourcePermissionGrantInfoDto); + } + } + + return result; + } + + public virtual async Task GetResourceByProviderAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + var result = new GetResourcePermissionWithProviderListResultDto + { + Permissions = new List() + }; + + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + var resourcePermissionGrants = await ResourcePermissionManager.GetAllAsync(resourceName, resourceKey, providerName, providerKey); + var permissionGrants = (await PermissionChecker.IsGrantedAsync(resourcePermissions + .Select(rp => rp.ManagementPermissionName!) + .Distinct().ToArray())).Result.Where(x => x.Value == PermissionGrantResult.Granted).Select(x => x.Key) + .ToHashSet(); + foreach (var resourcePermissionGrant in resourcePermissionGrants) + { + var resourcePermission = resourcePermissions.FirstOrDefault(x => x.Name == resourcePermissionGrant.Name); + if (resourcePermission == null) + { + continue; + } + + if (!permissionGrants.Contains(resourcePermission.ManagementPermissionName)) + { + continue; + } + + result.Permissions.Add(new ResourcePermissionWithProdiverGrantInfoDto + { + Name = resourcePermissionGrant.Name, + DisplayName = resourcePermission?.DisplayName.Localize(StringLocalizerFactory), + Providers = resourcePermissionGrant.Providers.Select(x => x.Name).ToList(), + IsGranted = resourcePermissionGrant.IsGranted + }); + } + + return result; + } + + public virtual async Task UpdateResourceAsync(string resourceName, string resourceKey, UpdateResourcePermissionsDto input) + { + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + var permissionGrants = (await PermissionChecker.IsGrantedAsync(resourcePermissions + .Select(rp => rp.ManagementPermissionName!) + .Distinct().ToArray())).Result.Where(x => x.Value == PermissionGrantResult.Granted).Select(x => x.Key) + .ToHashSet(); + foreach (var resourcePermission in resourcePermissions) + { + if (!permissionGrants.Contains(resourcePermission.ManagementPermissionName)) + { + continue; + } + + var isGranted = !input.Permissions.IsNullOrEmpty() && input.Permissions.Any(p => p == resourcePermission.Name); + await ResourcePermissionManager.SetAsync(resourcePermission.Name, resourceName, resourceKey, input.ProviderName, input.ProviderKey, isGranted); + } + } + + public virtual async Task DeleteResourceAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + var resourcePermissions = await ResourcePermissionManager.GetAvailablePermissionsAsync(resourceName); + var permissionGrants = (await PermissionChecker.IsGrantedAsync(resourcePermissions + .Select(rp => rp.ManagementPermissionName!) + .Distinct().ToArray())).Result.Where(x => x.Value == PermissionGrantResult.Granted).Select(x => x.Key) + .ToHashSet(); + foreach (var resourcePermission in resourcePermissions) + { + if (!permissionGrants.Contains(resourcePermission.ManagementPermissionName)) + { + continue; + } + + await ResourcePermissionManager.DeleteAsync(resourcePermission.Name, resourceName, resourceKey, providerName, providerKey); + } + } + protected virtual async Task CheckProviderPolicy(string providerName) { var policyName = Options.ProviderPolicies.GetOrDefault(providerName); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/ResourcePermissionManagementModal.razor b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/ResourcePermissionManagementModal.razor new file mode 100644 index 0000000000..bd12891063 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/ResourcePermissionManagementModal.razor @@ -0,0 +1,179 @@ +@using Blazorise.Components +@using Volo.Abp.BlazoriseUI.Components +@using Volo.Abp.PermissionManagement.Localization +@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase +@inject AbpBlazorMessageLocalizerHelper LH + + + + + @L["ResourcePermissions"] - @ResourceDisplayName + + + + @if(HasAnyResourcePermission && HasAnyResourceProviderKeyLookupService) + { +
+ +
+ + + + + + + @L["Actions"] + + + + @L["Edit"] + + + @L["Delete"] + + + + + + + + @{ + + @context.ProviderName + + @context.ProviderDisplayName + } + + + + + @{ + foreach (var permission in context.Permissions) + { + @permission.DisplayName + } + } + + + + + @L["NoDataAvailableInDatatable"] + + + } + else + { + + } +
+ + + +
+
+ + + +
+ + @L["AddResourcePermission"] + + + + +
+ + @foreach(var keyLookupService in ResourceProviderKeyLookupServices) + { + @keyLookupService.DisplayName + } + + + + + + + + + + +
+
+

@L["ResourcePermissionPermissions"]

+ @L["GrantAllResourcePermissions"] +
+ @foreach (var permission in CreateEntity.Permissions) + { + @permission.DisplayName + } +
+
+
+
+ + + + +
+
+
+ + + +
+ + @L["UpdateResourcePermission"] + + + + +
+

@L["ResourcePermissionPermissions"]

+ @L["GrantAllResourcePermissions"] +
+ @foreach (var permission in EditEntity.Permissions) + { + @permission.DisplayName + } +
+
+
+
+ + + + +
+
+
diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/ResourcePermissionManagementModal.razor.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/ResourcePermissionManagementModal.razor.cs new file mode 100644 index 0000000000..a69eacea3c --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/ResourcePermissionManagementModal.razor.cs @@ -0,0 +1,317 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Blazorise; +using Blazorise.Components; +using Microsoft.AspNetCore.Components; +using Volo.Abp.AspNetCore.Components.Messages; +using Volo.Abp.PermissionManagement.Localization; + +namespace Volo.Abp.PermissionManagement.Blazor.Components; + +public partial class ResourcePermissionManagementModal +{ + [Inject] protected IPermissionAppService PermissionAppService { get; set; } + + [Inject] protected IUiMessageService UiMessageService { get; set; } + + protected Modal Modal { get; set; } + + public bool HasAnyResourcePermission { get; set; } + public bool HasAnyResourceProviderKeyLookupService { get; set; } + protected string ResourceName { get; set; } + protected string ResourceKey { get; set; } + protected string ResourceDisplayName { get; set; } + protected int PageSize { get; set; } = 10; + + protected Modal CreateModal { get; set; } + protected Validations CreateValidationsRef { get; set; } + protected CreateModel CreateEntity { get; set; } = new CreateModel + { + Permissions = [] + }; + protected Autocomplete ProviderKeyAutocompleteRef { get; set; } + protected Blazorise.Validation ProviderKeyValidationRef { get; set; } + public GetResourcePermissionDefinitionListResultDto ResourcePermissionDefinitions { get; set; } = new() + { + Permissions = [] + }; + protected string CurrentLookupService { get; set; } + protected string ProviderKey { get; set; } + protected string ProviderDisplayName { get; set; } + protected List ResourceProviderKeyLookupServices { get; set; } = new(); + protected List ProviderKeys { get; set; } = new(); + protected GetResourcePermissionListResultDto ResourcePermissionList = new() + { + Permissions = [] + }; + + protected Validations EditValidationsRef { get; set; } + protected Modal EditModal { get; set; } + protected EditModel EditEntity { get; set; } = new EditModel + { + Permissions = [] + }; + + public ResourcePermissionManagementModal() + { + LocalizationResource = typeof(AbpPermissionManagementResource); + } + + public virtual async Task OpenAsync(string resourceName, string resourceKey, string resourceDisplayName) + { + try + { + ResourceName = resourceName; + ResourceKey = resourceKey; + ResourceDisplayName = resourceDisplayName; + + ResourcePermissionDefinitions = await PermissionAppService.GetResourceDefinitionsAsync(ResourceName); + ResourceProviderKeyLookupServices = (await PermissionAppService.GetResourceProviderKeyLookupServicesAsync(ResourceName)).Providers; + + HasAnyResourcePermission = ResourcePermissionDefinitions.Permissions.Any(); + if (HasAnyResourcePermission) + { + HasAnyResourceProviderKeyLookupService = ResourceProviderKeyLookupServices.Count > 0; + } + + await InvokeAsync(StateHasChanged); + + ResourcePermissionList = await PermissionAppService.GetResourceAsync(ResourceName, ResourceKey); + + await Modal.Show(); + + } + catch (Exception ex) + { + await HandleErrorAsync(ex); + } + } + + protected virtual async Task CloseModal() + { + await Modal.Hide(); + } + + protected virtual Task ClosingModal(ModalClosingEventArgs eventArgs) + { + eventArgs.Cancel = eventArgs.CloseReason == CloseReason.FocusLostClosing; + return Task.CompletedTask; + } + + protected virtual async Task OpenCreateModalAsync() + { + CurrentLookupService = ResourceProviderKeyLookupServices.FirstOrDefault()?.Name; + + ProviderKey = null; + ProviderDisplayName = null; + ProviderKeys = new List(); + await ProviderKeyAutocompleteRef.Clear(); + await CreateValidationsRef.ClearAll(); + + CreateEntity = new CreateModel + { + Permissions = ResourcePermissionDefinitions.Permissions.Select(x => new ResourcePermissionModel + { + Name = x.Name, + DisplayName = x.DisplayName, + IsGranted = false + }).ToList() + }; + + await CreateModal.Show(); + await InvokeAsync(StateHasChanged); + } + + protected virtual async Task SelectedProviderKeyAsync(string value) + { + ProviderKey = value; + ProviderDisplayName = ProviderKeys.FirstOrDefault(p => p.ProviderKey == value)?.ProviderDisplayName; + + var permissionGrants = await PermissionAppService.GetResourceByProviderAsync(ResourceName, ResourceKey, CurrentLookupService, ProviderKey); + foreach (var permission in CreateEntity.Permissions) + { + permission.IsGranted = permissionGrants.Permissions.Any(p => p.Name == permission.Name && p.Providers.Contains(CurrentLookupService) && p.IsGranted); + } + + await InvokeAsync(StateHasChanged); + } + + private async Task SearchProviderKeyAsync(AutocompleteReadDataEventArgs autocompleteReadDataEventArgs) + { + if ( !autocompleteReadDataEventArgs.CancellationToken.IsCancellationRequested ) + { + if (autocompleteReadDataEventArgs.SearchValue.IsNullOrWhiteSpace()) + { + ProviderKeys = new List(); + return; + } + + ProviderKeys = (await PermissionAppService.SearchResourceProviderKeyAsync(ResourceName, CurrentLookupService, autocompleteReadDataEventArgs.SearchValue, 1)).Keys; + + await InvokeAsync(StateHasChanged); + } + } + + protected virtual async Task OnPermissionCheckedChanged(ResourcePermissionModel permission, bool value) + { + permission.IsGranted = value; + await InvokeAsync(StateHasChanged); + } + + protected virtual async Task GrantAllAsync(bool value) + { + foreach (var permission in CreateEntity.Permissions) + { + permission.IsGranted = value; + } + + foreach (var permission in EditEntity.Permissions) + { + permission.IsGranted = value; + } + + await InvokeAsync(StateHasChanged); + } + + protected virtual async Task OpenEditModalAsync(ResourcePermissionGrantInfoDto permission) + { + var resourcePermissions = await PermissionAppService.GetResourceByProviderAsync(ResourceName, ResourceKey, permission.ProviderName, permission.ProviderKey); + EditEntity = new EditModel + { + ProviderName = permission.ProviderName, + ProviderKey = permission.ProviderKey, + Permissions = resourcePermissions.Permissions.Select(x => new ResourcePermissionModel + { + Name = x.Name, + DisplayName = x.DisplayName, + IsGranted = x.IsGranted + }).ToList() + }; + + await EditModal.Show(); + } + + protected virtual Task ClosingCreateModal(ModalClosingEventArgs eventArgs) + { + eventArgs.Cancel = eventArgs.CloseReason == CloseReason.FocusLostClosing; + return Task.CompletedTask; + } + + protected virtual Task ClosingEditModal(ModalClosingEventArgs eventArgs) + { + eventArgs.Cancel = eventArgs.CloseReason == CloseReason.FocusLostClosing; + return Task.CompletedTask; + } + + protected virtual async Task CloseCreateModalAsync() + { + await CreateModal.Hide(); + } + + protected virtual async Task CloseEditModalAsync() + { + await EditModal.Hide(); + } + + protected virtual async Task OnLookupServiceCheckedValueChanged(string value) + { + CurrentLookupService = value; + ProviderKey = null; + ProviderDisplayName = null; + await ProviderKeyAutocompleteRef.Clear(); + await CreateValidationsRef.ClearAll(); + await InvokeAsync(StateHasChanged); + } + + protected virtual void ValidateProviderKey(ValidatorEventArgs validatorEventArgs) + { + validatorEventArgs.Status = ProviderKey.IsNullOrWhiteSpace() + ? ValidationStatus.Error + : ValidationStatus.Success; + validatorEventArgs.ErrorText = L["ThisFieldIsRequired."]; + } + + protected virtual async Task CreateResourcePermissionAsync() + { + if (await CreateValidationsRef.ValidateAll()) + { + await PermissionAppService.UpdateResourceAsync( + ResourceName, + ResourceKey, + new UpdateResourcePermissionsDto + { + ProviderName = CurrentLookupService, + ProviderKey = ProviderKey, + Permissions = CreateEntity.Permissions.Where(p => p.IsGranted).Select(p => p.Name).ToList() + } + ); + + await CloseCreateModalAsync(); + ResourcePermissionList = await PermissionAppService.GetResourceAsync(ResourceName, ResourceKey); + await InvokeAsync(StateHasChanged); + } + } + + protected virtual async Task UpdateResourcePermissionAsync() + { + if (await EditValidationsRef.ValidateAll()) + { + await PermissionAppService.UpdateResourceAsync( + ResourceName, + ResourceKey, + new UpdateResourcePermissionsDto + { + ProviderName = EditEntity.ProviderName, + ProviderKey = EditEntity.ProviderKey, + Permissions = EditEntity.Permissions.Where(p => p.IsGranted).Select(p => p.Name).ToList() + } + ); + + await CloseEditModalAsync(); + ResourcePermissionList = await PermissionAppService.GetResourceAsync(ResourceName, ResourceKey); + await InvokeAsync(StateHasChanged); + } + } + + protected virtual async Task DeleteResourcePermissionAsync(ResourcePermissionGrantInfoDto permission) + { + if(await UiMessageService.Confirm(L["ResourcePermissionDeletionConfirmationMessage"])) + { + await PermissionAppService.DeleteResourceAsync( + ResourceName, + ResourceKey, + permission.ProviderName, + permission.ProviderKey + ); + + ResourcePermissionList = await PermissionAppService.GetResourceAsync(ResourceName, ResourceKey); + await Notify.Success(L["DeletedSuccessfully"]); + await InvokeAsync(StateHasChanged); + } + } + + public class CreateModel + { + public List Permissions { get; set; } + } + + public class EditModel + { + public string ProviderName { get; set; } + + public string ProviderKey { get; set; } + + public List Permissions { get; set; } + } + + public class ResourcePermissionModel + { + public string Name { get; set; } + + public string DisplayName { get; set; } + + public bool IsGranted { get; set; } + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ar.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ar.json index 30f4b647e8..c1a8e40b7b 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ar.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ar.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "تحديد الكل", "SaveWithoutAnyPermissionsWarningMessage": "هل أنت متأكد أنك تريد الحفظ بدون أي أذونات؟", "PermissionGroup": "مجموعة الأذونات", - "Filter": "تصفية" + "Filter": "تصفية", + "ResourcePermissions": "الأذونات", + "ResourcePermissionTarget": "الهدف", + "ResourcePermissionPermissions": "الأذونات", + "AddResourcePermission": "إضافة إذن", + "ResourcePermissionDeletionConfirmationMessage": "هل أنت متأكد أنك تريد حذف جميع الأذونات؟", + "UpdateResourcePermission": "تحديث الإذن", + "GrantAllResourcePermissions": "منح الكل", + "NoResourceProviderKeyLookupServiceFound": "لم يتم العثور على خدمة البحث عن مفتاح المزود", + "NoResourcePermissionFound": "لا توجد أي أذونات محددة.", + "UpdatePermission": "تحديث الإذن", + "NoPermissionsAssigned": "لم يتم تعيين أذونات", + "SelectProvider": "اختر المزود", + "SearchProviderKey": "بحث عن مفتاح المزود", + "Provider": "المزود", + "ErrorLoadingPermissions": "خطأ في تحميل الأذونات", + "PleaseSelectProviderAndPermissions": "يرجى اختيار المزود والأذونات" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/cs.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/cs.json index 814b8e423c..f8f9e642c3 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/cs.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/cs.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Vybrat vše", "SaveWithoutAnyPermissionsWarningMessage": "Opravdu chcete ukládat bez jakýchkoli oprávnění?", "PermissionGroup": "Skupina oprávnění", - "Filter": "Filtr" + "Filter": "Filtr", + "ResourcePermissions": "Oprávnění", + "ResourcePermissionTarget": "Cíl", + "ResourcePermissionPermissions": "Oprávnění", + "AddResourcePermission": "Přidat oprávnění", + "ResourcePermissionDeletionConfirmationMessage": "Opravdu chcete smazat všechna oprávnění?", + "UpdateResourcePermission": "Aktualizovat oprávnění", + "GrantAllResourcePermissions": "Udělit vše", + "NoResourceProviderKeyLookupServiceFound": "Nebyla nalezena služba pro vyhledávání klíče poskytovatele zdrojů", + "NoResourcePermissionFound": "Pro aktuální prostředek není definováno žádné oprávnění.", + "UpdatePermission": "Aktualizovat oprávnění", + "NoPermissionsAssigned": "Nejsou přiřazena žádná oprávnění", + "SelectProvider": "Vybrat poskytovatele", + "SearchProviderKey": "Hledat klíč poskytovatele", + "Provider": "Poskytovatel", + "ErrorLoadingPermissions": "Chyba při načítání oprávnění", + "PleaseSelectProviderAndPermissions": "Vyberte prosím poskytovatele a oprávnění" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/de.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/de.json index 7a40c5d4d4..dcf9cf08e9 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/de.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/de.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Alle auswählen", "SaveWithoutAnyPermissionsWarningMessage": "Sind Sie sicher, dass Sie ohne Berechtigungen speichern möchten?", "PermissionGroup": "Berechtigungsgruppe", - "Filter": "Filtern" + "Filter": "Filtern", + "ResourcePermissions": "Berechtigungen", + "ResourcePermissionTarget": "Ziel", + "ResourcePermissionPermissions": "Berechtigungen", + "AddResourcePermission": "Berechtigung hinzufügen", + "ResourcePermissionDeletionConfirmationMessage": "Sind Sie sicher, dass Sie alle Berechtigungen löschen möchten?", + "UpdateResourcePermission": "Berechtigung aktualisieren", + "GrantAllResourcePermissions": "Alle gewähren", + "NoResourceProviderKeyLookupServiceFound": "Es wurde kein Dienst zum Nachschlagen des Anbieterschlüssels gefunden", + "NoResourcePermissionFound": "Es ist keine Berechtigung definiert.", + "UpdatePermission": "Berechtigung aktualisieren", + "NoPermissionsAssigned": "Keine Berechtigungen zugewiesen", + "SelectProvider": "Anbieter auswählen", + "SearchProviderKey": "Anbieterschlüssel suchen", + "Provider": "Anbieter", + "ErrorLoadingPermissions": "Fehler beim Laden der Berechtigungen", + "PleaseSelectProviderAndPermissions": "Bitte wählen Sie einen Anbieter und Berechtigungen aus" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/el.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/el.json index 3449b7fab6..926943701c 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/el.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/el.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Επιλογή όλων", "SaveWithoutAnyPermissionsWarningMessage": "Είστε βέβαιοι ότι θέλετε να αποθηκεύσετε χωρίς δικαιώματα;", "PermissionGroup": "Ομάδα δικαιωμάτων", - "Filter": "Φίλτρο" + "Filter": "Φίλτρο", + "ResourcePermissions": "Δικαιώματα", + "ResourcePermissionTarget": "Στόχος", + "ResourcePermissionPermissions": "Δικαιώματα", + "AddResourcePermission": "Προσθήκη δικαιώματος", + "ResourcePermissionDeletionConfirmationMessage": "Είστε βέβαιοι ότι θέλετε να διαγράψετε όλα τα δικαιώματα;", + "UpdateResourcePermission": "Ενημέρωση δικαιώματος", + "GrantAllResourcePermissions": "Παραχώρηση όλων", + "NoResourceProviderKeyLookupServiceFound": "Δεν βρέθηκε υπηρεσία αναζήτησης κλειδιού παρόχου", + "NoResourcePermissionFound": "Δεν έχει οριστεί καμία άδεια.", + "UpdatePermission": "Ενημέρωση δικαιώματος", + "NoPermissionsAssigned": "Δεν έχουν εκχωρηθεί δικαιώματα", + "SelectProvider": "Επιλέξτε πάροχο", + "SearchProviderKey": "Αναζήτηση κλειδιού παρόχου", + "Provider": "Πάροχος", + "ErrorLoadingPermissions": "Σφάλμα κατά τη φόρτωση δικαιωμάτων", + "PleaseSelectProviderAndPermissions": "Επιλέξτε πάροχο και δικαιώματα" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en-GB.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en-GB.json index be6cbcd1f5..11370fd6ff 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en-GB.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en-GB.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Select all", "SaveWithoutAnyPermissionsWarningMessage": "Are you sure you want to save without any permissions?", "PermissionGroup": "Permission Group", - "Filter": "Filter" + "Filter": "Filter", + "ResourcePermissions": "Permissions", + "ResourcePermissionTarget": "Target", + "ResourcePermissionPermissions": "Permissions", + "AddResourcePermission": "Add permission", + "ResourcePermissionDeletionConfirmationMessage": "Are you sure you want to delete all permissions?", + "UpdateResourcePermission": "Update permission", + "GrantAllResourcePermissions": "Grant all", + "NoResourceProviderKeyLookupServiceFound": "There is no provider key lookup service was found", + "NoResourcePermissionFound": "There is no permission defined.", + "UpdatePermission": "Update permission", + "NoPermissionsAssigned": "No permissions assigned", + "SelectProvider": "Select provider", + "SearchProviderKey": "Search provider key", + "Provider": "Provider", + "ErrorLoadingPermissions": "Error loading permissions", + "PleaseSelectProviderAndPermissions": "Please select provider and permissions" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en.json index b8299d4e5b..6a4c8d41ab 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Select all", "SaveWithoutAnyPermissionsWarningMessage": "Are you sure you want to save without any permissions?", "PermissionGroup": "Permission Group", - "Filter": "Filter" + "Filter": "Filter", + "ResourcePermissions": "Permissions", + "ResourcePermissionTarget": "Target", + "ResourcePermissionPermissions": "Permissions", + "AddResourcePermission": "Add permission", + "ResourcePermissionDeletionConfirmationMessage": "Are you sure you want to delete all permissions?", + "UpdateResourcePermission": "Update permission", + "GrantAllResourcePermissions": "Grant all", + "NoResourceProviderKeyLookupServiceFound": "There is no provider key lookup service was found", + "NoResourcePermissionFound": "There is no permission defined.", + "UpdatePermission": "Update permission", + "NoPermissionsAssigned": "No permissions assigned", + "SelectProvider": "Select provider", + "SearchProviderKey": "Search provider key", + "Provider": "Provider", + "ErrorLoadingPermissions": "Error loading permissions", + "PleaseSelectProviderAndPermissions": "Please select provider and permissions" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/es.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/es.json index 622883b259..c39091d8a6 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/es.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/es.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Seleccionar todo", "SaveWithoutAnyPermissionsWarningMessage": "¿Estás seguro de que quieres guardar sin ningún permiso?", "PermissionGroup": "Grupo de permisos", - "Filter": "Filtrar" + "Filter": "Filtrar", + "ResourcePermissions": "Permisos", + "ResourcePermissionTarget": "Objetivo", + "ResourcePermissionPermissions": "Permisos", + "AddResourcePermission": "Agregar permiso", + "ResourcePermissionDeletionConfirmationMessage": "¿Está seguro de que desea eliminar todos los permisos?", + "UpdateResourcePermission": "Actualizar permiso", + "GrantAllResourcePermissions": "Conceder todos", + "NoResourceProviderKeyLookupServiceFound": "No se encontró ningún servicio de búsqueda de clave de proveedor", + "NoResourcePermissionFound": "No hay ningún permiso definido.", + "UpdatePermission": "Actualizar permiso", + "NoPermissionsAssigned": "No hay permisos asignados", + "SelectProvider": "Seleccionar proveedor", + "SearchProviderKey": "Buscar clave de proveedor", + "Provider": "Proveedor", + "ErrorLoadingPermissions": "Error al cargar permisos", + "PleaseSelectProviderAndPermissions": "Por favor, selecciona proveedor y permisos" } -} +} \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fa.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fa.json index 7ea9a6c4f3..21c00d539f 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fa.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fa.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "انتخاب همه", "SaveWithoutAnyPermissionsWarningMessage": "آیا مطمئن هستید که می خواهید بدون هیچ دسترسی ذخیره کنید؟", "PermissionGroup": "گروه دسترسی", - "Filter": "فیلتر" + "Filter": "فیلتر", + "ResourcePermissions": "دسترسی‌ها", + "ResourcePermissionTarget": "هدف", + "ResourcePermissionPermissions": "دسترسی‌ها", + "AddResourcePermission": "افزودن مجوز", + "ResourcePermissionDeletionConfirmationMessage": "آیا مطمئن هستید که می‌خواهید همه مجوزها را حذف کنید؟", + "UpdateResourcePermission": "به‌روزرسانی مجوز", + "GrantAllResourcePermissions": "اعطای همه", + "NoResourceProviderKeyLookupServiceFound": "هیچ سرویس جستجوی کلید ارائه‌دهنده یافت نشد", + "NoResourcePermissionFound": "هیچ مجوزی تعریف نشده است.", + "UpdatePermission": "به‌روزرسانی مجوز", + "NoPermissionsAssigned": "هیچ مجوزی اختصاص داده نشده است", + "SelectProvider": "انتخاب کننده‌", + "SearchProviderKey": "جستجوی کلید تامین‌کننده", + "Provider": "تامین‌کننده", + "ErrorLoadingPermissions": "خطا در بارگذاری مجوزها", + "PleaseSelectProviderAndPermissions": "لطفاً تامین‌کننده و مجوزها را انتخاب کنید" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fi.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fi.json index f9b828ade4..43d3ded466 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fi.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fi.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Valitse kaikki", "SaveWithoutAnyPermissionsWarningMessage": "Haluatko varmasti tallentaa ilman käyttöoikeuksia?", "PermissionGroup": "Käyttöoikeus", - "Filter": "Suodatus" + "Filter": "Suodatus", + "ResourcePermissions": "Käyttöoikeudet", + "ResourcePermissionTarget": "Kohde", + "ResourcePermissionPermissions": "Käyttöoikeudet", + "AddResourcePermission": "Lisää käyttöoikeus", + "ResourcePermissionDeletionConfirmationMessage": "Haluatko varmasti poistaa kaikki käyttöoikeudet?", + "UpdateResourcePermission": "Päivitä käyttöoikeus", + "GrantAllResourcePermissions": "Myönnä kaikki", + "NoResourceProviderKeyLookupServiceFound": "Palveluntarjoajan avaimen hakupalvelua ei löytynyt", + "NoResourcePermissionFound": "Ei käyttöoikeuksia määritetty.", + "UpdatePermission": "Päivitä lupa", + "NoPermissionsAssigned": "Ei osoitettuja oikeuksia", + "SelectProvider": "Valitse palveluntarjoaja", + "SearchProviderKey": "Hae palveluntarjoajan avainta", + "Provider": "Palveluntarjoaja", + "ErrorLoadingPermissions": "Virhe ladataessa oikeuksia", + "PleaseSelectProviderAndPermissions": "Valitse palveluntarjoaja ja oikeudet" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fr.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fr.json index 79f4e68377..2d184a2714 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fr.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/fr.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Sélectionner tous les", "SaveWithoutAnyPermissionsWarningMessage": "Êtes-vous sûr de vouloir enregistrer sans aucune autorisation ?", "PermissionGroup": "Groupe d'autorisations", - "Filter": "Filtrer" + "Filter": "Filtrer", + "ResourcePermissions": "Autorisations", + "ResourcePermissionTarget": "Cible", + "ResourcePermissionPermissions": "Autorisations", + "AddResourcePermission": "Ajouter une autorisation", + "ResourcePermissionDeletionConfirmationMessage": "Êtes-vous sûr de vouloir supprimer toutes les autorisations ?", + "UpdateResourcePermission": "Mettre à jour l'autorisation", + "GrantAllResourcePermissions": "Accorder tout", + "NoResourceProviderKeyLookupServiceFound": "Aucun service de recherche de clé de fournisseur n'a été trouvé", + "NoResourcePermissionFound": "Aucune autorisation n'est définie.", + "UpdatePermission": "Mettre à jour l'autorisation", + "NoPermissionsAssigned": "Aucune autorisation assignée", + "SelectProvider": "Sélectionner le fournisseur", + "SearchProviderKey": "Rechercher la clé du fournisseur", + "Provider": "Fournisseur", + "ErrorLoadingPermissions": "Erreur lors du chargement des autorisations", + "PleaseSelectProviderAndPermissions": "Veuillez sélectionner le fournisseur et les autorisations" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hi.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hi.json index cdc030e8ef..f00d5718b9 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hi.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hi.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "सभी का चयन करे", "SaveWithoutAnyPermissionsWarningMessage": "क्या आप वाकई बिना किसी अनुमति के सहेजना चाहते हैं?", "PermissionGroup": "अनुमति समूह", - "Filter": "फ़िल्टर" + "Filter": "फ़िल्टर", + "ResourcePermissions": "अनुमतियाँ", + "ResourcePermissionTarget": "लक्ष्य", + "ResourcePermissionPermissions": "अनुमतियाँ", + "AddResourcePermission": "अनुमति जोड़ें", + "ResourcePermissionDeletionConfirmationMessage": "क्या आप वाकई सभी अनुमतियां हटाना चाहते हैं?", + "UpdateResourcePermission": "अनुमति अपडेट करें", + "GrantAllResourcePermissions": "सभी प्रदान करें", + "NoResourceProviderKeyLookupServiceFound": "कोई प्रदाता कुंजी खोज सेवा नहीं मिली", + "NoResourcePermissionFound": "कोई अनुमति परिभाषित नहीं है।", + "UpdatePermission": "अनुमति अपडेट करें", + "NoPermissionsAssigned": "कोई अनुमति असाइन नहीं की गई", + "SelectProvider": "प्रदाता चुनें", + "SearchProviderKey": "प्रदाता कुंजी खोजें", + "Provider": "प्रदाता", + "ErrorLoadingPermissions": "अनुमतियाँ लोड करने में त्रुटि", + "PleaseSelectProviderAndPermissions": "कृपया प्रदाता और अनुमतियाँ चुनें" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hr.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hr.json index 531d0a35d2..af74766105 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hr.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hr.json @@ -1,13 +1,29 @@ { - "culture": "hr", - "texts": { - "Permissions": "Dozvole", - "OnlyProviderPermissons": "Samo ovaj pružatelj usluga", - "All": "Svi", - "SelectAllInAllTabs": "Dodijelite sva dopuštenja", - "SelectAllInThisTab": "Odaberi sve", - "SaveWithoutAnyPermissionsWarningMessage": "Jeste li sigurni da želite spremiti bez ikakvih dopuštenja?", - "PermissionGroup": "Grupa dozvola", - "Filter": "Filtriraj" - } -} + "culture": "hr", + "texts": { + "Permissions": "Dozvole", + "OnlyProviderPermissons": "Samo ovaj pružatelj usluga", + "All": "Svi", + "SelectAllInAllTabs": "Dodijelite sva dopuštenja", + "SelectAllInThisTab": "Odaberi sve", + "SaveWithoutAnyPermissionsWarningMessage": "Jeste li sigurni da želite spremiti bez ikakvih dopuštenja?", + "PermissionGroup": "Grupa dozvola", + "Filter": "Filtriraj", + "ResourcePermissions": "Dozvole", + "ResourcePermissionTarget": "Cilj", + "ResourcePermissionPermissions": "Dozvole", + "AddResourcePermission": "Dodaj dozvolu", + "ResourcePermissionDeletionConfirmationMessage": "Jeste li sigurni da želite izbrisati sve dozvole?", + "UpdateResourcePermission": "Ažuriraj dozvolu", + "GrantAllResourcePermissions": "Dodijeli sve", + "NoResourceProviderKeyLookupServiceFound": "Nije pronađena usluga za pronalaženje ključa pružatelja", + "NoResourcePermissionFound": "Nijedna dozvola nije definirana.", + "UpdatePermission": "Ažuriraj dopuštenje", + "NoPermissionsAssigned": "Nema dodijeljenih dopuštenja", + "SelectProvider": "Odaberi pružatelja", + "SearchProviderKey": "Traži ključ pružatelja", + "Provider": "Pružatelj", + "ErrorLoadingPermissions": "Pogreška pri učitavanju dopuštenja", + "PleaseSelectProviderAndPermissions": "Molimo odaberite pružatelja i dopuštenja" + } +} \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hu.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hu.json index 3177ef8fa7..e55d15188c 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hu.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/hu.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Mindet kiválaszt", "SaveWithoutAnyPermissionsWarningMessage": "Biztos, hogy engedélyek nélkül akar menteni?", "PermissionGroup": "Engedélycsoport", - "Filter": "Szűrő" + "Filter": "Szűrő", + "ResourcePermissions": "Engedélyek", + "ResourcePermissionTarget": "Cél", + "ResourcePermissionPermissions": "Engedélyek", + "AddResourcePermission": "Engedély hozzáadása", + "ResourcePermissionDeletionConfirmationMessage": "Biztosan törölni szeretné az összes engedélyt?", + "UpdateResourcePermission": "Engedély frissítése", + "GrantAllResourcePermissions": "Összes engedély megadása", + "NoResourceProviderKeyLookupServiceFound": "Nem található szolgáltató kulcs kereső szolgáltatás", + "NoResourcePermissionFound": "Nincs meghatározva engedély.", + "UpdatePermission": "Jogosultság frissítése", + "NoPermissionsAssigned": "Nincsenek jogosultságok hozzárendelve", + "SelectProvider": "Szolgáltató kiválasztása", + "SearchProviderKey": "Szolgáltatói kulcs keresése", + "Provider": "Szolgáltató", + "ErrorLoadingPermissions": "Hiba a jogosultságok betöltésekor", + "PleaseSelectProviderAndPermissions": "Kérjük, válassza ki a szolgáltatót és a jogosultságokat" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/is.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/is.json index 7db32eb99e..be40ed7020 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/is.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/is.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Velja allt", "SaveWithoutAnyPermissionsWarningMessage": "Ertu viss um að þú viljir vista án nokkurra heimilda?", "PermissionGroup": "Heimildahópur", - "Filter": "Sía" + "Filter": "Sía", + "ResourcePermissions": "Heimildir", + "ResourcePermissionTarget": "Markmið", + "ResourcePermissionPermissions": "Heimildir", + "AddResourcePermission": "Bæta við heimild", + "ResourcePermissionDeletionConfirmationMessage": "Ertu viss um að þú viljir eyða öllum heimildum?", + "UpdateResourcePermission": "Uppfæra heimild", + "GrantAllResourcePermissions": "Veita allt", + "NoResourceProviderKeyLookupServiceFound": "Engin þjónusta fannst til að leita að lykli veitanda", + "NoResourcePermissionFound": "Engin heimild er skilgreind.", + "UpdatePermission": "Uppfæra leyfi", + "NoPermissionsAssigned": "Engar heimildir skráðar", + "SelectProvider": "Velja þjónustuaðila", + "SearchProviderKey": "Leita að lykli þjónustuaðila", + "Provider": "Þjónustuaðili", + "ErrorLoadingPermissions": "Villa við að hlaða leyfum", + "PleaseSelectProviderAndPermissions": "Vinsamlegast veldu þjónustuaðila og leyfi" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/it.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/it.json index e473c7b310..af689bad29 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/it.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/it.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Seleziona tutto", "SaveWithoutAnyPermissionsWarningMessage": "Sei sicuro di voler salvare senza alcuna autorizzazione?", "PermissionGroup": "Gruppo di autorizzazioni", - "Filter": "Filtro" + "Filter": "Filtro", + "ResourcePermissions": "Autorizzazioni", + "ResourcePermissionTarget": "Obiettivo", + "ResourcePermissionPermissions": "Autorizzazioni", + "AddResourcePermission": "Aggiungi autorizzazione", + "ResourcePermissionDeletionConfirmationMessage": "Sei sicuro di voler eliminare tutte le autorizzazioni?", + "UpdateResourcePermission": "Aggiorna autorizzazione", + "GrantAllResourcePermissions": "Concedi tutto", + "NoResourceProviderKeyLookupServiceFound": "Non è stato trovato alcun servizio di ricerca chiave del provider", + "NoResourcePermissionFound": "Non è definita alcuna autorizzazione.", + "UpdatePermission": "Aggiorna permesso", + "NoPermissionsAssigned": "Nessun permesso assegnato", + "SelectProvider": "Seleziona fornitore", + "SearchProviderKey": "Cerca chiave fornitore", + "Provider": "Fornitore", + "ErrorLoadingPermissions": "Errore durante il caricamento dei permessi", + "PleaseSelectProviderAndPermissions": "Selezionare fornitore e permessi" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/nl.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/nl.json index 4b928c4d03..5c86bd91da 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/nl.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/nl.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Selecteer alles", "SaveWithoutAnyPermissionsWarningMessage": "Weet u zeker dat u zonder rechten wilt opslaan?", "PermissionGroup": "Rechtengroep", - "Filter": "Filter" + "Filter": "Filter", + "ResourcePermissions": "Rechten", + "ResourcePermissionTarget": "Doel", + "ResourcePermissionPermissions": "Rechten", + "AddResourcePermission": "Recht toevoegen", + "ResourcePermissionDeletionConfirmationMessage": "Weet u zeker dat u alle rechten wilt verwijderen?", + "UpdateResourcePermission": "Recht bijwerken", + "GrantAllResourcePermissions": "Alles toekennen", + "NoResourceProviderKeyLookupServiceFound": "Er is geen service gevonden voor het opzoeken van de sleutel van de provider", + "NoResourcePermissionFound": "Er is geen machtiging gedefinieerd.", + "UpdatePermission": "Machtiging bijwerken", + "NoPermissionsAssigned": "Geen machtigingen toegewezen", + "SelectProvider": "Selecteer provider", + "SearchProviderKey": "Zoek provider sleutel", + "Provider": "Provider", + "ErrorLoadingPermissions": "Fout bij laden van machtigingen", + "PleaseSelectProviderAndPermissions": "Selecteer provider en machtigingen" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pl-PL.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pl-PL.json index ee483651eb..ce24bc88a0 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pl-PL.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pl-PL.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Zaznacz wszystkie", "SaveWithoutAnyPermissionsWarningMessage": "Czy na pewno chcesz zapisać bez żadnych uprawnień?", "PermissionGroup": "Grupa uprawnień", - "Filter": "Filtr" + "Filter": "Filtr", + "ResourcePermissions": "Uprawnienia", + "ResourcePermissionTarget": "Cel", + "ResourcePermissionPermissions": "Uprawnienia", + "AddResourcePermission": "Dodaj uprawnienie", + "ResourcePermissionDeletionConfirmationMessage": "Czy na pewno chcesz usunąć wszystkie uprawnienia?", + "UpdateResourcePermission": "Zaktualizuj uprawnienie", + "GrantAllResourcePermissions": "Przyznaj wszystko", + "NoResourceProviderKeyLookupServiceFound": "Nie znaleziono usługi wyszukiwania klucza dostawcy", + "NoResourcePermissionFound": "Nie zdefiniowano żadnych uprawnień.", + "UpdatePermission": "Aktualizuj uprawnienie", + "NoPermissionsAssigned": "Brak przypisanych uprawnień", + "SelectProvider": "Wybierz dostawcę", + "SearchProviderKey": "Szukaj klucza dostawcy", + "Provider": "Dostawca", + "ErrorLoadingPermissions": "Błąd podczas ładowania uprawnień", + "PleaseSelectProviderAndPermissions": "Wybierz dostawcę i uprawnienia" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pt-BR.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pt-BR.json index 28231b227f..50c65d248a 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pt-BR.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/pt-BR.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Selecionar todos", "SaveWithoutAnyPermissionsWarningMessage": "Tem certeza que deseja salvar sem nenhuma permissão?", "PermissionGroup": "Grupo de permissão", - "Filter": "Filtrar" + "Filter": "Filtrar", + "ResourcePermissions": "Permissões", + "ResourcePermissionTarget": "Alvo", + "ResourcePermissionPermissions": "Permissões", + "AddResourcePermission": "Adicionar permissão", + "ResourcePermissionDeletionConfirmationMessage": "Tem certeza de que deseja excluir todas as permissões?", + "UpdateResourcePermission": "Atualizar permissão", + "GrantAllResourcePermissions": "Conceder tudo", + "NoResourceProviderKeyLookupServiceFound": "Nenhum serviço de pesquisa de chave do provedor foi encontrado", + "NoResourcePermissionFound": "Nenhuma permissão foi definida.", + "UpdatePermission": "Atualizar permissão", + "NoPermissionsAssigned": "Nenhuma permissão atribuída", + "SelectProvider": "Selecionar provedor", + "SearchProviderKey": "Pesquisar chave do provedor", + "Provider": "Provedor", + "ErrorLoadingPermissions": "Erro ao carregar permissões", + "PleaseSelectProviderAndPermissions": "Por favor, selecione o provedor e as permissões" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ro-RO.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ro-RO.json index af7db26acb..8cab09b9d5 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ro-RO.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ro-RO.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Selectează toate", "SaveWithoutAnyPermissionsWarningMessage": "Sigur doriți să salvați fără nicio permisiune?", "PermissionGroup": "Grup de permisiuni", - "Filter": "Filtru" + "Filter": "Filtru", + "ResourcePermissions": "Permisiuni", + "ResourcePermissionTarget": "Țintă", + "ResourcePermissionPermissions": "Permisiuni", + "AddResourcePermission": "Adăugați permisiune", + "ResourcePermissionDeletionConfirmationMessage": "Sigur doriți să ștergeți toate permisiunile?", + "UpdateResourcePermission": "Actualizați permisiunea", + "GrantAllResourcePermissions": "Acordați toate", + "NoResourceProviderKeyLookupServiceFound": "Nu a fost găsit niciun serviciu de căutare a cheii furnizorului", + "NoResourcePermissionFound": "Nu există nicio permisiune definită.", + "UpdatePermission": "Actualizează permisiunea", + "NoPermissionsAssigned": "Nicio permisiune atribuită", + "SelectProvider": "Selectează furnizor", + "SearchProviderKey": "Caută cheie furnizor", + "Provider": "Furnizor", + "ErrorLoadingPermissions": "Eroare la încărcarea permisiunilor", + "PleaseSelectProviderAndPermissions": "Vă rugăm să selectați furnizorul și permisiunile" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ru.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ru.json index 6041357b0e..81e0160345 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ru.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/ru.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Выбрать все", "SaveWithoutAnyPermissionsWarningMessage": "Вы уверены, что хотите сохранить без каких-либо разрешений?", "PermissionGroup": "Группа разрешений", - "Filter": "Фильтр" + "Filter": "Фильтр", + "ResourcePermissions": "Разрешения", + "ResourcePermissionTarget": "Цель", + "ResourcePermissionPermissions": "Разрешения", + "AddResourcePermission": "Добавить разрешение", + "ResourcePermissionDeletionConfirmationMessage": "Вы уверены, что хотите удалить все разрешения?", + "UpdateResourcePermission": "Обновить разрешение", + "GrantAllResourcePermissions": "Предоставить все", + "NoResourceProviderKeyLookupServiceFound": "Служба поиска ключа поставщика не найдена", + "NoResourcePermissionFound": "Не определено ни одного разрешения.", + "UpdatePermission": "Обновить разрешение", + "NoPermissionsAssigned": "Нет назначенных разрешений", + "SelectProvider": "Выбрать провайдера", + "SearchProviderKey": "Поиск ключа провайдера", + "Provider": "Провайдер", + "ErrorLoadingPermissions": "Ошибка при загрузке разрешений", + "PleaseSelectProviderAndPermissions": "Пожалуйста, выберите провайдера и разрешения" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sk.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sk.json index c079b8eba1..80e5719fc7 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sk.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sk.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Vybrať všetky", "SaveWithoutAnyPermissionsWarningMessage": "Naozaj chcete ukladať bez akýchkoľvek povolení?", "PermissionGroup": "Skupina oprávnení", - "Filter": "Filtrovať" + "Filter": "Filtrovať", + "ResourcePermissions": "Oprávnenia", + "ResourcePermissionTarget": "Cieľ", + "ResourcePermissionPermissions": "Oprávnenia", + "AddResourcePermission": "Pridať oprávnenie", + "ResourcePermissionDeletionConfirmationMessage": "Naozaj chcete odstrániť všetky oprávnenia?", + "UpdateResourcePermission": "Aktualizovať oprávnenie", + "GrantAllResourcePermissions": "Udeľ všetko", + "NoResourceProviderKeyLookupServiceFound": "Nebola nájdená služba na vyhľadávanie kľúča poskytovateľa", + "NoResourcePermissionFound": "Nie je definované žiadne povolenie.", + "UpdatePermission": "Aktualizovať oprávnenie", + "NoPermissionsAssigned": "Nie sú priradené žiadne oprávnenia", + "SelectProvider": "Vybrat poskytovateľa", + "SearchProviderKey": "Hľadať kľúč poskytovateľa", + "Provider": "Poskytovateľ", + "ErrorLoadingPermissions": "Chyba pri načítaní oprávnení", + "PleaseSelectProviderAndPermissions": "Vyberte poskytovateľa a oprávnenia" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sl.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sl.json index 9c906f7387..c5e5c61382 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sl.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sl.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Izberi vse", "SaveWithoutAnyPermissionsWarningMessage": "Ali ste prepričani, da želite shraniti brez kakršnih koli dovoljenj?", "PermissionGroup": "Skupina dovoljenj", - "Filter": "Filtriraj" + "Filter": "Filtriraj", + "ResourcePermissions": "Dovoljenja", + "ResourcePermissionTarget": "Cilj", + "ResourcePermissionPermissions": "Dovoljenja", + "AddResourcePermission": "Dodaj dovoljenje", + "ResourcePermissionDeletionConfirmationMessage": "Ali ste prepričani, da želite izbrisati vsa dovoljenja?", + "UpdateResourcePermission": "Posodobi dovoljenje", + "GrantAllResourcePermissions": "Dodeli vse", + "NoResourceProviderKeyLookupServiceFound": "Ni bilo mogoče najti storitve za iskanje ključa ponudnika", + "NoResourcePermissionFound": "Nobeno dovoljenje ni določeno.", + "UpdatePermission": "Posodobi dovoljenje", + "NoPermissionsAssigned": "Ni dodeljenih dovoljenj", + "SelectProvider": "Izberi ponudnika", + "SearchProviderKey": "Išči ključ ponudnika", + "Provider": "Ponudnik", + "ErrorLoadingPermissions": "Napaka pri nalaganju dovoljenj", + "PleaseSelectProviderAndPermissions": "Izberite ponudnika in dovoljenja" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sv.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sv.json index d46fca4dc4..c666cbd8c0 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sv.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/sv.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Välj alla", "SaveWithoutAnyPermissionsWarningMessage": "Är du säker på att du vill spara utan några behörigheter?", "PermissionGroup": "Behörighetsgrupp", - "Filter": "Filtrera" + "Filter": "Filtrera", + "ResourcePermissions": "Behörigheter", + "ResourcePermissionTarget": "Mål", + "ResourcePermissionPermissions": "Behörigheter", + "AddResourcePermission": "Lägg till behörighet", + "ResourcePermissionDeletionConfirmationMessage": "Är du säker på att du vill ta bort alla behörigheter?", + "UpdateResourcePermission": "Uppdatera behörighet", + "GrantAllResourcePermissions": "Bevilja alla", + "NoResourceProviderKeyLookupServiceFound": "Ingen tjänst för att söka efter leverantörsnyckel hittades", + "NoResourcePermissionFound": "Ingen behörighet är definierad.", + "UpdatePermission": "Uppdatera behörighet", + "NoPermissionsAssigned": "Inga behörigheter tilldelade", + "SelectProvider": "Välj leverantör", + "SearchProviderKey": "Sök leverantörsnyckel", + "Provider": "Leverantör", + "ErrorLoadingPermissions": "Fel vid laddning av behörigheter", + "PleaseSelectProviderAndPermissions": "Välj leverantör och behörigheter" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/tr.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/tr.json index 960cd8cf02..b6eb5f1c7b 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/tr.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/tr.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Hepsini seç", "SaveWithoutAnyPermissionsWarningMessage": "Hiçbir izin olmadan kaydetmek istediğinize emin misiniz?", "PermissionGroup": "İzin Grubu", - "Filter": "Filtre" + "Filter": "Filtre", + "ResourcePermissions": "İzinler", + "ResourcePermissionTarget": "Hedef", + "ResourcePermissionPermissions": "İzinler", + "AddResourcePermission": "İzin ekle", + "ResourcePermissionDeletionConfirmationMessage": "Tüm izinleri silmek istediğinizden emin misiniz?", + "UpdateResourcePermission": "İzni güncelle", + "GrantAllResourcePermissions": "Tümünü ver", + "NoResourceProviderKeyLookupServiceFound": "Herhangi bir sağlayıcı anahtar arama hizmeti bulunamadı", + "NoResourcePermissionFound": "Herhangi bir izin tanımlı değil.", + "UpdatePermission": "İzni güncelle", + "NoPermissionsAssigned": "Atanmış izin bulunamadı", + "SelectProvider": "Sağlayıcı seç", + "SearchProviderKey": "Sağlayıcı anahtarını ara", + "Provider": "Sağlayıcı", + "ErrorLoadingPermissions": "İzinler yüklenirken hata oluştu", + "PleaseSelectProviderAndPermissions": "Lütfen sağlayıcı ve izinleri seçin" } -} +} \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/vi.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/vi.json index 5e9a9d8565..0a26e43253 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/vi.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/vi.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "Chọn tất cả", "SaveWithoutAnyPermissionsWarningMessage": "Bạn có chắc chắn muốn lưu mà không có bất kỳ quyền nào không?", "PermissionGroup": "Nhóm quyền", - "Filter": "Lọc" + "Filter": "Lọc", + "ResourcePermissions": "Quyền", + "ResourcePermissionTarget": "Mục tiêu", + "ResourcePermissionPermissions": "Quyền", + "AddResourcePermission": "Thêm quyền", + "ResourcePermissionDeletionConfirmationMessage": "Bạn có chắc chắn muốn xóa tất cả quyền không?", + "UpdateResourcePermission": "Cập nhật quyền", + "GrantAllResourcePermissions": "Cấp tất cả", + "NoResourceProviderKeyLookupServiceFound": "Không tìm thấy dịch vụ tra cứu khóa nhà cung cấp", + "NoResourcePermissionFound": "Không có quyền nào được định nghĩa.", + "UpdatePermission": "Cập nhật quyền", + "NoPermissionsAssigned": "Chưa được cấp quyền", + "SelectProvider": "Chọn nhà cung cấp", + "SearchProviderKey": "Tìm kiếm khóa nhà cung cấp", + "Provider": "Nhà cung cấp", + "ErrorLoadingPermissions": "Lỗi khi tải quyền", + "PleaseSelectProviderAndPermissions": "Vui lòng chọn nhà cung cấp và quyền" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hans.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hans.json index df844ca2bf..2c84e3462d 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hans.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hans.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "全选", "SaveWithoutAnyPermissionsWarningMessage": "您确定要在没有任何权限的情况下保存吗?", "PermissionGroup": "权限组", - "Filter": "过滤" + "Filter": "过滤", + "ResourcePermissions": "权限", + "ResourcePermissionTarget": "目标", + "ResourcePermissionPermissions": "权限", + "AddResourcePermission": "添加权限", + "ResourcePermissionDeletionConfirmationMessage": "您确定要删除所有权限吗?", + "UpdateResourcePermission": "更新权限", + "GrantAllResourcePermissions": "授予所有", + "NoResourceProviderKeyLookupServiceFound": "未找到提供者键查找服务", + "NoResourcePermissionFound": "未定义任何权限。", + "UpdatePermission": "更新权限", + "NoPermissionsAssigned": "未分配权限", + "SelectProvider": "选择提供程序", + "SearchProviderKey": "搜索提供程序密钥", + "Provider": "提供程序", + "ErrorLoadingPermissions": "加载权限时出错", + "PleaseSelectProviderAndPermissions": "请选择提供程序和权限" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json index 72af56c960..afd9d65459 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json @@ -8,6 +8,22 @@ "SelectAllInThisTab": "全選", "SaveWithoutAnyPermissionsWarningMessage": "您確定要在沒有任何權限的情況下保存嗎?", "PermissionGroup": "權限組", - "Filter": "過濾" + "Filter": "過濾", + "ResourcePermissions": "權限", + "ResourcePermissionTarget": "目標", + "ResourcePermissionPermissions": "權限", + "AddResourcePermission": "添加權限", + "ResourcePermissionDeletionConfirmationMessage": "您確定要刪除所有權限嗎?", + "UpdateResourcePermission": "更新權限", + "GrantAllResourcePermissions": "授予所有", + "NoResourceProviderKeyLookupServiceFound": "未找到提供者鍵查找服務", + "NoResourcePermissionFound": "未定義任何權限。", + "UpdatePermission": "更新權限", + "NoPermissionsAssigned": "未分配權限", + "SelectProvider": "選擇提供者", + "SearchProviderKey": "搜尋提供者金鑰", + "Provider": "提供者", + "ErrorLoadingPermissions": "載入權限時出錯", + "PleaseSelectProviderAndPermissions": "請選擇提供者和權限" } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionDefinitionRecordConsts.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionDefinitionRecordConsts.cs index 93b1b465c6..0aadef7940 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionDefinitionRecordConsts.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionDefinitionRecordConsts.cs @@ -6,10 +6,14 @@ public class PermissionDefinitionRecordConsts /// Default value: 128 ///
public static int MaxNameLength { get; set; } = 128; - + public static int MaxDisplayNameLength { get; set; } = 256; public static int MaxProvidersLength { get; set; } = 128; - + public static int MaxStateCheckersLength { get; set; } = 256; -} \ No newline at end of file + + public static int MaxResourceNameLength { get; set; } = 256; + + public static int MaxManagementPermissionNameLength { get; set; } = 128; +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs index 630f5dc72e..d1008bcbdb 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs @@ -11,4 +11,14 @@ public static class PermissionGrantConsts /// Default value: 64 ///
public static int MaxProviderKeyLength { get; set; } = 64; + + /// + /// Default value: 256 + /// + public static int MaxResourceNameLength { get; set; } = 256; + + /// + /// Default value: 256 + /// + public static int MaxResourceKeyLength { get; set; } = 256; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStore.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStore.cs index f2e73cefc0..ff525ab263 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStore.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStore.cs @@ -23,7 +23,7 @@ public class DynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStor protected IAbpDistributedLock DistributedLock { get; } public PermissionManagementOptions PermissionManagementOptions { get; } protected AbpDistributedCacheOptions CacheOptions { get; } - + public DynamicPermissionDefinitionStore( IPermissionGroupDefinitionRecordRepository permissionGroupRepository, IPermissionDefinitionRecordRepository permissionRepository, @@ -72,6 +72,34 @@ public class DynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStor } } + public virtual async Task GetResourcePermissionOrNullAsync(string resourceName, string name) + { + if (!PermissionManagementOptions.IsDynamicPermissionStoreEnabled) + { + return null; + } + + using (await StoreCache.SyncSemaphore.LockAsync()) + { + await EnsureCacheIsUptoDateAsync(); + return StoreCache.GetResourcePermissionOrNull(resourceName, name); + } + } + + public virtual async Task> GetResourcePermissionsAsync() + { + if (!PermissionManagementOptions.IsDynamicPermissionStoreEnabled) + { + return Array.Empty(); + } + + using (await StoreCache.SyncSemaphore.LockAsync()) + { + await EnsureCacheIsUptoDateAsync(); + return StoreCache.GetResourcePermissions().ToImmutableList(); + } + } + public virtual async Task> GetGroupsAsync() { if (!PermissionManagementOptions.IsDynamicPermissionStoreEnabled) @@ -94,9 +122,9 @@ public class DynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStor /* We get the latest permission with a small delay for optimization */ return; } - + var stampInDistributedCache = await GetOrSetStampInDistributedCache(); - + if (stampInDistributedCache == StoreCache.CacheStamp) { StoreCache.LastCheckTime = DateTime.Now; @@ -145,7 +173,7 @@ public class DynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStor } stampInDistributedCache = Guid.NewGuid().ToString(); - + await DistributedCache.SetStringAsync( cacheKey, stampInDistributedCache, @@ -163,9 +191,9 @@ public class DynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStor { return $"{CacheOptions.KeyPrefix}_AbpInMemoryPermissionCacheStamp"; } - + protected virtual string GetCommonDistributedLockKey() { return $"{CacheOptions.KeyPrefix}_Common_AbpPermissionUpdateLock"; } -} \ No newline at end of file +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStoreInMemoryCache.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStoreInMemoryCache.cs index 1040ea84a0..15a98c84dd 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStoreInMemoryCache.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStoreInMemoryCache.cs @@ -18,6 +18,7 @@ public class DynamicPermissionDefinitionStoreInMemoryCache : protected IDictionary PermissionGroupDefinitions { get; } protected IDictionary PermissionDefinitions { get; } + protected IList ResourcePermissionDefinitions { get; } protected ISimpleStateCheckerSerializer StateCheckerSerializer { get; } protected ILocalizableStringSerializer LocalizableStringSerializer { get; } @@ -34,6 +35,7 @@ public class DynamicPermissionDefinitionStoreInMemoryCache : PermissionGroupDefinitions = new Dictionary(); PermissionDefinitions = new Dictionary(); + ResourcePermissionDefinitions = new List(); } public Task FillAsync( @@ -42,9 +44,22 @@ public class DynamicPermissionDefinitionStoreInMemoryCache : { PermissionGroupDefinitions.Clear(); PermissionDefinitions.Clear(); + ResourcePermissionDefinitions.Clear(); var context = new PermissionDefinitionContext(null); + var resourcePermissions = permissionRecords.Where(x => !x.ResourceName.IsNullOrWhiteSpace()); + foreach (var resourcePermission in resourcePermissions) + { + context.AddResourcePermission(resourcePermission.Name, + resourcePermission.ResourceName, + resourcePermission.ManagementPermissionName, + resourcePermission.DisplayName != null ? LocalizableStringSerializer.Deserialize(resourcePermission.DisplayName) : null, + resourcePermission.MultiTenancySide, + resourcePermission.IsEnabled); + } + + var permissions = permissionRecords.Where(x => x.ResourceName.IsNullOrWhiteSpace()).ToList(); foreach (var permissionGroupRecord in permissionGroupRecords) { var permissionGroup = context.AddGroup( @@ -59,12 +74,12 @@ public class DynamicPermissionDefinitionStoreInMemoryCache : permissionGroup[property.Key] = property.Value; } - var permissionRecordsInThisGroup = permissionRecords + var permissionRecordsInThisGroup = permissions .Where(p => p.GroupName == permissionGroup.Name); foreach (var permissionRecord in permissionRecordsInThisGroup.Where(x => x.ParentName == null)) { - AddPermissionRecursively(permissionGroup, permissionRecord, permissionRecords); + AddPermissionRecursively(permissionGroup, permissionRecord, permissions); } } @@ -86,6 +101,16 @@ public class DynamicPermissionDefinitionStoreInMemoryCache : return PermissionGroupDefinitions.Values.ToList(); } + public PermissionDefinition GetResourcePermissionOrNull(string resourceName, string name) + { + return ResourcePermissionDefinitions.FirstOrDefault(p => p.ResourceName == resourceName && p.Name == name); + } + + public IReadOnlyList GetResourcePermissions() + { + return ResourcePermissionDefinitions.ToList(); + } + private void AddPermissionRecursively(ICanAddChildPermission permissionContainer, PermissionDefinitionRecord permissionRecord, List allPermissionRecords) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IDynamicPermissionDefinitionStoreInMemoryCache.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IDynamicPermissionDefinitionStoreInMemoryCache.cs index 2dab588ebd..eb079f6c76 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IDynamicPermissionDefinitionStoreInMemoryCache.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IDynamicPermissionDefinitionStoreInMemoryCache.cs @@ -9,9 +9,9 @@ namespace Volo.Abp.PermissionManagement; public interface IDynamicPermissionDefinitionStoreInMemoryCache { string CacheStamp { get; set; } - + SemaphoreSlim SyncSemaphore { get; } - + DateTime? LastCheckTime { get; set; } Task FillAsync( @@ -19,8 +19,12 @@ public interface IDynamicPermissionDefinitionStoreInMemoryCache List permissionRecords); PermissionDefinition GetPermissionOrNull(string name); - + IReadOnlyList GetPermissions(); - + IReadOnlyList GetGroups(); -} \ No newline at end of file + + PermissionDefinition GetResourcePermissionOrNull(string resourceName, string name); + + IReadOnlyList GetResourcePermissions(); +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionDefinitionSerializer.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionDefinitionSerializer.cs index 8ed09a4380..3c5f4a8783 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionDefinitionSerializer.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionDefinitionSerializer.cs @@ -10,10 +10,13 @@ public interface IPermissionDefinitionSerializer Task<(PermissionGroupDefinitionRecord[], PermissionDefinitionRecord[])> SerializeAsync(IEnumerable permissionGroups); + Task SerializeAsync( + IEnumerable permissions); + Task SerializeAsync( PermissionGroupDefinition permissionGroup); Task SerializeAsync( PermissionDefinition permission, [CanBeNull] PermissionGroupDefinition permissionGroup); -} \ No newline at end of file +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs index 7ec69ad100..ffb934321b 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs @@ -4,19 +4,39 @@ using JetBrains.Annotations; namespace Volo.Abp.PermissionManagement; -//TODO: Write extension methods for simple IsGranted check - public interface IPermissionManager { - Task GetAsync(string permissionName, string providerName, string providerKey); - - Task GetAsync(string[] permissionNames, string provideName, string providerKey); - - Task> GetAllAsync([NotNull] string providerName, [NotNull] string providerKey); - - Task SetAsync(string permissionName, string providerName, string providerKey, bool isGranted); - - Task UpdateProviderKeyAsync(PermissionGrant permissionGrant, string providerKey); - - Task DeleteAsync(string providerName, string providerKey); -} + Task GetAsync( + string permissionName, + string providerName, + string providerKey + ); + + Task GetAsync( + string[] permissionNames, + string provideName, + string providerKey + ); + + Task> GetAllAsync( + [NotNull] string providerName, + [NotNull] string providerKey + ); + + Task SetAsync( + string permissionName, + string providerName, + string providerKey, + bool isGranted + ); + + Task UpdateProviderKeyAsync( + PermissionGrant permissionGrant, + string providerKey + ); + + Task DeleteAsync( + string providerName, + string providerKey + ); +} \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionGrantRepository.cs new file mode 100644 index 0000000000..82060c7ea7 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionGrantRepository.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace Volo.Abp.PermissionManagement; + +public interface IResourcePermissionGrantRepository : IBasicRepository +{ + Task FindAsync( + string name, + string resourceName, + string resourceKey, + string providerName, + string providerKey, + CancellationToken cancellationToken = default + ); + + Task> GetListAsync( + string resourceName, + string resourceKey, + string providerName, + string providerKey, + CancellationToken cancellationToken = default + ); + + Task> GetListAsync( + string[] names, + string resourceName, + string resourceKey, + string providerName, + string providerKey, + CancellationToken cancellationToken = default + ); + + Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default + ); + + Task> GetPermissionsAsync( + string resourceName, + string resourceKey, + CancellationToken cancellationToken = default + ); + + Task> GetResourceKeys( + string resourceName, + string name, + CancellationToken cancellationToken = default + ); +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionManagementProvider.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionManagementProvider.cs new file mode 100644 index 0000000000..429e6f6e85 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionManagementProvider.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using JetBrains.Annotations; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.PermissionManagement; + +public interface IResourcePermissionManagementProvider : ISingletonDependency //TODO: Consider to remove this pre-assumption +{ + string Name { get; } + + Task CheckAsync( + [NotNull] string name, + [NotNull] string resourceName, + [NotNull] string resourceKey, + [NotNull] string providerName, + [NotNull] string providerKey + ); + + Task CheckAsync( + [NotNull] string[] names, + [NotNull] string resourceName, + [NotNull] string resourceKey, + [NotNull] string providerName, + [NotNull] string providerKey + ); + + Task SetAsync( + [NotNull] string name, + [NotNull] string resourceName, + [NotNull] string resourceKey, + [NotNull] string providerKey, + bool isGranted + ); +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionManager.cs new file mode 100644 index 0000000000..5bd2d143ca --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionManager.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions; + +namespace Volo.Abp.PermissionManagement; + +public interface IResourcePermissionManager +{ + Task> GetProviderKeyLookupServicesAsync(); + + Task GetProviderKeyLookupServiceAsync(string providerName); + + Task> GetAvailablePermissionsAsync(string resourceName); + + Task GetAsync( + string permissionName, + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + Task GetAsync( + string[] permissionNames, + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + Task> GetAllAsync( + string resourceName, + string resourceKey + ); + + Task> GetAllAsync( + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + Task> GetAllGroupAsync( + string resourceName, + string resourceKey + ); + + Task SetAsync( + string permissionName, + string resourceName, + string resourceKey, + string providerName, + string providerKey, + bool isGranted + ); + + Task UpdateProviderKeyAsync( + ResourcePermissionGrant resourcePermissionGrant, + string providerKey + ); + + Task DeleteAsync( + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + Task DeleteAsync( + string name, + string resourceName, + string resourceKey, + string providerName, + string providerKey + ); + + Task DeleteAsync( + string providerName, + string providerKey + ); +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionProviderKeyLookupService.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionProviderKeyLookupService.cs new file mode 100644 index 0000000000..aa6ad2a06e --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IResourcePermissionProviderKeyLookupService.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Localization; + +namespace Volo.Abp.PermissionManagement; + +public interface IResourcePermissionProviderKeyLookupService +{ + public string Name { get; } + + public ILocalizableString DisplayName { get; } + + Task> SearchAsync(string filter = null, int page = 1, CancellationToken cancellationToken = default); + + Task> SearchAsync(string[] keys, CancellationToken cancellationToken = default); +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/MultipleResourcePermissionValueProviderGrantInfo.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/MultipleResourcePermissionValueProviderGrantInfo.cs new file mode 100644 index 0000000000..4ff1790488 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/MultipleResourcePermissionValueProviderGrantInfo.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Volo.Abp.PermissionManagement; + +public class MultipleResourcePermissionValueProviderGrantInfo +{ + public Dictionary Result { get; } + + public MultipleResourcePermissionValueProviderGrantInfo() + { + Result = new Dictionary(); + } + + public MultipleResourcePermissionValueProviderGrantInfo(string[] names) + { + Check.NotNull(names, nameof(names)); + + Result = new Dictionary(); + + foreach (var name in names) + { + Result.Add(name, ResourcePermissionValueProviderGrantInfo.NonGranted); + } + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionRecord.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionRecord.cs index 7473eb2589..61a6ba1f14 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionRecord.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionRecord.cs @@ -1,4 +1,5 @@ using System; +using Volo.Abp.Authorization.Permissions; using Volo.Abp.Data; using Volo.Abp.Domain.Entities; using Volo.Abp.MultiTenancy; @@ -11,6 +12,10 @@ public class PermissionDefinitionRecord : BasicAggregateRoot, IHasExtraPro public string Name { get; set; } + public string ResourceName { get; set; } + + public string ManagementPermissionName { get; set; } + public string ParentName { get; set; } public string DisplayName { get; set; } @@ -41,6 +46,8 @@ public class PermissionDefinitionRecord : BasicAggregateRoot, IHasExtraPro Guid id, string groupName, string name, + string resourceName, + string managementPermissionName, string parentName, string displayName, bool isEnabled = true, @@ -49,8 +56,14 @@ public class PermissionDefinitionRecord : BasicAggregateRoot, IHasExtraPro string stateCheckers = null) : base(id) { - GroupName = Check.NotNullOrWhiteSpace(groupName, nameof(groupName), PermissionGroupDefinitionRecordConsts.MaxNameLength); + GroupName = groupName; + if (resourceName == null) + { + GroupName = Check.NotNullOrWhiteSpace(groupName, nameof(groupName), PermissionGroupDefinitionRecordConsts.MaxNameLength); + } Name = Check.NotNullOrWhiteSpace(name, nameof(name), PermissionDefinitionRecordConsts.MaxNameLength); + ResourceName = resourceName; + ManagementPermissionName = managementPermissionName; ParentName = Check.Length(parentName, nameof(parentName), PermissionDefinitionRecordConsts.MaxNameLength); DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), PermissionDefinitionRecordConsts.MaxDisplayNameLength); IsEnabled = isEnabled; @@ -69,6 +82,16 @@ public class PermissionDefinitionRecord : BasicAggregateRoot, IHasExtraPro return false; } + if (ResourceName != otherRecord.ResourceName) + { + return false; + } + + if (ManagementPermissionName != otherRecord.ManagementPermissionName) + { + return false; + } + if (GroupName != otherRecord.GroupName) { return false; @@ -119,6 +142,16 @@ public class PermissionDefinitionRecord : BasicAggregateRoot, IHasExtraPro Name = otherRecord.Name; } + if (ResourceName != otherRecord.ResourceName) + { + ResourceName = otherRecord.ResourceName; + } + + if (ManagementPermissionName != otherRecord.ManagementPermissionName) + { + ManagementPermissionName = otherRecord.ManagementPermissionName; + } + if (GroupName != otherRecord.GroupName) { GroupName = otherRecord.GroupName; diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer.cs index 8e63342502..707a3e89ea 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer.cs @@ -19,7 +19,7 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I public PermissionDefinitionSerializer( IGuidGenerator guidGenerator, - ISimpleStateCheckerSerializer stateCheckerSerializer, + ISimpleStateCheckerSerializer stateCheckerSerializer, ILocalizableStringSerializer localizableStringSerializer) { StateCheckerSerializer = stateCheckerSerializer; @@ -27,16 +27,16 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I GuidGenerator = guidGenerator; } - public async Task<(PermissionGroupDefinitionRecord[], PermissionDefinitionRecord[])> + public virtual async Task<(PermissionGroupDefinitionRecord[], PermissionDefinitionRecord[])> SerializeAsync(IEnumerable permissionGroups) { var permissionGroupRecords = new List(); var permissionRecords = new List(); - + foreach (var permissionGroup in permissionGroups) { permissionGroupRecords.Add(await SerializeAsync(permissionGroup)); - + foreach (var permission in permissionGroup.GetPermissionsWithChildren()) { permissionRecords.Add(await SerializeAsync(permission, permissionGroup)); @@ -45,8 +45,19 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I return (permissionGroupRecords.ToArray(), permissionRecords.ToArray()); } - - public Task SerializeAsync(PermissionGroupDefinition permissionGroup) + + public virtual async Task SerializeAsync(IEnumerable permissions) + { + var permissionRecords = new List(); + foreach (var permission in permissions) + { + permissionRecords.Add(await SerializeAsync(permission, null)); + } + + return permissionRecords.ToArray(); + } + + public virtual Task SerializeAsync(PermissionGroupDefinition permissionGroup) { using (CultureHelper.Use(CultureInfo.InvariantCulture)) { @@ -60,12 +71,12 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I { permissionGroupRecord.SetProperty(property.Key, property.Value); } - + return Task.FromResult(permissionGroupRecord); } } - - public Task SerializeAsync( + + public virtual Task SerializeAsync( PermissionDefinition permission, PermissionGroupDefinition permissionGroup) { @@ -75,6 +86,8 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I GuidGenerator.Create(), permissionGroup?.Name, permission.Name, + permission.ResourceName, + permission.ManagementPermissionName, permission.Parent?.Name, LocalizableStringSerializer.Serialize(permission.DisplayName), permission.IsEnabled, @@ -87,11 +100,11 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I { permissionRecord.SetProperty(property.Key, property.Value); } - + return Task.FromResult(permissionRecord); } } - + protected virtual string SerializeProviders(ICollection providers) { return providers.Any() @@ -103,4 +116,4 @@ public class PermissionDefinitionSerializer : IPermissionDefinitionSerializer, I { return StateCheckerSerializer.Serialize(stateCheckers); } -} \ No newline at end of file +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs index 489ae26e3d..2971cc18ae 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementOptions.cs @@ -9,6 +9,10 @@ public class PermissionManagementOptions public Dictionary ProviderPolicies { get; } + public ITypeList ResourceManagementProviders { get; } + + public ITypeList ResourcePermissionProviderKeyLookupServices { get; } + /// /// Default: true. /// @@ -23,5 +27,8 @@ public class PermissionManagementOptions { ManagementProviders = new TypeList(); ProviderPolicies = new Dictionary(); + + ResourceManagementProviders = new TypeList(); + ResourcePermissionProviderKeyLookupServices = new TypeList(); } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionProviderWithPermissions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionProviderWithPermissions.cs new file mode 100644 index 0000000000..a6507ef0bc --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionProviderWithPermissions.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Volo.Abp.Localization; + +namespace Volo.Abp.PermissionManagement; + +public class PermissionProviderWithPermissions +{ + public string ProviderName { get; set; } + + public string ProviderKey { get; set; } + + public string ProviderDisplayName { get; set; } + + public ILocalizableString ProviderNameDisplayName { get; set; } + + public List Permissions { get; set; } + + public PermissionProviderWithPermissions(string providerName, string providerKey, string providerDisplayName) + { + ProviderName = providerName; + ProviderKey = providerKey; + ProviderDisplayName = providerDisplayName; + Permissions = new List(); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrant.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrant.cs new file mode 100644 index 0000000000..b74da527ae --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrant.cs @@ -0,0 +1,52 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement; + +//TODO: To aggregate root? +public class ResourcePermissionGrant : Entity, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + + [NotNull] + public virtual string Name { get; protected set; } + + [NotNull] + public virtual string ProviderName { get; protected set; } + + [NotNull] + public virtual string ProviderKey { get; protected internal set; } + + [NotNull] + public virtual string ResourceName { get; protected set; } + + [NotNull] + public virtual string ResourceKey { get; protected set; } + + protected ResourcePermissionGrant() + { + + } + + public ResourcePermissionGrant( + Guid id, + [NotNull] string name, + [NotNull] string resourceName, + [NotNull] string resourceKey, + [NotNull] string providerName, + [CanBeNull] string providerKey, + Guid? tenantId = null) + { + Check.NotNull(name, nameof(name)); + + Id = id; + Name = Check.NotNullOrWhiteSpace(name, nameof(name)); + ResourceName = Check.NotNullOrWhiteSpace(resourceName, nameof(resourceName)); + ResourceKey = Check.NotNullOrWhiteSpace(resourceKey, nameof(resourceKey)); + ProviderName = Check.NotNullOrWhiteSpace(providerName, nameof(providerName)); + ProviderKey = Check.NotNullOrWhiteSpace(providerKey, nameof(providerKey)); + TenantId = tenantId; + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItem.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItem.cs new file mode 100644 index 0000000000..59362f6f5f --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItem.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq; +using Volo.Abp.Text.Formatting; + +namespace Volo.Abp.PermissionManagement; + +[Serializable] +public class ResourcePermissionGrantCacheItem +{ + private const string CacheKeyFormat = "rn:{0},rk:{1},pn:{2},pk:{3},n:{4}"; + + public bool IsGranted { get; set; } + + public ResourcePermissionGrantCacheItem() + { + + } + + public ResourcePermissionGrantCacheItem(bool isGranted) + { + IsGranted = isGranted; + } + + public static string CalculateCacheKey(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + return string.Format(CacheKeyFormat, resourceName, resourceKey, providerName, providerKey, name); + } + + public static string GetPermissionNameFormCacheKeyOrNull(string cacheKey) + { + var result = FormattedStringValueExtracter.Extract(cacheKey, CacheKeyFormat, true); + return result.IsMatch ? result.Matches.Last().Value : null; + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItemInvalidator.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItemInvalidator.cs new file mode 100644 index 0000000000..97c116de56 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItemInvalidator.cs @@ -0,0 +1,44 @@ +using System.Threading.Tasks; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionGrantCacheItemInvalidator : + ILocalEventHandler>, + ITransientDependency +{ + protected ICurrentTenant CurrentTenant { get; } + + protected IDistributedCache Cache { get; } + + public ResourcePermissionGrantCacheItemInvalidator(IDistributedCache cache, ICurrentTenant currentTenant) + { + Cache = cache; + CurrentTenant = currentTenant; + } + + public virtual async Task HandleEventAsync(EntityChangedEventData eventData) + { + var cacheKey = CalculateCacheKey( + eventData.Entity.Name, + eventData.Entity.ResourceName, + eventData.Entity.ResourceKey, + eventData.Entity.ProviderName, + eventData.Entity.ProviderKey + ); + + using (CurrentTenant.Change(eventData.Entity.TenantId)) + { + await Cache.RemoveAsync(cacheKey, considerUow: true); + } + } + + protected virtual string CalculateCacheKey(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + return ResourcePermissionGrantCacheItem.CalculateCacheKey(name, resourceName, resourceKey, providerName, providerKey); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionManagementProvider.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionManagementProvider.cs new file mode 100644 index 0000000000..90d4e176d3 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionManagementProvider.cs @@ -0,0 +1,87 @@ +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement; + +public abstract class ResourcePermissionManagementProvider : IResourcePermissionManagementProvider +{ + public abstract string Name { get; } + + protected IResourcePermissionGrantRepository ResourcePermissionGrantRepository { get; } + + protected IGuidGenerator GuidGenerator { get; } + + protected ICurrentTenant CurrentTenant { get; } + + protected ResourcePermissionManagementProvider( + IResourcePermissionGrantRepository resourcePermissionGrantRepository, + IGuidGenerator guidGenerator, + ICurrentTenant currentTenant) + { + ResourcePermissionGrantRepository = resourcePermissionGrantRepository; + GuidGenerator = guidGenerator; + CurrentTenant = currentTenant; + } + + public virtual async Task CheckAsync(string name, string resourceName,string resourceKey, string providerName, string providerKey) + { + var multiplePermissionValueProviderGrantInfo = await CheckAsync(new[] { name }, resourceName, resourceKey, providerName, providerKey); + + return multiplePermissionValueProviderGrantInfo.Result.First().Value; + } + + public virtual async Task CheckAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey) + { + using (ResourcePermissionGrantRepository.DisableTracking()) + { + var multiplePermissionValueProviderGrantInfo = new MultipleResourcePermissionValueProviderGrantInfo(names); + if (providerName != Name) + { + return multiplePermissionValueProviderGrantInfo; + } + + var resourcePermissionGrants = await ResourcePermissionGrantRepository.GetListAsync(names, resourceName, resourceKey, providerName, providerKey); + + foreach (var permissionName in names) + { + var isGrant = resourcePermissionGrants.Any(x => x.Name == permissionName); + multiplePermissionValueProviderGrantInfo.Result[permissionName] = new ResourcePermissionValueProviderGrantInfo(isGrant, providerKey); + } + + return multiplePermissionValueProviderGrantInfo; + } + } + + public virtual Task SetAsync(string name, string resourceName,string resourceKey, string providerKey, bool isGranted) + { + return isGranted + ? GrantAsync(name, resourceName, resourceKey, providerKey) + : RevokeAsync(name, resourceName, resourceKey, providerKey); + } + + protected virtual async Task GrantAsync(string name, string resourceName, string resourceKey, string providerKey) + { + var resourcePermissionGrants = await ResourcePermissionGrantRepository.FindAsync(name, resourceName, resourceKey, Name, providerKey); + if (resourcePermissionGrants != null) + { + return; + } + + resourcePermissionGrants = new ResourcePermissionGrant(GuidGenerator.Create(), name, resourceName, resourceKey, Name, providerKey, CurrentTenant.Id); + await ResourcePermissionGrantRepository.InsertAsync(resourcePermissionGrants, true); + } + + protected virtual async Task RevokeAsync(string name, string resourceName,string resourceKey, string providerKey) + { + var resourcePermissionGrants = await ResourcePermissionGrantRepository.FindAsync(name, resourceName, resourceKey, Name, providerKey); + if (resourcePermissionGrants == null) + { + return; + } + + await ResourcePermissionGrantRepository.DeleteAsync(resourcePermissionGrants, true); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionManager.cs new file mode 100644 index 0000000000..c4b898e761 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionManager.cs @@ -0,0 +1,405 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; +using Volo.Abp.MultiTenancy; +using Volo.Abp.SimpleStateChecking; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionManager : IResourcePermissionManager, ISingletonDependency +{ + protected IResourcePermissionGrantRepository ResourcePermissionGrantRepository { get; } + + protected IPermissionDefinitionManager PermissionDefinitionManager { get; } + + protected ISimpleStateCheckerManager SimpleStateCheckerManager { get; } + + protected IGuidGenerator GuidGenerator { get; } + + protected ICurrentTenant CurrentTenant { get; } + + protected IReadOnlyList ManagementProviders => _lazyProviders.Value; + + protected PermissionManagementOptions Options { get; } + + protected IDistributedCache Cache { get; } + + private readonly Lazy> _lazyProviders; + + private readonly Lazy> _lazyProviderKeyLookupServices; + + public ResourcePermissionManager( + IPermissionDefinitionManager permissionDefinitionManager, + ISimpleStateCheckerManager simpleStateCheckerManager, + IResourcePermissionGrantRepository resourcePermissionGrantRepository, + IServiceProvider serviceProvider, + IGuidGenerator guidGenerator, + IOptions options, + ICurrentTenant currentTenant, + IDistributedCache cache) + { + GuidGenerator = guidGenerator; + CurrentTenant = currentTenant; + Cache = cache; + SimpleStateCheckerManager = simpleStateCheckerManager; + ResourcePermissionGrantRepository = resourcePermissionGrantRepository; + PermissionDefinitionManager = permissionDefinitionManager; + Options = options.Value; + + _lazyProviders = new Lazy>( + () => Options + .ResourceManagementProviders + .Select(c => serviceProvider.GetRequiredService(c) as IResourcePermissionManagementProvider) + .ToList(), + true + ); + + _lazyProviderKeyLookupServices = new Lazy>( + () => Options + .ResourcePermissionProviderKeyLookupServices + .Select(c => serviceProvider.GetRequiredService(c) as IResourcePermissionProviderKeyLookupService) + .ToList(), + true + ); + } + + public virtual Task> GetProviderKeyLookupServicesAsync() + { + return Task.FromResult(_lazyProviderKeyLookupServices.Value); + } + + public virtual Task GetProviderKeyLookupServiceAsync(string serviceName) + { + var service = _lazyProviderKeyLookupServices.Value.FirstOrDefault(s => s.Name == serviceName); + return service == null + ? throw new AbpException("Unknown resource permission provider key lookup service: " + serviceName) + : Task.FromResult(service); + } + + public virtual async Task> GetAvailablePermissionsAsync(string resourceName) + { + var multiTenancySide = CurrentTenant.GetMultiTenancySide(); + var resourcePermissions = new List(); + foreach (var resourcePermission in (await PermissionDefinitionManager.GetResourcePermissionsAsync()) + .Where(x => x.IsEnabled && x.MultiTenancySide.HasFlag(multiTenancySide) && x.ResourceName == resourceName)) + { + if (await SimpleStateCheckerManager.IsEnabledAsync(resourcePermission)) + { + resourcePermissions.Add(resourcePermission); + } + } + + return resourcePermissions; + } + + public virtual async Task GetAsync(string permissionName, string resourceName, string resourceKey, string providerName, string providerKey) + { + var permission = await PermissionDefinitionManager.GetResourcePermissionOrNullAsync(resourceName, permissionName); + if (permission == null || permission.ResourceName != resourceName) + { + return new PermissionWithGrantedProviders(permissionName, false); + } + + return await GetInternalAsync( + permission, + resourceName, + resourceKey, + providerName, + providerKey + ); + } + + public virtual async Task GetAsync(string[] permissionNames, string resourceName, string resourceKey, string providerName, string providerKey) + { + var permissions = new List(); + var undefinedPermissions = new List(); + + foreach (var permissionName in permissionNames) + { + var permission = await PermissionDefinitionManager.GetResourcePermissionOrNullAsync(resourceName, permissionName); + if (permission != null && permission.ResourceName == resourceName) + { + permissions.Add(permission); + } + else + { + undefinedPermissions.Add(permissionName); + } + } + + if (!permissions.Any()) + { + return new MultiplePermissionWithGrantedProviders(undefinedPermissions.ToArray()); + } + + var result = await GetInternalAsync( + permissions.ToArray(), + resourceName, + resourceKey, + providerName, + providerKey + ); + + foreach (var undefinedPermission in undefinedPermissions) + { + result.Result.Add(new PermissionWithGrantedProviders(undefinedPermission, false)); + } + + return result; + } + + public virtual async Task> GetAllAsync(string resourceName, string resourceKey) + { + var resourcePermissionDefinitions = await GetAvailablePermissionsAsync(resourceName); + var resourcePermissionGrants = await ResourcePermissionGrantRepository.GetPermissionsAsync(resourceName, resourceKey); + var result = new List(); + foreach (var resourcePermissionDefinition in resourcePermissionDefinitions) + { + var permissionWithGrantedProviders = new PermissionWithGrantedProviders(resourcePermissionDefinition.Name, false); + + var grantedPermissions = resourcePermissionGrants + .Where(x => x.Name == resourcePermissionDefinition.Name && x.ResourceName == resourceName && x.ResourceKey == resourceKey) + .ToList(); + + if (grantedPermissions.Any()) + { + permissionWithGrantedProviders.IsGranted = true; + foreach (var grantedPermission in grantedPermissions) + { + permissionWithGrantedProviders.Providers.Add(new PermissionValueProviderInfo(grantedPermission.ProviderName, grantedPermission.ProviderKey)); + } + } + + result.Add(permissionWithGrantedProviders); + } + + return result; + } + + public virtual async Task> GetAllAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + var permissionDefinitions = await GetAvailablePermissionsAsync(resourceName); + var multiplePermissionWithGrantedProviders = await GetInternalAsync(permissionDefinitions.ToArray(), resourceName, resourceKey, providerName, providerKey); + return multiplePermissionWithGrantedProviders.Result; + } + + public virtual async Task> GetAllGroupAsync(string resourceName, string resourceKey) + { + var resourcePermissions = await GetAvailablePermissionsAsync(resourceName); + var resourcePermissionGrants = await ResourcePermissionGrantRepository.GetPermissionsAsync(resourceName, resourceKey); + resourcePermissionGrants = resourcePermissionGrants.Where(x => resourcePermissions.Any(rp => rp.Name == x.Name)).ToList(); + var resourcePermissionGrantsGroup = resourcePermissionGrants.GroupBy(x => new { x.ProviderName, x.ProviderKey }); + var result = new List(); + foreach (var resourcePermissionGrant in resourcePermissionGrantsGroup) + { + result.Add(new PermissionProviderWithPermissions(resourcePermissionGrant.Key.ProviderName, resourcePermissionGrant.Key.ProviderKey, resourcePermissionGrant.Key.ProviderKey) + { + Permissions = resourcePermissionGrant.Select(x => x.Name).ToList() + }); + } + + if (result.Any()) + { + var providerKeyInfos = new Dictionary>(); + var resourcePermissionProviderGroup = resourcePermissionGrants.GroupBy(x => x.ProviderName); + var providerKeyLookupServices = await GetProviderKeyLookupServicesAsync(); + foreach (var resourcePermissionProvider in resourcePermissionProviderGroup) + { + var providerKeyLookupService = providerKeyLookupServices.FirstOrDefault(s => s.Name == resourcePermissionProvider.Key); + if (providerKeyLookupService == null) + { + continue; + } + var keys = resourcePermissionProvider.Select(rp => rp.ProviderKey).Distinct().ToList(); + providerKeyInfos.Add(resourcePermissionProvider.Key, await providerKeyLookupService.SearchAsync(keys.ToArray())); + } + + foreach (var item in result) + { + if (!providerKeyInfos.TryGetValue(item.ProviderName, out var providerKeyInfoList)) + { + continue; + } + + var providerKeyInfo = providerKeyInfoList.FirstOrDefault(p => p.ProviderKey == item.ProviderKey); + if (providerKeyInfo != null) + { + item.ProviderDisplayName = providerKeyInfo.ProviderDisplayName; + item.ProviderNameDisplayName = providerKeyLookupServices + .FirstOrDefault(s => s.Name == item.ProviderName)?.DisplayName; + } + } + } + + return result; + } + + public virtual async Task SetAsync(string permissionName, string resourceName, string resourceKey, string providerName, string providerKey, bool isGranted) + { + var permission = await PermissionDefinitionManager.GetResourcePermissionOrNullAsync(resourceName, permissionName); + if (permission == null || permission.ResourceName != resourceName) + { + /* Silently ignore undefined permissions, + maybe they were removed from dynamic permission definition store */ + return; + } + + if (!permission.IsEnabled || !await SimpleStateCheckerManager.IsEnabledAsync(permission)) + { + //TODO: BusinessException + throw new ApplicationException($"The resource permission named '{permission.Name}' is disabled!"); + } + + if (permission.Providers.Any() && !permission.Providers.Contains(providerName)) + { + //TODO: BusinessException + throw new ApplicationException($"The resource permission named '{permission.Name}' has not compatible with the provider named '{providerName}'"); + } + + if (!permission.MultiTenancySide.HasFlag(CurrentTenant.GetMultiTenancySide())) + { + //TODO: BusinessException + throw new ApplicationException($"The resource permission named '{permission.Name}' has multitenancy side '{permission.MultiTenancySide}' which is not compatible with the current multitenancy side '{CurrentTenant.GetMultiTenancySide()}'"); + } + + var currentGrantInfo = await GetInternalAsync(permission, resourceName, resourceKey, providerName, providerKey); + if (currentGrantInfo.IsGranted == isGranted && currentGrantInfo.Providers.Any(x => x.Name == providerName && x.Key == providerKey)) + { + return; + } + + var provider = ManagementProviders.FirstOrDefault(m => m.Name == providerName); + if (provider == null) + { + //TODO: BusinessException + throw new AbpException("Unknown resource permission management provider: " + providerName); + } + + await provider.SetAsync(permissionName, resourceName, resourceKey, providerKey, isGranted); + } + + public virtual async Task UpdateProviderKeyAsync(ResourcePermissionGrant resourcePermissionGrant, string providerKey) + { + using (CurrentTenant.Change(resourcePermissionGrant.TenantId)) + { + //Invalidating the cache for the old key + await Cache.RemoveAsync( + ResourcePermissionGrantCacheItem.CalculateCacheKey( + resourcePermissionGrant.Name, + resourcePermissionGrant.ResourceName, + resourcePermissionGrant.ResourceKey, + resourcePermissionGrant.ProviderName, + resourcePermissionGrant.ProviderKey + ) + ); + } + + resourcePermissionGrant.ProviderKey = providerKey; + return await ResourcePermissionGrantRepository.UpdateAsync(resourcePermissionGrant, true); + } + + public virtual async Task UpdateProviderKeyAsync(ResourcePermissionGrant resourcePermissionGrant, string resourceName, string resourceKey, string providerKey) + { + using (CurrentTenant.Change(resourcePermissionGrant.TenantId)) + { + //Invalidating the cache for the old key + await Cache.RemoveAsync( + ResourcePermissionGrantCacheItem.CalculateCacheKey( + resourcePermissionGrant.Name, + resourcePermissionGrant.ResourceName, + resourcePermissionGrant.ResourceKey, + resourcePermissionGrant.ProviderName, + resourcePermissionGrant.ProviderKey + ) + ); + } + + resourcePermissionGrant.ProviderKey = providerKey; + return await ResourcePermissionGrantRepository.UpdateAsync(resourcePermissionGrant, true); + } + + public virtual async Task DeleteAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + var permissionGrants = await ResourcePermissionGrantRepository.GetListAsync(resourceName, resourceKey, providerName, providerKey); + foreach (var permissionGrant in permissionGrants) + { + await ResourcePermissionGrantRepository.DeleteAsync(permissionGrant, true); + } + } + + public virtual async Task DeleteAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + var permissionGrant = await ResourcePermissionGrantRepository.FindAsync(name, resourceName, resourceKey, providerName, providerKey); + if (permissionGrant != null) + { + await ResourcePermissionGrantRepository.DeleteAsync(permissionGrant, true); + } + } + + public virtual async Task DeleteAsync(string providerName, string providerKey) + { + var permissionGrants = await ResourcePermissionGrantRepository.GetListAsync(providerName, providerKey); + foreach (var permissionGrant in permissionGrants) + { + await ResourcePermissionGrantRepository.DeleteAsync(permissionGrant, true); + } + } + + protected virtual async Task GetInternalAsync(PermissionDefinition permission, string resourceName, string resourceKey, string providerName, string providerKey) + { + var multiplePermissionWithGrantedProviders = await GetInternalAsync( + new[] { permission }, + resourceName, + resourceKey, + providerName, + providerKey + ); + + return multiplePermissionWithGrantedProviders.Result.First(); + } + + protected virtual async Task GetInternalAsync(PermissionDefinition[] permissions, string resourceName, string resourceKey, string providerName, string providerKey) + { + var permissionNames = permissions.Select(x => x.Name).ToArray(); + var multiplePermissionWithGrantedProviders = new MultiplePermissionWithGrantedProviders(permissionNames); + + var resourcePermissions = await GetAvailablePermissionsAsync(resourceName); + if (!resourcePermissions.Any()) + { + return multiplePermissionWithGrantedProviders; + } + + foreach (var provider in ManagementProviders) + { + permissionNames = resourcePermissions.Select(x => x.Name).ToArray(); + var multiplePermissionValueProviderGrantInfo = await provider.CheckAsync(permissionNames, resourceName, resourceKey, providerName, providerKey); + + foreach (var providerResultDict in multiplePermissionValueProviderGrantInfo.Result) + { + if (providerResultDict.Value.IsGranted) + { + var permissionWithGrantedProvider = multiplePermissionWithGrantedProviders.Result + .FirstOrDefault(x => x.Name == providerResultDict.Key); + + if (permissionWithGrantedProvider == null) + { + continue; + } + + permissionWithGrantedProvider.IsGranted = true; + permissionWithGrantedProvider.Providers.Add( + new PermissionValueProviderInfo(provider.Name, providerResultDict.Value.ProviderKey)); + } + } + } + + return multiplePermissionWithGrantedProviders; + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionProviderKeyInfo.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionProviderKeyInfo.cs new file mode 100644 index 0000000000..841277514a --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionProviderKeyInfo.cs @@ -0,0 +1,16 @@ +using Volo.Abp.ObjectExtending; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionProviderKeyInfo +{ + public string ProviderKey { get; set; } + + public string ProviderDisplayName { get; set; } + + public ResourcePermissionProviderKeyInfo(string providerKey, string providerDisplayName) + { + ProviderKey = providerKey; + ProviderDisplayName = providerDisplayName; + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionStore.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionStore.cs new file mode 100644 index 0000000000..9e09ff2db4 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionStore.cs @@ -0,0 +1,249 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionStore : IResourcePermissionStore, ITransientDependency +{ + public ILogger Logger { get; set; } + + protected IResourcePermissionGrantRepository ResourcePermissionGrantRepository { get; } + + protected IPermissionDefinitionManager PermissionDefinitionManager { get; } + + protected IDistributedCache Cache { get; } + + public ResourcePermissionStore( + IResourcePermissionGrantRepository resourcePermissionGrantRepository, + IDistributedCache cache, + IPermissionDefinitionManager permissionDefinitionManager) + { + ResourcePermissionGrantRepository = resourcePermissionGrantRepository; + Cache = cache; + PermissionDefinitionManager = permissionDefinitionManager; + Logger = NullLogger.Instance; + } + + public virtual async Task IsGrantedAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + return (await GetCacheItemAsync(name, resourceName, resourceKey, providerName, providerKey)).IsGranted; + } + + protected virtual async Task GetCacheItemAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + var cacheKey = CalculateCacheKey(name, providerName, providerKey, resourceName, resourceKey); + + Logger.LogDebug($"ResourcePermissionStore.GetCacheItemAsync: {cacheKey}"); + + var cacheItem = await Cache.GetAsync(cacheKey); + + if (cacheItem != null) + { + Logger.LogDebug($"Found in the cache: {cacheKey}"); + return cacheItem; + } + + Logger.LogDebug($"Not found in the cache: {cacheKey}"); + + cacheItem = new ResourcePermissionGrantCacheItem(false); + + await SetCacheItemsAsync(resourceName, resourceKey, providerName, providerKey, name, cacheItem); + + return cacheItem; + } + + protected virtual async Task SetCacheItemsAsync(string resourceName, string resourceKey, string providerName, string providerKey, string currentName, ResourcePermissionGrantCacheItem currentCacheItem) + { + using (ResourcePermissionGrantRepository.DisableTracking()) + { + var permissions = await PermissionDefinitionManager.GetResourcePermissionsAsync(); + + Logger.LogDebug($"Getting all granted resource permissions from the repository for resource name,key:{resourceName},{resourceKey} and provider name,key: {providerName},{providerKey}"); + + var grantedPermissionsHashSet = new HashSet( + (await ResourcePermissionGrantRepository.GetListAsync(resourceName, resourceKey, providerName, providerKey)).Select(p => p.Name) + ); + + Logger.LogDebug($"Setting the cache items. Count: {permissions.Count}"); + + var cacheItems = new List>(); + + foreach (var permission in permissions) + { + var isGranted = grantedPermissionsHashSet.Contains(permission.Name); + + cacheItems.Add(new KeyValuePair( + CalculateCacheKey(permission.Name, resourceName, resourceKey, providerName, providerKey), + new ResourcePermissionGrantCacheItem(isGranted)) + ); + + if (permission.Name == currentName) + { + currentCacheItem.IsGranted = isGranted; + } + } + + await Cache.SetManyAsync(cacheItems); + + Logger.LogDebug($"Finished setting the cache items. Count: {permissions.Count}"); + } + } + + public virtual async Task IsGrantedAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey) + { + Check.NotNullOrEmpty(names, nameof(names)); + + var result = new MultiplePermissionGrantResult(); + + if (names.Length == 1) + { + var name = names.First(); + result.Result.Add(name, + await IsGrantedAsync(names.First(), resourceName, resourceKey, providerName, providerKey) + ? PermissionGrantResult.Granted + : PermissionGrantResult.Undefined); + return result; + } + + var cacheItems = await GetCacheItemsAsync(names, resourceName, resourceKey, providerName, providerKey); + foreach (var item in cacheItems) + { + result.Result.Add(GetPermissionNameFormCacheKeyOrNull(item.Key), + item.Value != null && item.Value.IsGranted + ? PermissionGrantResult.Granted + : PermissionGrantResult.Undefined); + } + + return result; + } + + protected virtual async Task>> GetCacheItemsAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey) + { + var cacheKeys = names.Select(x => CalculateCacheKey(x, resourceName, resourceKey, providerName, providerKey)).ToList(); + + Logger.LogDebug($"ResourcePermissionStore.GetCacheItemAsync: {string.Join(",", cacheKeys)}"); + + var cacheItems = (await Cache.GetManyAsync(cacheKeys)).ToList(); + if (cacheItems.All(x => x.Value != null)) + { + Logger.LogDebug($"Found in the cache: {string.Join(",", cacheKeys)}"); + return cacheItems; + } + + var notCacheKeys = cacheItems.Where(x => x.Value == null).Select(x => x.Key).ToList(); + + Logger.LogDebug($"Not found in the cache: {string.Join(",", notCacheKeys)}"); + + var newCacheItems = await SetCacheItemsAsync(resourceName, resourceKey, providerName, providerKey, notCacheKeys); + + var result = new List>(); + foreach (var key in cacheKeys) + { + var item = newCacheItems.FirstOrDefault(x => x.Key == key); + if (item.Value == null) + { + item = cacheItems.FirstOrDefault(x => x.Key == key); + } + + result.Add(new KeyValuePair(key, item.Value)); + } + + return result; + } + + protected virtual async Task>> SetCacheItemsAsync(string resourceName, string resourceKey, string providerName, string providerKey, List notCacheKeys) + { + using (ResourcePermissionGrantRepository.DisableTracking()) + { + var permissionNames = new HashSet(notCacheKeys.Select(GetPermissionNameFormCacheKeyOrNull)); + var permissions = (await PermissionDefinitionManager.GetResourcePermissionsAsync()) + .Where(x => permissionNames.Contains(x.Name)) + .ToList(); + + Logger.LogDebug($"Getting not cache granted permissions from the repository for resource name,key:{resourceName},{resourceKey} and provider name,key: {providerName},{providerKey}"); + + var grantedPermissionsHashSet = new HashSet( + (await ResourcePermissionGrantRepository.GetListAsync(permissionNames.ToArray(), resourceName, resourceKey, providerName, providerKey)).Select(p => p.Name) + ); + + Logger.LogDebug($"Setting the cache items. Count: {permissions.Count}"); + + var cacheItems = new List>(); + + foreach (var permission in permissions) + { + var isGranted = grantedPermissionsHashSet.Contains(permission.Name); + + cacheItems.Add(new KeyValuePair( + CalculateCacheKey(permission.Name, resourceName, resourceKey, providerName, providerKey), + new ResourcePermissionGrantCacheItem(isGranted)) + ); + } + + await Cache.SetManyAsync(cacheItems); + + Logger.LogDebug($"Finished setting the cache items. Count: {permissions.Count}"); + + return cacheItems; + } + } + + public virtual async Task GetPermissionsAsync(string resourceName, string resourceKey) + { + using (ResourcePermissionGrantRepository.DisableTracking()) + { + var result = new MultiplePermissionGrantResult(); + + var resourcePermissions = (await PermissionDefinitionManager.GetResourcePermissionsAsync()).Where(x => x.ResourceName == resourceName).ToList(); + var permissionGrants = await ResourcePermissionGrantRepository.GetPermissionsAsync(resourceName, resourceKey); + foreach (var resourcePermission in resourcePermissions) + { + var isGranted = permissionGrants.Any(x => x.Name == resourcePermission.Name); + result.Result.Add(resourcePermission.Name, isGranted ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined); + } + + return result; + } + } + + public virtual async Task GetGrantedPermissionsAsync(string resourceName, string resourceKey) + { + var resourcePermissions = (await PermissionDefinitionManager.GetResourcePermissionsAsync()).Where(x => x.ResourceName == resourceName).ToList(); + var grantedPermissions = await ResourcePermissionGrantRepository.GetPermissionsAsync(resourceName, resourceKey); + + var result = new List(); + foreach (var grantedPermission in grantedPermissions) + { + if (resourcePermissions.Any(x => x.Name == grantedPermission.Name)) + { + result.Add(grantedPermission.Name); + } + } + + return result.ToArray(); + } + + public virtual async Task GetGrantedResourceKeysAsync(string resourceName, string name) + { + return (await ResourcePermissionGrantRepository.GetResourceKeys(resourceName, name)).Select(x => x.ResourceKey).ToArray(); + } + + protected virtual string GetPermissionNameFormCacheKeyOrNull(string key) + { + //TODO: throw ex when name is null? + return ResourcePermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull(key); + } + + protected virtual string CalculateCacheKey(string name, string resourceName, string resourceKey, string providerName, string providerKey) + { + return ResourcePermissionGrantCacheItem.CalculateCacheKey(name, resourceName, resourceKey, providerName, providerKey); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionValueProviderGrantInfo.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionValueProviderGrantInfo.cs new file mode 100644 index 0000000000..5cb0d5013a --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/ResourcePermissionValueProviderGrantInfo.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionValueProviderGrantInfo //TODO: Rename to ResourcePermissionGrantInfo +{ + public static ResourcePermissionValueProviderGrantInfo NonGranted { get; } = new ResourcePermissionValueProviderGrantInfo(false); + + public virtual bool IsGranted { get; set; } + + public virtual string ProviderKey { get; set; } + + public ResourcePermissionValueProviderGrantInfo(bool isGranted, [CanBeNull] string providerKey = null) + { + IsGranted = isGranted; + ProviderKey = providerKey; + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionDefinitionChangedEventHandler.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionDefinitionChangedEventHandler.cs index ceff978a96..5f6dd1e700 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionDefinitionChangedEventHandler.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionDefinitionChangedEventHandler.cs @@ -10,13 +10,13 @@ namespace Volo.Abp.PermissionManagement; public class StaticPermissionDefinitionChangedEventHandler : ILocalEventHandler, ITransientDependency { - protected IStaticDefinitionCache> GroupCache { get; } + protected IStaticDefinitionCache, List)> GroupCache { get; } protected IStaticDefinitionCache> DefinitionCache { get; } protected PermissionDynamicInitializer PermissionDynamicInitializer { get; } protected ICancellationTokenProvider CancellationTokenProvider { get; } public StaticPermissionDefinitionChangedEventHandler( - IStaticDefinitionCache> groupCache, + IStaticDefinitionCache, List)> groupCache, IStaticDefinitionCache> definitionCache, PermissionDynamicInitializer permissionDynamicInitializer, ICancellationTokenProvider cancellationTokenProvider) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionSaver.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionSaver.cs index d1dff35f35..c672207f4f 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionSaver.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionSaver.cs @@ -85,6 +85,12 @@ public class StaticPermissionSaver : IStaticPermissionSaver, ITransientDependenc await StaticStore.GetGroupsAsync() ); + var resourcePermissions = await PermissionSerializer.SerializeAsync( + await StaticStore.GetResourcePermissionsAsync() + ); + + permissionRecords = permissionRecords.Union(resourcePermissions).ToArray(); + var currentHash = CalculateHash( permissionGroupRecords, permissionRecords, diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs index fa6862abf6..c7bf3f2a5a 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs @@ -27,6 +27,23 @@ public static class AbpPermissionManagementDbContextModelBuilderExtensions b.ApplyObjectExtensionMappings(); }); + builder.Entity(b => + { + b.ToTable(AbpPermissionManagementDbProperties.DbTablePrefix + "ResourcePermissionGrants", AbpPermissionManagementDbProperties.DbSchema); + + b.ConfigureByConvention(); + + b.Property(x => x.Name).HasMaxLength(PermissionDefinitionRecordConsts.MaxNameLength).IsRequired(); + b.Property(x => x.ResourceName).HasMaxLength(PermissionGrantConsts.MaxResourceNameLength).IsRequired(); + b.Property(x => x.ResourceKey).HasMaxLength(PermissionGrantConsts.MaxResourceKeyLength).IsRequired(); + b.Property(x => x.ProviderName).HasMaxLength(PermissionGrantConsts.MaxProviderNameLength).IsRequired(); + b.Property(x => x.ProviderKey).HasMaxLength(PermissionGrantConsts.MaxProviderKeyLength).IsRequired(); + + b.HasIndex(x => new { x.TenantId, x.Name, x.ResourceName, x.ResourceKey, x.ProviderName, x.ProviderKey }).IsUnique(); + + b.ApplyObjectExtensionMappings(); + }); + if (builder.IsHostDatabase()) { builder.Entity(b => @@ -52,16 +69,16 @@ public static class AbpPermissionManagementDbContextModelBuilderExtensions b.ConfigureByConvention(); - b.Property(x => x.GroupName).HasMaxLength(PermissionGroupDefinitionRecordConsts.MaxNameLength) - .IsRequired(); + b.Property(x => x.GroupName).HasMaxLength(PermissionGroupDefinitionRecordConsts.MaxNameLength); b.Property(x => x.Name).HasMaxLength(PermissionDefinitionRecordConsts.MaxNameLength).IsRequired(); + b.Property(x => x.ResourceName).HasMaxLength(PermissionDefinitionRecordConsts.MaxResourceNameLength); + b.Property(x => x.ManagementPermissionName).HasMaxLength(PermissionDefinitionRecordConsts.MaxManagementPermissionNameLength); b.Property(x => x.ParentName).HasMaxLength(PermissionDefinitionRecordConsts.MaxNameLength); - b.Property(x => x.DisplayName).HasMaxLength(PermissionDefinitionRecordConsts.MaxDisplayNameLength) - .IsRequired(); + b.Property(x => x.DisplayName).HasMaxLength(PermissionDefinitionRecordConsts.MaxDisplayNameLength).IsRequired(); b.Property(x => x.Providers).HasMaxLength(PermissionDefinitionRecordConsts.MaxProvidersLength); b.Property(x => x.StateCheckers).HasMaxLength(PermissionDefinitionRecordConsts.MaxStateCheckersLength); - b.HasIndex(x => new { x.Name }).IsUnique(); + b.HasIndex(x => new { x.ResourceName, x.Name }).IsUnique(); b.HasIndex(x => new { x.GroupName }); b.ApplyObjectExtensionMappings(); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementEntityFrameworkCoreModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementEntityFrameworkCoreModule.cs index ebcc8527c1..da6dfe8b06 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementEntityFrameworkCoreModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementEntityFrameworkCoreModule.cs @@ -17,6 +17,7 @@ public class AbpPermissionManagementEntityFrameworkCoreModule : AbpModule options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCoreResourcePermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCoreResourcePermissionGrantRepository.cs new file mode 100644 index 0000000000..385a45f989 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCoreResourcePermissionGrantRepository.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; + +public class EfCoreResourcePermissionGrantRepository : EfCoreRepository, IResourcePermissionGrantRepository +{ + public EfCoreResourcePermissionGrantRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + + } + + public virtual async Task FindAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .OrderBy(x => x.Id) + .FirstOrDefaultAsync(s => + s.Name == name && + s.ResourceName == resourceName && + s.ResourceKey == resourceKey && + s.ProviderName == providerName && + s.ProviderKey == providerKey, + GetCancellationToken(cancellationToken) + ); + } + + public virtual async Task> GetListAsync(string resourceName, string resourceKey, string providerName, string providerKey, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(s => + s.ResourceName == resourceName && + s.ResourceKey == resourceKey && + s.ProviderName == providerName && + s.ProviderKey == providerKey + ).ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetListAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(s => + names.Contains(s.Name) && + s.ResourceName == resourceName && + s.ResourceKey == resourceKey && + s.ProviderName == providerName && + s.ProviderKey == providerKey + ).ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetListAsync(string providerName, string providerKey, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(s => + s.ProviderName == providerName && + s.ProviderKey == providerKey + ).ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetPermissionsAsync(string resourceName, string resourceKey, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(s => + s.ResourceName == resourceName && + s.ResourceKey == resourceKey + ).ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetResourceKeys(string resourceName, string name, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(s => + s.ResourceName == resourceName && + s.Name == name + ).ToListAsync(GetCancellationToken(cancellationToken)); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs index c294c1b248..de02ab70ec 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs @@ -8,8 +8,10 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; public interface IPermissionManagementDbContext : IEfCoreDbContext { DbSet PermissionGroups { get; } - + DbSet Permissions { get; } - + DbSet PermissionGrants { get; } + + DbSet ResourcePermissionGrants { get; } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs index fe143fa8ae..59c724bfb7 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs @@ -10,6 +10,7 @@ public class PermissionManagementDbContext : AbpDbContext PermissionGroups { get; set; } public DbSet Permissions { get; set; } public DbSet PermissionGrants { get; set; } + public DbSet ResourcePermissionGrants { get; set; } public PermissionManagementDbContext(DbContextOptions options) : base(options) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/Volo/Abp/PermissionManagement/PermissionsClientProxy.Generated.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/Volo/Abp/PermissionManagement/PermissionsClientProxy.Generated.cs index 2fe22472f0..bd6e2c5e8e 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/Volo/Abp/PermissionManagement/PermissionsClientProxy.Generated.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/Volo/Abp/PermissionManagement/PermissionsClientProxy.Generated.cs @@ -45,4 +45,72 @@ public partial class PermissionsClientProxy : ClientProxyBase GetResourceProviderKeyLookupServicesAsync(string resourceName) + { + return await RequestAsync(nameof(GetResourceProviderKeyLookupServicesAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName } + }); + } + + public virtual async Task SearchResourceProviderKeyAsync(string resourceName, string serviceName, string filter, int page) + { + return await RequestAsync(nameof(SearchResourceProviderKeyAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName }, + { typeof(string), serviceName }, + { typeof(string), filter }, + { typeof(int), page } + }); + } + + public virtual async Task GetResourceDefinitionsAsync(string resourceName) + { + return await RequestAsync(nameof(GetResourceDefinitionsAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName } + }); + } + + public virtual async Task GetResourceAsync(string resourceName, string resourceKey) + { + return await RequestAsync(nameof(GetResourceAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName }, + { typeof(string), resourceKey } + }); + } + + public virtual async Task GetResourceByProviderAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + return await RequestAsync(nameof(GetResourceByProviderAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName }, + { typeof(string), resourceKey }, + { typeof(string), providerName }, + { typeof(string), providerKey } + }); + } + + public virtual async Task UpdateResourceAsync(string resourceName, string resourceKey, UpdateResourcePermissionsDto input) + { + await RequestAsync(nameof(UpdateResourceAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName }, + { typeof(string), resourceKey }, + { typeof(UpdateResourcePermissionsDto), input } + }); + } + + public virtual async Task DeleteResourceAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + await RequestAsync(nameof(DeleteResourceAsync), new ClientProxyRequestTypeValue + { + { typeof(string), resourceName }, + { typeof(string), resourceKey }, + { typeof(string), providerName }, + { typeof(string), providerKey } + }); + } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/permissionManagement-generate-proxy.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/permissionManagement-generate-proxy.json index 208271e67d..8b95d9be21 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/permissionManagement-generate-proxy.json +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/ClientProxies/permissionManagement-generate-proxy.json @@ -21,7 +21,7 @@ "parametersOnMethod": [ { "name": "input", - "typeAsString": "System.Collections.Generic.List`1[[Volo.Abp.PermissionManagement.IsGrantedRequest, Volo.Abp.PermissionManagement.Domain.Shared, Version=9.3.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib", + "typeAsString": "System.Collections.Generic.List`1[[Volo.Abp.PermissionManagement.IsGrantedRequest, Volo.Abp.PermissionManagement.Domain.Shared, Version=10.1.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib", "type": "System.Collections.Generic.List", "typeSimple": "[Volo.Abp.PermissionManagement.IsGrantedRequest]", "isOptional": false, @@ -46,7 +46,7 @@ "parametersOnMethod": [ { "name": "input", - "typeAsString": "System.Collections.Generic.List`1[[Volo.Abp.PermissionManagement.IsGrantedRequest, Volo.Abp.PermissionManagement.Domain.Shared, Version=9.3.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib", + "typeAsString": "System.Collections.Generic.List`1[[Volo.Abp.PermissionManagement.IsGrantedRequest, Volo.Abp.PermissionManagement.Domain.Shared, Version=10.1.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib", "type": "System.Collections.Generic.List", "typeSimple": "[Volo.Abp.PermissionManagement.IsGrantedRequest]", "isOptional": false, @@ -178,6 +178,221 @@ "type": "System.Void", "typeSimple": "System.Void" } + }, + { + "name": "GetResourceProviderKeyLookupServicesAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto" + } + }, + { + "name": "SearchResourceProviderKeyAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "serviceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "filter", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "page", + "typeAsString": "System.Int32, System.Private.CoreLib", + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto" + } + }, + { + "name": "GetResourceDefinitionsAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto" + } + }, + { + "name": "GetResourceAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto" + } + }, + { + "name": "GetResourceByProviderAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto" + } + }, + { + "name": "UpdateResourceAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", + "type": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "DeleteResourceAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } } ] } @@ -393,6 +608,505 @@ }, "allowAnonymous": null, "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceProviderKeyLookupServicesAsyncByResourceName": { + "uniqueName": "GetResourceProviderKeyLookupServicesAsyncByResourceName", + "name": "GetResourceProviderKeyLookupServicesAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource-provider-key-lookup-services", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "SearchResourceProviderKeyAsyncByResourceNameAndServiceNameAndFilterAndPage": { + "uniqueName": "SearchResourceProviderKeyAsyncByResourceNameAndServiceNameAndFilterAndPage", + "name": "SearchResourceProviderKeyAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/search-resource-provider-keys", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "serviceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "filter", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "page", + "typeAsString": "System.Int32, System.Private.CoreLib", + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "serviceName", + "name": "serviceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "filter", + "name": "filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "page", + "name": "page", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceDefinitionsAsyncByResourceName": { + "uniqueName": "GetResourceDefinitionsAsyncByResourceName", + "name": "GetResourceDefinitionsAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource-definitions", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceAsyncByResourceNameAndResourceKey": { + "uniqueName": "GetResourceAsyncByResourceNameAndResourceKey", + "name": "GetResourceAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceByProviderAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey": { + "uniqueName": "GetResourceByProviderAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey", + "name": "GetResourceByProviderAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource/by-provider", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "UpdateResourceAsyncByResourceNameAndResourceKeyAndInput": { + "uniqueName": "UpdateResourceAsyncByResourceNameAndResourceKeyAndInput", + "name": "UpdateResourceAsync", + "httpMethod": "PUT", + "url": "api/permission-management/permissions/resource", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", + "type": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "DeleteResourceAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey": { + "uniqueName": "DeleteResourceAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey", + "name": "DeleteResourceAsync", + "httpMethod": "DELETE", + "url": "api/permission-management/permissions/resource", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs index ff6d7e6128..c1f65e353e 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs @@ -34,4 +34,50 @@ public class PermissionsController : AbpControllerBase, IPermissionAppService { return PermissionAppService.UpdateAsync(providerName, providerKey, input); } + + [HttpGet("resource-provider-key-lookup-services")] + public virtual Task GetResourceProviderKeyLookupServicesAsync(string resourceName) + { + return PermissionAppService.GetResourceProviderKeyLookupServicesAsync(resourceName); + } + + [HttpGet("search-resource-provider-keys")] + public virtual Task SearchResourceProviderKeyAsync(string resourceName, string serviceName, string filter, int page) + { + return PermissionAppService.SearchResourceProviderKeyAsync(resourceName, serviceName, filter, page); + } + + [HttpGet("resource-definitions")] + public virtual Task GetResourceDefinitionsAsync(string resourceName) + { + return PermissionAppService.GetResourceDefinitionsAsync(resourceName); + } + + [HttpGet] + [Route("resource")] + public virtual Task GetResourceAsync(string resourceName, string resourceKey) + { + return PermissionAppService.GetResourceAsync(resourceName, resourceKey); + } + + [HttpGet] + [Route("resource/by-provider")] + public virtual Task GetResourceByProviderAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + return PermissionAppService.GetResourceByProviderAsync(resourceName, resourceKey, providerName, providerKey); + } + + [HttpPut] + [Route("resource")] + public virtual Task UpdateResourceAsync(string resourceName, string resourceKey, UpdateResourcePermissionsDto input) + { + return PermissionAppService.UpdateResourceAsync(resourceName, resourceKey, input); + } + + [HttpDelete] + [Route("resource")] + public virtual Task DeleteResourceAsync(string resourceName, string resourceKey, string providerName, string providerKey) + { + return PermissionAppService.DeleteResourceAsync(resourceName, resourceKey, providerName, providerKey); + } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs index 9c7c90af58..4eb8eea3b6 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs @@ -13,15 +13,20 @@ public static class AbpPermissionManagementMongoDbContextExtensions { b.CollectionName = AbpPermissionManagementDbProperties.DbTablePrefix + "PermissionGroups"; }); - + builder.Entity(b => { b.CollectionName = AbpPermissionManagementDbProperties.DbTablePrefix + "Permissions"; }); - + builder.Entity(b => { b.CollectionName = AbpPermissionManagementDbProperties.DbTablePrefix + "PermissionGrants"; }); + + builder.Entity(b => + { + b.CollectionName = AbpPermissionManagementDbProperties.DbTablePrefix + "ResourcePermissionGrants"; + }); } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbModule.cs index 80831660f8..686d219295 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbModule.cs @@ -19,6 +19,7 @@ public class AbpPermissionManagementMongoDbModule : AbpModule options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs index 98015484fb..454875f517 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs @@ -8,8 +8,10 @@ namespace Volo.Abp.PermissionManagement.MongoDB; public interface IPermissionManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection PermissionGroups { get; } - + IMongoCollection Permissions { get; } - + IMongoCollection PermissionGrants { get; } + + IMongoCollection ResourcePermissionGrants { get; } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoResourcePermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoResourcePermissionGrantRepository.cs new file mode 100644 index 0000000000..30db095854 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoResourcePermissionGrantRepository.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using MongoDB.Driver.Linq; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.PermissionManagement.MongoDB; + +public class MongoResourcePermissionGrantRepository : MongoDbRepository, IResourcePermissionGrantRepository +{ + public MongoResourcePermissionGrantRepository(IMongoDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + + } + + public virtual async Task FindAsync(string name, string resourceName, string resourceKey, string providerName, string providerKey, CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetQueryableAsync(cancellationToken)) + .OrderBy(x => x.Id) + .FirstOrDefaultAsync(s => + s.Name == name && + s.ResourceName == resourceName && + s.ResourceKey == resourceKey && + s.ProviderName == providerName && + s.ProviderKey == providerKey, + cancellationToken + ); + } + + public virtual async Task> GetListAsync(string resourceName, string resourceKey, string providerName, string providerKey, CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetQueryableAsync(cancellationToken)) + .Where(s => + s.ResourceName == resourceName && + s.ResourceKey == resourceKey && + s.ProviderName == providerName && + s.ProviderKey == providerKey + ).ToListAsync(cancellationToken); + } + + public virtual async Task> GetListAsync(string[] names, string resourceName, string resourceKey, string providerName, string providerKey, CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetQueryableAsync(cancellationToken)) + .Where(s => + names.AsEnumerable().Contains(s.Name) && + s.ResourceName == resourceName && + s.ResourceKey == resourceKey && + s.ProviderName == providerName && + s.ProviderKey == providerKey + ).ToListAsync(cancellationToken); + } + + public virtual async Task> GetListAsync(string providerName, string providerKey, CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetQueryableAsync(cancellationToken)) + .Where(s => + s.ProviderName == providerName && + s.ProviderKey == providerKey + ).ToListAsync(cancellationToken); + } + + public virtual async Task> GetPermissionsAsync(string resourceName, string resourceKey, CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetQueryableAsync(cancellationToken)) + .Where(s => + s.ResourceName == resourceName && + s.ResourceKey == resourceKey + ).ToListAsync(cancellationToken); + } + + public virtual async Task> GetResourceKeys(string resourceName, string name, CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetQueryableAsync(cancellationToken)) + .Where(s => + s.ResourceName == resourceName && + s.Name == name + ).ToListAsync(cancellationToken); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs index c62db52c11..c9ea6ea984 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs @@ -10,6 +10,7 @@ public class PermissionManagementMongoDbContext : AbpMongoDbContext, IPermission public IMongoCollection PermissionGroups => Collection(); public IMongoCollection Permissions => Collection(); public IMongoCollection PermissionGrants => Collection(); + public IMongoCollection ResourcePermissionGrants => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs index baa27b44ff..e20e38c53a 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs @@ -20,7 +20,7 @@ public class AbpPermissionManagementWebModule : AbpModule { options.AddAssemblyResource( typeof(AbpPermissionManagementResource), - typeof(AbpPermissionManagementWebModule).Assembly, + typeof(AbpPermissionManagementWebModule).Assembly, typeof(AbpPermissionManagementApplicationContractsModule).Assembly ); }); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/AddResourcePermissionManagementModal.cshtml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/AddResourcePermissionManagementModal.cshtml new file mode 100644 index 0000000000..be12c7cd1d --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/AddResourcePermissionManagementModal.cshtml @@ -0,0 +1,54 @@ +@page +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.Abp.Localization +@using Volo.Abp.PermissionManagement.Localization +@using Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement +@model AddResourcePermissionManagementModal +@inject IHtmlLocalizer L + +@{ + Layout = null; +} + + + + +
+ + + + + + +
+
+ @foreach (var provider in Model.ResourceProviders.Providers.Select((value, i) => new { i, value })) + { +
+ + +
+ } +
+ + +
+
+

@L["ResourcePermissionPermissions"]

+
+ + +
+ @foreach (var permission in Model.ResourcePermissionDefinitions.Permissions) + { +
+ + +
+ } +
+
+ +
+
diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/AddResourcePermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/AddResourcePermissionManagementModal.cshtml.cs new file mode 100644 index 0000000000..d9828ee661 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/AddResourcePermissionManagementModal.cshtml.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement; + +public class AddResourcePermissionManagementModal : AbpPageModel +{ + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceName { get; set; } + + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceKey { get; set; } + + [BindProperty(SupportsGet = true)] + [HiddenInput] + public string ResourceDisplayName { get; set; } + + [BindProperty] + public ResourcePermissionViewModel AddModel { get; set; } + + public GetResourcePermissionDefinitionListResultDto ResourcePermissionDefinitions { get; set; } + public GetResourceProviderListResultDto ResourceProviders { get; set; } + + protected IPermissionAppService PermissionAppService { get; } + + public AddResourcePermissionManagementModal(IPermissionAppService permissionAppService) + { + ObjectMapperContext = typeof(AbpPermissionManagementWebModule); + + PermissionAppService = permissionAppService; + } + + public virtual async Task OnGetAsync() + { + ValidateModel(); + + ResourcePermissionDefinitions = await PermissionAppService.GetResourceDefinitionsAsync(ResourceName); + ResourceProviders = await PermissionAppService.GetResourceProviderKeyLookupServicesAsync(ResourceName); + + return Page(); + } + + public virtual async Task OnPostAsync() + { + ValidateModel(); + + await PermissionAppService.UpdateResourceAsync( + ResourceName, + ResourceKey, + new UpdateResourcePermissionsDto() + { + ProviderName = AddModel.ProviderName, + ProviderKey = AddModel.ProviderKey, + Permissions = AddModel.Permissions ?? new List() + } + ); + + return NoContent(); + } + + public class ResourcePermissionViewModel + { + [Required] + public string ProviderName { get; set; } + + [Required] + public string ProviderKey { get; set; } + + public List Permissions { get; set; } + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml index a9caf5c348..c1241af454 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml @@ -79,5 +79,3 @@ - - \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/ResourcePermissionManagementModal.cshtml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/ResourcePermissionManagementModal.cshtml new file mode 100644 index 0000000000..15a5c0bff4 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/ResourcePermissionManagementModal.cshtml @@ -0,0 +1,52 @@ +@page +@using System.Web; +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.Abp.Localization +@using Volo.Abp.PermissionManagement.Localization +@using Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement +@model ResourcePermissionManagementModal +@inject IHtmlLocalizer L + +@{ + Layout = null; +} + +@if(Model.HasAnyResourcePermission && Model.HasAnyResourceProviderKeyLookupService) +{ + + +
+ + + + + +
+ +
+ +
+ +
+
+} +else +{ + + + + + + + +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/ResourcePermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/ResourcePermissionManagementModal.cshtml.cs new file mode 100644 index 0000000000..1b1373e017 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/ResourcePermissionManagementModal.cshtml.cs @@ -0,0 +1,51 @@ +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement; + +public class ResourcePermissionManagementModal : AbpPageModel +{ + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceName { get; set; } + + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceKey { get; set; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceDisplayName { get; set; } + + public bool HasAnyResourcePermission { get; set; } + public bool HasAnyResourceProviderKeyLookupService { get; set; } + + protected IPermissionAppService PermissionAppService { get; } + + public ResourcePermissionManagementModal(IPermissionAppService permissionAppService) + { + ObjectMapperContext = typeof(AbpPermissionManagementWebModule); + + PermissionAppService = permissionAppService; + } + + public virtual async Task OnGetAsync() + { + HasAnyResourcePermission = (await PermissionAppService.GetResourceDefinitionsAsync(ResourceName)).Permissions.Any(); + if (HasAnyResourcePermission) + { + HasAnyResourceProviderKeyLookupService = (await PermissionAppService.GetResourceProviderKeyLookupServicesAsync(ResourceName)).Providers.Count > 0; + } + return Page(); + } + + public virtual Task OnPostAsync() + { + return Task.FromResult(NoContent()); + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/UpdateResourcePermissionManagementModal.cshtml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/UpdateResourcePermissionManagementModal.cshtml new file mode 100644 index 0000000000..3e90319e02 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/UpdateResourcePermissionManagementModal.cshtml @@ -0,0 +1,42 @@ +@page +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.Abp.Localization +@using Volo.Abp.PermissionManagement.Localization +@using Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement +@model UpdateResourcePermissionManagementModal +@inject IHtmlLocalizer L + +@{ + Layout = null; +} + + + + +
+ + + + + + + +
+

@L["ResourcePermissionPermissions"]

+
+ + +
+ @foreach (var permission in Model.ResourcePermissions.Permissions) + { +
+ + +
+ } +
+
+ +
+
diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/UpdateResourcePermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/UpdateResourcePermissionManagementModal.cshtml.cs new file mode 100644 index 0000000000..db2e661993 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/UpdateResourcePermissionManagementModal.cshtml.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement; + +public class UpdateResourcePermissionManagementModal : AbpPageModel +{ + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceName { get; set; } + + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ResourceKey { get; set; } + + [BindProperty(SupportsGet = true)] + public string ResourceDisplayName { get; set; } + + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ProviderName { get; set; } + + [Required] + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ProviderKey { get; set; } + + [BindProperty(SupportsGet = true)] + public ResourcePermissionViewModel UpdateModel { get; set; } + + public GetResourcePermissionWithProviderListResultDto ResourcePermissions { get; set; } + + protected IPermissionAppService PermissionAppService { get; } + + public UpdateResourcePermissionManagementModal(IPermissionAppService permissionAppService) + { + ObjectMapperContext = typeof(AbpPermissionManagementWebModule); + + PermissionAppService = permissionAppService; + } + + public virtual async Task OnGetAsync() + { + ValidateModel(); + + ResourcePermissions = await PermissionAppService.GetResourceByProviderAsync(ResourceName, ResourceKey, ProviderName, ProviderKey); + + return Page(); + } + + public virtual async Task OnPostAsync() + { + ValidateModel(); + + await PermissionAppService.UpdateResourceAsync( + ResourceName, + ResourceKey, + new UpdateResourcePermissionsDto() + { + ProviderName = ProviderName, + ProviderKey = ProviderKey, + Permissions = UpdateModel.Permissions ?? new List() + } + ); + + return NoContent(); + } + + public class ResourcePermissionViewModel + { + public List Permissions { get; set; } + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/add-resource-permission-management-modal.js b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/add-resource-permission-management-modal.js new file mode 100644 index 0000000000..2fa7f06550 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/add-resource-permission-management-modal.js @@ -0,0 +1,91 @@ +var abp = abp || {}; +(function ($) { + var $all = $("#grantAllresourcePermissions"); + var $items = $("#permissionList input[type='checkbox']").not("#grantAllresourcePermissions"); + $all.on("change", function () { + $items.prop("checked", this.checked); + }); + $items.on("change", function () { + $all.prop("checked", $items.length === $items.filter(":checked").length); + }); + + var $permissionManagementForm = $("#addResourcePermissionManagementForm"); + var $providerKey = $("#AddModel_ProviderKey"); + $providerKey.select2({ + ajax: { + url: '/api/permission-management/permissions/search-resource-provider-keys', + delay: 250, + dataType: "json", + data: function (params) { + var query = {}; + query["resourceName"] = $('#ResourceName').val(); + query["serviceName"] = $('input[name="AddModel.ProviderName"]:checked').val(); + query["page"] = params.page || 1; + query["filter"] = params.term; + return query; + }, + processResults: function (data) { + var keyValues = []; + data.keys.forEach(function (item, index) { + keyValues.push({ + id: item["providerKey"], + text: item["providerDisplayName"], + displayName: item["providerDisplayName"] + }) + }); + return { + results: keyValues, + pagination: { + more: keyValues.length == 10 + } + }; + } + }, + width: '100%', + dropdownParent: $('#addResourcePermissionManagementModal'), + language: abp.localization.currentCulture.cultureName + }); + + $('input[name="AddModel.ProviderName"]').change(function () { + $providerKey.val(null).trigger('change'); + }); + + $providerKey.change(function () { + if ($providerKey.val()) { + $permissionManagementForm.valid(); + } + var providerKey = $providerKey.val(); + if (!providerKey) { + $items.prop('checked', false); + $all.prop("checked", false); + return; + } + + abp.ui.setBusy('#permissionList'); + var resourceName = $("#ResourceName").val(); + var resourceKey = $("#ResourceKey").val(); + var providerName = $('input[name="AddModel.ProviderName"]:checked').val(); + volo.abp.permissionManagement.permissions.getResourceByProvider(resourceName, resourceKey, providerName, providerKey).then(function (result) { + abp.ui.clearBusy(); + var grantedPermissionNames = result.permissions.filter(function (p) { + return p.providers.indexOf(providerName) >= 0 && p.isGranted === true; + }).map(function (p) { + return p.name; + }); + $items.each(function () { + var $checkbox = $(this); + if (grantedPermissionNames.indexOf($checkbox.val()) >= 0) { + $checkbox.prop('checked', true); + } else { + $checkbox.prop('checked', false); + } + }); + $all.prop("checked", $items.length === $items.filter(":checked").length); + }); + }); + + $permissionManagementForm.submit(function () { + $(this).valid(); + }); + +})(jQuery); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/resource-permission-management-modal.js b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/resource-permission-management-modal.js new file mode 100644 index 0000000000..7a6c100c07 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/resource-permission-management-modal.js @@ -0,0 +1,131 @@ +var abp = abp || {}; +(function ($) { + var l = abp.localization.getResource('AbpPermissionManagement'); + var _dataTable = null; + abp.ui.extensions.entityActions.get('permissionManagement.resource').addContributor( + function (actionList) { + return actionList.addManyTail( + [ + { + text: l('Edit'), + action: function (data) { + var _updateResourcePermissionsModal = new abp.ModalManager(abp.appPath + "AbpPermissionManagement/UpdateResourcePermissionManagementModal"); + _updateResourcePermissionsModal.open({ + resourceName: $("#ResourceName").val(), + resourceKey: $("#ResourceKey").val(), + resourceDisplayName: $("#ResourceDisplayName").val(), + providerName: data.record.providerName, + providerKey: data.record.providerKey + }); + _updateResourcePermissionsModal.onResult(function () { + _dataTable.ajax.reloadEx(function (json) { + _dataTable.columns.adjust(); + }); + }); + }, + }, + { + text: l('Delete'), + confirmMessage: function (data) { + return l( + 'ResourcePermissionDeletionConfirmationMessage', + data.record.name + ); + }, + action: function (data) { + volo.abp.permissionManagement.permissions.deleteResource($("#ResourceName").val(), $("#ResourceKey").val(), data.record.providerName, data.record.providerKey).then(function () { + abp.notify.info(l('DeletedSuccessfully')); + _dataTable.ajax.reloadEx(function (json) { + _dataTable.columns.adjust(); + }); + }); + }, + } + ] + ); + } + ); + + abp.ui.extensions.tableColumns.get('permissionManagement.resource').addContributor( + function (columnList) { + columnList.addManyTail( + [ + { + title: l("Actions"), + rowAction: { + items: abp.ui.extensions.entityActions.get('permissionManagement.resource').actions.toArray() + } + }, + { + title: l("ResourcePermissionTarget"), + data: 'providerName', + render: function (data, type, row) { + return '' + row.providerName + '' + row.providerDisplayName; + }, + }, + { + title: l("ResourcePermissionPermissions"), + data: 'permissions', + render: function (data, type, row) { + var spans = ''; + for (var i = 0; i < row.permissions.length; i++) { + spans += '' + row.permissions[i].displayName + ''; + } + return spans; + }, + } + ] + ); + }, + 0 //adds as the first contributor + ); + + abp.modals = abp.modals || {}; + + abp.modals.ResourcePermissionManagement = function () { + var initModal = function (publicApi, args) { + _dataTable = $('#resourcePermissionTable').DataTable( + abp.libs.datatables.normalizeConfiguration({ + order: [], + searching: false, + processing: true, + scrollX: false, + serverSide: false, + paging: true, + ajax: function () { + return function (requestData, callback, settings) { + if (callback) { + volo.abp.permissionManagement.permissions.getResource(args.resourceName, args.resourceKey).then(function (result) { + callback({ + recordsTotal: result.permissions.length, + recordsFiltered: result.permissions.length, + data: result.permissions + }); + }); + } + } + }(), + columnDefs: abp.ui.extensions.tableColumns.get('permissionManagement.resource').columns.toArray(), + }) + ); + + $("#addPermission").click(function () { + var _addResourcePermissionsModal = new abp.ModalManager(abp.appPath + "AbpPermissionManagement/AddResourcePermissionManagementModal"); + _addResourcePermissionsModal.open({ + resourceName: $("#ResourceName").val(), + resourceKey: $("#ResourceKey").val(), + resourceDisplayName: $("#ResourceDisplayName").val() + }); + _addResourcePermissionsModal.onResult(function () { + _dataTable.ajax.reloadEx(function (json) { + _dataTable.columns.adjust(); + }); + }); + }); + }; + + return { + initModal: initModal, + }; + }; +})(jQuery); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/update-resource-permission-management-modal.js b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/update-resource-permission-management-modal.js new file mode 100644 index 0000000000..d1e1f02fa4 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/update-resource-permission-management-modal.js @@ -0,0 +1,11 @@ +var abp = abp || {}; +(function ($) { + var $all = $("#grantAllresourcePermissions"); + var $items = $("#permissionList input[type='checkbox']").not("#grantAllresourcePermissions"); + $all.on("change", function () { + $items.prop("checked", this.checked); + }); + $items.on("change", function () { + $all.prop("checked", $items.length === $items.filter(":checked").length); + }); +})(jQuery); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/wwwroot/client-proxies/permissionManagement-proxy.js b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/wwwroot/client-proxies/permissionManagement-proxy.js index a296877917..893c86ab97 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/wwwroot/client-proxies/permissionManagement-proxy.js +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/wwwroot/client-proxies/permissionManagement-proxy.js @@ -34,6 +34,58 @@ }, ajaxParams)); }; + volo.abp.permissionManagement.permissions.getResourceProviderKeyLookupServices = function(resourceName, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/resource-provider-key-lookup-services' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }]) + '', + type: 'GET' + }, ajaxParams)); + }; + + volo.abp.permissionManagement.permissions.searchResourceProviderKey = function(resourceName, serviceName, filter, page, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/search-resource-provider-keys' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }, { name: 'serviceName', value: serviceName }, { name: 'filter', value: filter }, { name: 'page', value: page }]) + '', + type: 'GET' + }, ajaxParams)); + }; + + volo.abp.permissionManagement.permissions.getResourceDefinitions = function(resourceName, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/resource-definitions' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }]) + '', + type: 'GET' + }, ajaxParams)); + }; + + volo.abp.permissionManagement.permissions.getResource = function(resourceName, resourceKey, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/resource' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }, { name: 'resourceKey', value: resourceKey }]) + '', + type: 'GET' + }, ajaxParams)); + }; + + volo.abp.permissionManagement.permissions.getResourceByProvider = function(resourceName, resourceKey, providerName, providerKey, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/resource/by-provider' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }, { name: 'resourceKey', value: resourceKey }, { name: 'providerName', value: providerName }, { name: 'providerKey', value: providerKey }]) + '', + type: 'GET' + }, ajaxParams)); + }; + + volo.abp.permissionManagement.permissions.updateResource = function(resourceName, resourceKey, input, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/resource' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }, { name: 'resourceKey', value: resourceKey }]) + '', + type: 'PUT', + dataType: null, + data: JSON.stringify(input) + }, ajaxParams)); + }; + + volo.abp.permissionManagement.permissions.deleteResource = function(resourceName, resourceKey, providerName, providerKey, ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/permission-management/permissions/resource' + abp.utils.buildQueryString([{ name: 'resourceName', value: resourceName }, { name: 'resourceKey', value: resourceKey }, { name: 'providerName', value: providerName }, { name: 'providerKey', value: providerKey }]) + '', + type: 'DELETE', + dataType: null + }, ajaxParams)); + }; + })(); })(); diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs index a5e8461a28..e43cc0fa71 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs @@ -22,6 +22,7 @@ public class AbpPermissionManagementApplicationTestModule : AbpModule options.ProviderPolicies[UserPermissionValueProvider.ProviderName] = UserPermissionValueProvider.ProviderName; options.ProviderPolicies["Test"] = "Test"; options.ManagementProviders.Add(); + options.ResourceManagementProviders.Add(); }); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs index 11e9e8ca04..61f984a27b 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs @@ -32,34 +32,39 @@ public class PermissionAppService_Tests : AbpPermissionManagementApplicationTest permissionListResultDto.ShouldNotBeNull(); permissionListResultDto.EntityDisplayName.ShouldBe(PermissionTestDataBuilder.User1Id.ToString()); - permissionListResultDto.Groups.Count.ShouldBe(2); + + permissionListResultDto.Groups.Count.ShouldBe(3); permissionListResultDto.Groups.ShouldContain(x => x.Name == "TestGroup"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission2"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission2.ChildPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission3"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission4"); + var testGroup = permissionListResultDto.Groups.FirstOrDefault(g => g.Name == "TestGroup"); + testGroup.ShouldNotBeNull(); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission1"); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission2"); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission2.ChildPermission1"); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission3"); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission4"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyPermission5"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyPermission5.ChildPermission1"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyPermission5"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyPermission5.ChildPermission1"); using (_currentPrincipalAccessor.Change(new Claim(AbpClaimTypes.Role, "super-admin"))) { var result = await _permissionAppService.GetAsync(UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()); - result.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission5"); - result.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission5.ChildPermission1"); + var testGroupWithRole = result.Groups.FirstOrDefault(g => g.Name == "TestGroup"); + testGroupWithRole.ShouldNotBeNull(); + testGroupWithRole.Permissions.ShouldContain(x => x.Name == "MyPermission5"); + testGroupWithRole.Permissions.ShouldContain(x => x.Name == "MyPermission5.ChildPermission1"); } - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission6"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyPermission6.ChildDisabledPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission6.ChildPermission2"); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission6"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyPermission6.ChildDisabledPermission1"); + testGroup.Permissions.ShouldContain(x => x.Name == "MyPermission6.ChildPermission2"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2.ChildPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2.ChildPermission2"); - permissionListResultDto.Groups.First().Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2.ChildPermission2.ChildPermission1"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission1"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2.ChildPermission1"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2.ChildPermission2"); + testGroup.Permissions.ShouldNotContain(x => x.Name == "MyDisabledPermission2.ChildPermission2.ChildPermission1"); } [Fact] diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/CalculateHash_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/CalculateHash_Tests.cs index 2e862c8f85..cfec0d27a2 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/CalculateHash_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/CalculateHash_Tests.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization.Metadata; using Shouldly; +using Volo.Abp.Authorization.Permissions; using Volo.Abp.Json.SystemTextJson.Modifiers; using Xunit; @@ -34,7 +35,7 @@ public class CalculateHash_Tests: PermissionTestBase json.ShouldNotContain(id.ToString("D")); json = JsonSerializer.Serialize(new List() { - new PermissionDefinitionRecord(id, "Test", "Test", "Test", "Test") + new PermissionDefinitionRecord(id, "Test", "Test", "Test", "Test", "Test", "Test") }, jsonSerializerOptions); json.ShouldNotContain("\"Id\""); diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionRecordRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionRecordRepository_Tests.cs index d7ca406624..62369869c4 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionRecordRepository_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionRecordRepository_Tests.cs @@ -26,4 +26,19 @@ public abstract class PermissionDefinitionRecordRepository_Tests permission.ShouldNotBeNull(); permission.Name.ShouldBe("MyPermission2"); } + + [Fact] + public async Task FindByResourceNameAsync() + { + var qq = await PermissionDefinitionRecordRepository.GetListAsync(); + var permission = await PermissionDefinitionRecordRepository.FindByNameAsync("MyResourcePermission1"); + permission.ShouldNotBeNull(); + permission.ResourceName.ShouldBe(TestEntityResource.ResourceName); + permission.Name.ShouldBe("MyResourcePermission1"); + + permission = await PermissionDefinitionRecordRepository.FindByNameAsync("MyResourcePermission2"); + permission.ShouldNotBeNull(); + permission.ResourceName.ShouldBe(TestEntityResource.ResourceName); + permission.Name.ShouldBe("MyResourcePermission2"); + } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer_Tests.cs index 1e7c04580c..4dca621a63 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionSerializer_Tests.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.PermissionManagement; public class PermissionDefinitionSerializer_Tests : PermissionTestBase { private readonly IPermissionDefinitionSerializer _serializer; - + public PermissionDefinitionSerializer_Tests() { _serializer = GetRequiredService(); @@ -26,26 +26,26 @@ public class PermissionDefinitionSerializer_Tests : PermissionTestBase public async Task Serialize_Permission_Group_Definition() { // Arrange - + var context = new PermissionDefinitionContext(null); var group1 = CreatePermissionGroup1(context); - + // Act var permissionGroupRecord = await _serializer.SerializeAsync(group1); - + //Assert permissionGroupRecord.Name.ShouldBe("Group1"); permissionGroupRecord.DisplayName.ShouldBe("F:Group one"); permissionGroupRecord.GetProperty("CustomProperty1").ShouldBe("CustomValue1"); } - + [Fact] public async Task Serialize_Complex_Permission_Definition() { // Arrange - + var context = new PermissionDefinitionContext(null); var group1 = CreatePermissionGroup1(context); var permission1 = group1.AddPermission( @@ -61,14 +61,14 @@ public class PermissionDefinitionSerializer_Tests : PermissionTestBase .RequirePermissions(requiresAll: false, batchCheck: false,"Permission2", "Permission3"); // Act - + var permissionRecord = await _serializer.SerializeAsync( permission1, group1 ); - + //Assert - + permissionRecord.Name.ShouldBe("Permission1"); permissionRecord.GroupName.ShouldBe("Group1"); permissionRecord.DisplayName.ShouldBe("L:AbpPermissionManagement,Permission1"); @@ -78,6 +78,48 @@ public class PermissionDefinitionSerializer_Tests : PermissionTestBase permissionRecord.StateCheckers.ShouldBe("[{\"T\":\"A\"},{\"T\":\"G\",\"A\":true,\"N\":[\"GlobalFeature1\",\"GlobalFeature2\"]},{\"T\":\"F\",\"A\":true,\"N\":[\"Feature1\",\"Feature2\"]},{\"T\":\"P\",\"A\":false,\"N\":[\"Permission2\",\"Permission3\"]}]"); } + + [Fact] + public async Task Serialize_Complex_Resource_Permission_Definition() + { + // Arrange + + var context = new PermissionDefinitionContext(null); + var resourcePermission1 = context.AddResourcePermission( + "ResourcePermission1", + TestEntityResource.ResourceName, + "Permission1", + new LocalizableString(typeof(AbpPermissionManagementResource), "ResourcePermission1"), + MultiTenancySides.Tenant + ) + .WithProviders("ProviderA", "ProviderB") + .WithProperty("CustomProperty2", "CustomValue2") + .RequireAuthenticated() //For for testing, not so meaningful + .RequireGlobalFeatures("GlobalFeature1", "GlobalFeature2") + .RequireFeatures("Feature1", "Feature2") + .RequirePermissions(requiresAll: false, batchCheck: false,"Permission2", "Permission3"); + + // Act + + var permissionRecord = await _serializer.SerializeAsync( + resourcePermission1, + null + ); + + //Assert + + permissionRecord.Name.ShouldBe("ResourcePermission1"); + permissionRecord.GroupName.ShouldBe(null); + permissionRecord.ResourceName.ShouldBe(TestEntityResource.ResourceName); + permissionRecord.ManagementPermissionName.ShouldBe("Permission1"); + permissionRecord.DisplayName.ShouldBe("L:AbpPermissionManagement,ResourcePermission1"); + permissionRecord.GetProperty("CustomProperty2").ShouldBe("CustomValue2"); + permissionRecord.Providers.ShouldBe("ProviderA,ProviderB"); + permissionRecord.MultiTenancySide.ShouldBe(MultiTenancySides.Tenant); + permissionRecord.StateCheckers.ShouldBe("[{\"T\":\"A\"},{\"T\":\"G\",\"A\":true,\"N\":[\"GlobalFeature1\",\"GlobalFeature2\"]},{\"T\":\"F\",\"A\":true,\"N\":[\"Feature1\",\"Feature2\"]},{\"T\":\"P\",\"A\":false,\"N\":[\"Permission2\",\"Permission3\"]}]"); + } + + private static PermissionGroupDefinition CreatePermissionGroup1( IPermissionDefinitionContext context) { @@ -85,9 +127,9 @@ public class PermissionDefinitionSerializer_Tests : PermissionTestBase "Group1", displayName: new FixedLocalizableString("Group one") ); - + group["CustomProperty1"] = "CustomValue1"; - + return group; } -} \ No newline at end of file +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionChecker_Basic_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionChecker_Basic_Tests.cs new file mode 100644 index 0000000000..81ba38f7f9 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionChecker_Basic_Tests.cs @@ -0,0 +1,28 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions.Resources; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionChecker_Basic_Tests : PermissionTestBase +{ + private readonly IResourcePermissionChecker _resourcePermissionChecker; + + public ResourcePermissionChecker_Basic_Tests() + { + _resourcePermissionChecker = GetRequiredService(); + } + + [Fact] + public async Task Should_Return_Prohibited_If_Permission_Is_Not_Defined() + { + (await _resourcePermissionChecker.IsGrantedAsync(TestEntityResource.ResourceName, TestEntityResource.ResourceKey1,"UndefinedResourcePermissionName")).ShouldBeFalse(); + } + + [Fact] + public async Task Should_Return_False_As_Default_For_Any_Permission() + { + (await _resourcePermissionChecker.IsGrantedAsync(TestEntityResource.ResourceName, TestEntityResource.ResourceKey1,"MyPermission1")).ShouldBeFalse(); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionChecker_User_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionChecker_User_Tests.cs new file mode 100644 index 0000000000..261b5136d2 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionChecker_User_Tests.cs @@ -0,0 +1,121 @@ +using System; +using System.Security.Claims; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Security.Claims; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionChecker_User_Tests : PermissionTestBase +{ + private readonly IResourcePermissionChecker _resourcePermissionChecker; + private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor; + + public ResourcePermissionChecker_User_Tests() + { + _resourcePermissionChecker = GetRequiredService(); + _currentPrincipalAccessor = GetRequiredService(); + } + + [Fact] + public async Task Should_Return_True_For_Granted_Current_User() + { + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(PermissionTestDataBuilder.User1Id), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1 + )).ShouldBeTrue(); + } + + [Fact] + public async Task Should_Return_False_For_Non_Granted_Current_User() + { + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(PermissionTestDataBuilder.User2Id), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1 + )).ShouldBeFalse(); + } + + + [Fact] + public async Task Should_Return_False_For_Granted_Current_User_If_The_Permission_Is_Disabled() + { + //Disabled permissions always returns false! + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(PermissionTestDataBuilder.User1Id), + "MyDisabledPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1 + )).ShouldBeFalse(); + } + + [Fact] + public async Task Should_Return_False_For_Current_User_If_Anonymous() + { + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(null), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1 + )).ShouldBeFalse(); + } + + [Fact] + public async Task Should_Not_Allow_Host_Permission_To_Tenant_User_Even_Granted_Before() + { + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(PermissionTestDataBuilder.User1Id, Guid.NewGuid()), + "MyResourcePermission3", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3 + )).ShouldBeFalse(); + } + + [Fact] + public async Task Should_Return_False_For_Granted_Current_User_If_The_Permission_State_Is_Disabled() + { + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(PermissionTestDataBuilder.User1Id, Guid.NewGuid()), + "MyResourcePermission5", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey5 + )).ShouldBeFalse(); + } + + [Fact] + public async Task Should_Return_True_For_Granted_Current_User_If_The_Permission_State_Is_Enabled() + { + using (_currentPrincipalAccessor.Change(new Claim(AbpClaimTypes.Role, "super-admin"))) + { + (await _resourcePermissionChecker.IsGrantedAsync( + CreatePrincipal(PermissionTestDataBuilder.User1Id, Guid.NewGuid()), + "MyResourcePermission5", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey5 + )).ShouldBeTrue(); + } + } + + private static ClaimsPrincipal CreatePrincipal(Guid? userId, Guid? tenantId = null) + { + var claimsIdentity = new ClaimsIdentity(); + + if (userId != null) + { + claimsIdentity.AddClaim(new Claim(AbpClaimTypes.UserId, userId.ToString())); + } + + if (tenantId != null) + { + claimsIdentity.AddClaim(new Claim(AbpClaimTypes.TenantId, tenantId.ToString())); + } + + return new ClaimsPrincipal(claimsIdentity); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItemInvalidator_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItemInvalidator_Tests.cs new file mode 100644 index 0000000000..3bdc4ee69e --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItemInvalidator_Tests.cs @@ -0,0 +1,69 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Volo.Abp.Caching; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionGrantCacheItemInvalidator_Tests : PermissionTestBase +{ + private readonly IDistributedCache _cache; + private readonly IResourcePermissionStore _resourcePermissionStore; + private readonly IResourcePermissionGrantRepository _resourcePermissionGrantRepository; + + public ResourcePermissionGrantCacheItemInvalidator_Tests() + { + _cache = GetRequiredService>(); + _resourcePermissionStore = GetRequiredService(); + _resourcePermissionGrantRepository = GetRequiredService(); + } + + [Fact] + public async Task PermissionStore_IsGrantedAsync_Should_Cache_PermissionGrant() + { + (await _cache.GetAsync(ResourcePermissionGrantCacheItem.CalculateCacheKey("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()))).ShouldBeNull(); + + await _resourcePermissionStore.IsGrantedAsync("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + + (await _cache.GetAsync(ResourcePermissionGrantCacheItem.CalculateCacheKey("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()))).ShouldNotBeNull(); + } + + [Fact] + public async Task Cache_Should_Invalidator_WhenPermissionGrantChanged() + { + // IsGrantedAsync will cache ResourcePermissionGrant + await _resourcePermissionStore.IsGrantedAsync("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + + var resourcePermissionGrant = await _resourcePermissionGrantRepository.FindAsync("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + resourcePermissionGrant.ShouldNotBeNull(); + await _resourcePermissionGrantRepository.DeleteAsync(resourcePermissionGrant); + + (await _cache.GetAsync(ResourcePermissionGrantCacheItem.CalculateCacheKey("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()))).ShouldBeNull(); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItem_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItem_Tests.cs new file mode 100644 index 0000000000..1d7b4ea12d --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionGrantCacheItem_Tests.cs @@ -0,0 +1,15 @@ +using Shouldly; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionGrantCacheItem_Tests +{ + [Fact] + public void GetPermissionNameFormCacheKeyOrNull() + { + var key = ResourcePermissionGrantCacheItem.CalculateCacheKey("aaa", TestEntityResource.ResourceName, TestEntityResource.ResourceKey1,"bbb", "ccc"); + ResourcePermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull(key).ShouldBe("aaa"); + ResourcePermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull("aaabbbccc").ShouldBeNull(); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionManagementProvider_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionManagementProvider_Tests.cs new file mode 100644 index 0000000000..9651c3f313 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionManagementProvider_Tests.cs @@ -0,0 +1,90 @@ +using System; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionManagementProvider_Tests : PermissionTestBase +{ + private readonly IResourcePermissionManagementProvider _resourcePermissionManagementProvider; + private readonly IResourcePermissionGrantRepository _resourcePermissionGrantRepository; + + public ResourcePermissionManagementProvider_Tests() + { + _resourcePermissionManagementProvider = GetRequiredService(); + _resourcePermissionGrantRepository = GetRequiredService(); + } + + [Fact] + public async Task CheckAsync() + { + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + Guid.NewGuid(), + "MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test" + ) + ); + + var permissionValueProviderGrantInfo = await _resourcePermissionManagementProvider.CheckAsync( + "MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + + permissionValueProviderGrantInfo.IsGranted.ShouldBeTrue(); + permissionValueProviderGrantInfo.ProviderKey.ShouldBe("Test"); + } + + [Fact] + public async Task Check_Should_Return_NonGranted_When_ProviderName_NotEquals_Name() + { + var permissionValueProviderGrantInfo = await _resourcePermissionManagementProvider.CheckAsync( + "MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "TestNotExist", + "Test"); + + permissionValueProviderGrantInfo.IsGranted.ShouldBeFalse(); + permissionValueProviderGrantInfo.ProviderKey.ShouldBeNull(); + } + + [Fact] + public async Task SetAsync() + { + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + Guid.NewGuid(), + "MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test" + ) + ); + (await _resourcePermissionGrantRepository.FindAsync("MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test")).ShouldNotBeNull(); + + await _resourcePermissionManagementProvider.SetAsync("MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + false); + + (await _resourcePermissionGrantRepository.FindAsync("MyPermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test")).ShouldBeNull(); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionManager_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionManager_Tests.cs new file mode 100644 index 0000000000..73d37a5ff3 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionManager_Tests.cs @@ -0,0 +1,337 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionManager_Tests : PermissionTestBase +{ + private readonly IResourcePermissionManager _resourcePermissionManager; + private readonly IResourcePermissionGrantRepository _resourcePermissionGrantRepository; + + public ResourcePermissionManager_Tests() + { + _resourcePermissionManager = GetRequiredService(); + _resourcePermissionGrantRepository = GetRequiredService(); + } + + [Fact] + public async Task GetProviderKeyLookupServicesAsync() + { + var permissionProviderKeyLookupServices = await _resourcePermissionManager.GetProviderKeyLookupServicesAsync(); + + permissionProviderKeyLookupServices.ShouldNotBeNull(); + permissionProviderKeyLookupServices.First().Name.ShouldBe("Test"); + } + + [Fact] + public async Task GetProviderKeyLookupServiceAsync() + { + var testProviderKeyLookupService = await _resourcePermissionManager.GetProviderKeyLookupServiceAsync("Test"); + testProviderKeyLookupService.ShouldNotBeNull(); + testProviderKeyLookupService.Name.ShouldBe("Test"); + + var exception = await Assert.ThrowsAsync(async () => + { + await _resourcePermissionManager.GetProviderKeyLookupServiceAsync("UndefinedProvider"); + }); + exception.Message.ShouldBe("Unknown resource permission provider key lookup service: UndefinedProvider"); + } + + [Fact] + public async Task GetAvailablePermissionsAsync() + { + var availablePermissions = await _resourcePermissionManager.GetAvailablePermissionsAsync(TestEntityResource.ResourceName); + + availablePermissions.ShouldNotBeNull(); + availablePermissions.ShouldContain(p => p.Name == "MyResourcePermission1"); + availablePermissions.ShouldContain(p => p.Name == "MyResourcePermission2"); + availablePermissions.ShouldContain(p => p.Name == "MyResourcePermission3"); + availablePermissions.ShouldContain(p => p.Name == "MyResourcePermission4"); + availablePermissions.ShouldContain(p => p.Name == "MyResourcePermission6"); + availablePermissions.ShouldContain(p => p.Name == "MyResourcePermission7"); + + availablePermissions.ShouldNotContain(p => p.Name == "MyResourcePermission5"); + availablePermissions.ShouldNotContain(p => p.Name == "MyResourceDisabledPermission1"); + availablePermissions.ShouldNotContain(p => p.Name == "MyResourceDisabledPermission2"); + } + + [Fact] + public async Task GetAsync() + { + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + + var grantedProviders = await _resourcePermissionManager.GetAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + + grantedProviders.ShouldNotBeNull(); + grantedProviders.IsGranted.ShouldBeTrue(); + grantedProviders.Name.ShouldBe("MyResourcePermission1"); + grantedProviders.Providers.ShouldContain(x => x.Key == "Test"); + } + + [Fact] + public async Task Multiple_GetAsync() + { + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission2", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + + var grantedProviders = await _resourcePermissionManager.GetAsync( + new[] { "MyResourcePermission1", "MyResourcePermission2" }, + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + + grantedProviders.Result.Count.ShouldBe(2); + grantedProviders.Result.First().IsGranted.ShouldBeTrue(); + grantedProviders.Result.First().Name.ShouldBe("MyResourcePermission1"); + grantedProviders.Result.First().Providers.ShouldContain(x => x.Key == "Test"); + + grantedProviders.Result.Last().IsGranted.ShouldBeTrue(); + grantedProviders.Result.Last().Name.ShouldBe("MyResourcePermission2"); + grantedProviders.Result.Last().Providers.ShouldContain(x => x.Key == "Test"); + } + + [Fact] + public async Task Get_Should_Return_Not_Granted_When_Permission_Undefined() + { + var result = await _resourcePermissionManager.GetAsync( + "MyResourcePermission1NotExist", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1,"Test", "Test"); + result.Name.ShouldBe("MyResourcePermission1NotExist"); + result.Providers.ShouldBeEmpty(); + result.IsGranted.ShouldBeFalse(); + } + + [Fact] + public async Task GetAllAsync() + { + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission2", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + + var permissionWithGrantedProviders = await _resourcePermissionManager.GetAllAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + + permissionWithGrantedProviders.ShouldNotBeNull(); + permissionWithGrantedProviders.ShouldContain(x => + x.IsGranted && x.Name == "MyResourcePermission1" && x.Providers.Any(p => p.Key == "Test")); + permissionWithGrantedProviders.ShouldContain(x => + x.IsGranted && x.Name == "MyResourcePermission2" && x.Providers.Any(p => p.Key == "Test")); + + + permissionWithGrantedProviders = await _resourcePermissionManager.GetAllAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1); + + permissionWithGrantedProviders.ShouldNotBeNull(); + permissionWithGrantedProviders.ShouldContain(x => x.IsGranted && x.Name == "MyResourcePermission1" && x.Providers.Any(p => p.Key == "Test")); + permissionWithGrantedProviders.ShouldContain(x => x.IsGranted && x.Name == "MyResourcePermission2" && x.Providers.Any(p => p.Key == "Test")); + + permissionWithGrantedProviders.ShouldNotContain(x => x.Name == "MyResourcePermission5"); // Not available permission + + permissionWithGrantedProviders.ShouldContain(x => !x.IsGranted && x.Name == "MyResourcePermission3" && x.Providers.Count == 0); + permissionWithGrantedProviders.ShouldContain(x => !x.IsGranted && x.Name == "MyResourcePermission4" && x.Providers.Count == 0); + permissionWithGrantedProviders.ShouldContain(x => !x.IsGranted && x.Name == "MyResourcePermission6" && x.Providers.Count == 0); + permissionWithGrantedProviders.ShouldContain(x => !x.IsGranted && x.Name == "MyResourcePermission7" && x.Providers.Count == 0); + permissionWithGrantedProviders.ShouldContain(x => !x.IsGranted && x.Name == "MyResourcePermission8" && x.Providers.Count == 0); + } + + [Fact] + public async Task GetAllGroupAsync() + { + var group = await _resourcePermissionManager.GetAllGroupAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1); + + group.ShouldNotBeNull(); + group.Count.ShouldBe(1); + group.First().ProviderName.ShouldBe(UserResourcePermissionValueProvider.ProviderName); + group.First().ProviderKey.ShouldBe(PermissionTestDataBuilder.User1Id.ToString()); + group.First().Permissions.Count.ShouldBe(1); + group.First().Permissions.ShouldContain(x => x == "MyResourcePermission1"); + + group = await _resourcePermissionManager.GetAllGroupAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3); + + group.ShouldNotBeNull(); + group.Count.ShouldBe(1); + group.First().ProviderName.ShouldBe(UserResourcePermissionValueProvider.ProviderName); + group.First().ProviderKey.ShouldBe(PermissionTestDataBuilder.User1Id.ToString()); + group.First().Permissions.Count.ShouldBe(2); + group.First().Permissions.ShouldContain(x => x == "MyResourcePermission3"); + group.First().Permissions.ShouldContain(x => x == "MyResourcePermission6"); + } + + [Fact] + public async Task Set_Should_Silently_Ignore_When_Permission_Undefined() + { + await _resourcePermissionManager.SetAsync( + "MyResourcePermission1NotExist", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test", + true); + } + + [Fact] + public async Task Set_Should_Throw_Exception_If_Provider_Not_Found() + { + var exception = await Assert.ThrowsAsync(async () => + { + await _resourcePermissionManager.SetAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "UndefinedProvider", + "Test", + true); + }); + + exception.Message.ShouldBe("Unknown resource permission management provider: UndefinedProvider"); + } + + [Fact] + public async Task UpdateProviderKey() + { + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + var permissionGrant = await _resourcePermissionGrantRepository.FindAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + permissionGrant.ProviderKey.ShouldBe("Test"); + + await _resourcePermissionManager.UpdateProviderKeyAsync(permissionGrant, "NewProviderKey"); + (await _resourcePermissionGrantRepository.FindAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "NewProviderKey")).ShouldNotBeNull(); + } + + [Fact] + public async Task DeleteAsync() + { + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + var permissionGrant = await _resourcePermissionGrantRepository.FindAsync("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + permissionGrant.ProviderKey.ShouldBe("Test"); + + await _resourcePermissionManager.DeleteAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + + (await _resourcePermissionGrantRepository.FindAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test")).ShouldBeNull(); + } + + [Fact] + public async Task DeleteByProviderAsync() + { + await _resourcePermissionGrantRepository.InsertAsync(new ResourcePermissionGrant( + Guid.NewGuid(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test") + ); + + var permissionGrant = await _resourcePermissionGrantRepository.FindAsync("MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test"); + + permissionGrant.ProviderKey.ShouldBe("Test"); + + await _resourcePermissionManager.DeleteAsync( + "Test", + "Test"); + + (await _resourcePermissionGrantRepository.FindAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Test", + "Test")).ShouldBeNull(); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionStore_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionStore_Tests.cs new file mode 100644 index 0000000000..34e6f89c0c --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/ResourcePermissionStore_Tests.cs @@ -0,0 +1,119 @@ +using System.Linq; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Authorization.Permissions.Resources; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public class ResourcePermissionStore_Tests : PermissionTestBase +{ + private readonly IResourcePermissionStore _resourcePermissionStore; + + public ResourcePermissionStore_Tests() + { + _resourcePermissionStore = GetRequiredService(); + } + + [Fact] + public async Task IsGrantedAsync() + { + (await _resourcePermissionStore.IsGrantedAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString())).ShouldBeTrue(); + + (await _resourcePermissionStore.IsGrantedAsync( + "MyPermission1NotExist", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString())).ShouldBeFalse(); + } + + [Fact] + public async Task IsGranted_Multiple() + { + var result = await _resourcePermissionStore.IsGrantedAsync( + new[] { "MyResourcePermission1", "MyResourcePermission1NotExist" }, + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + + result.Result.Count.ShouldBe(2); + + result.Result.FirstOrDefault(x => x.Key == "MyResourcePermission1").Value.ShouldBe(PermissionGrantResult.Granted); + result.Result.FirstOrDefault(x => x.Key == "MyResourcePermission1NotExist").Value.ShouldBe(PermissionGrantResult.Undefined); + } + + + [Fact] + public async Task GetPermissionsAsync() + { + var permissions = await _resourcePermissionStore.GetPermissionsAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1); + + permissions.Result.Count.ShouldBe(10); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission1" && p.Value == PermissionGrantResult.Granted); + permissions.Result.ShouldContain(p => p.Key == "MyResourceDisabledPermission1" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission2" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission3" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission4" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission5" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission6" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourceDisabledPermission2" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission7" && p.Value == PermissionGrantResult.Undefined); + permissions.Result.ShouldContain(p => p.Key == "MyResourcePermission8" && p.Value == PermissionGrantResult.Undefined); + + permissions = await _resourcePermissionStore.GetPermissionsAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey2); + permissions.Result.ShouldAllBe(x => x.Value == PermissionGrantResult.Undefined); + } + + [Fact] + public async Task GetGrantedPermissionsAsync() + { + var grantedPermissions = await _resourcePermissionStore.GetGrantedPermissionsAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1); + + grantedPermissions.Length.ShouldBe(1); + grantedPermissions.ShouldContain("MyResourcePermission1"); + + grantedPermissions = await _resourcePermissionStore.GetGrantedPermissionsAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3); + + grantedPermissions.Length.ShouldBe(3); + grantedPermissions.ShouldContain("MyResourcePermission3"); + grantedPermissions.ShouldContain("MyResourcePermission5"); + grantedPermissions.ShouldContain("MyResourcePermission6"); + + } + + + [Fact] + public async Task GetGrantedResourceKeysAsync() + { + var grantedResourceKeys = await _resourcePermissionStore.GetGrantedResourceKeysAsync( + TestEntityResource.ResourceName, + "MyResourcePermission1"); + + grantedResourceKeys.Length.ShouldBe(1); + grantedResourceKeys.ShouldContain(TestEntityResource.ResourceKey1); + + grantedResourceKeys = await _resourcePermissionStore.GetGrantedResourceKeysAsync( + TestEntityResource.ResourceName, + "MyResourcePermission5"); + + grantedResourceKeys.Length.ShouldBe(2); + grantedResourceKeys.ShouldContain(TestEntityResource.ResourceKey3); + grantedResourceKeys.ShouldContain(TestEntityResource.ResourceKey5); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo/Abp/PermissionManagement/EntityFrameworkCore/ResourcePermissionGrantRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo/Abp/PermissionManagement/EntityFrameworkCore/ResourcePermissionGrantRepository_Tests.cs new file mode 100644 index 0000000000..89fdb9a9d4 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo/Abp/PermissionManagement/EntityFrameworkCore/ResourcePermissionGrantRepository_Tests.cs @@ -0,0 +1,6 @@ +namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; + +public class ResourcePermissionGrantRepository_Tests : ResourcePermissionGrantRepository_Tests +{ + +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/MongoDbPermissionDefinitionRecordRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/MongoDbPermissionDefinitionRecordRepository_Tests.cs index d43634cdb9..30f09c5720 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/MongoDbPermissionDefinitionRecordRepository_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/MongoDbPermissionDefinitionRecordRepository_Tests.cs @@ -3,7 +3,7 @@ namespace Volo.Abp.PermissionManagement.MongoDB; [Collection(MongoTestCollection.Name)] -public class MongoDbPermissionDefinitionRecordRepository_Tests : PermissionGrantRepository_Tests +public class MongoDbPermissionDefinitionRecordRepository_Tests : PermissionDefinitionRecordRepository_Tests { } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/ResourcePermissionGrantRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/ResourcePermissionGrantRepository_Tests.cs new file mode 100644 index 0000000000..32240f998c --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/ResourcePermissionGrantRepository_Tests.cs @@ -0,0 +1,9 @@ +using Xunit; + +namespace Volo.Abp.PermissionManagement.MongoDB; + +[Collection(MongoTestCollection.Name)] +public class ResourcePermissionGrantRepository_Tests : ResourcePermissionGrantRepository_Tests +{ + +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/AbpPermissionManagementTestBaseModule.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/AbpPermissionManagementTestBaseModule.cs index a6102a318e..88c6ea1d69 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/AbpPermissionManagementTestBaseModule.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/AbpPermissionManagementTestBaseModule.cs @@ -18,6 +18,8 @@ public class AbpPermissionManagementTestBaseModule : AbpModule context.Services.Configure(options => { options.ManagementProviders.Add(); + options.ResourceManagementProviders.Add(); + options.ResourcePermissionProviderKeyLookupServices.Add(); }); } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs index c60dff997a..d0448ea5bd 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs @@ -12,12 +12,17 @@ public class PermissionTestDataBuilder : ITransientDependency public static Guid User2Id { get; } = Guid.NewGuid(); private readonly IPermissionGrantRepository _permissionGrantRepository; + private readonly IResourcePermissionGrantRepository _resourcePermissionGrantRepository; private readonly IGuidGenerator _guidGenerator; - public PermissionTestDataBuilder(IGuidGenerator guidGenerator, IPermissionGrantRepository permissionGrantRepository) + public PermissionTestDataBuilder( + IGuidGenerator guidGenerator, + IPermissionGrantRepository permissionGrantRepository, + IResourcePermissionGrantRepository resourcePermissionGrantRepository) { _guidGenerator = guidGenerator; _permissionGrantRepository = permissionGrantRepository; + _resourcePermissionGrantRepository = resourcePermissionGrantRepository; } public async Task BuildAsync() @@ -31,6 +36,15 @@ public class PermissionTestDataBuilder : ITransientDependency ) ); + await _permissionGrantRepository.InsertAsync( + new PermissionGrant( + _guidGenerator.Create(), + "TestEntityManagementPermission", + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); + await _permissionGrantRepository.InsertAsync( new PermissionGrant( _guidGenerator.Create(), @@ -57,5 +71,71 @@ public class PermissionTestDataBuilder : ITransientDependency User1Id.ToString() ) ); + + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + _guidGenerator.Create(), + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); + + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + _guidGenerator.Create(), + "MyDisabledResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); + + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + _guidGenerator.Create(), + "MyResourcePermission3", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3, + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); + + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + _guidGenerator.Create(), + "MyResourcePermission5", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3, + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); + + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + _guidGenerator.Create(), + "MyResourcePermission6", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3, + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); + + await _resourcePermissionGrantRepository.InsertAsync( + new ResourcePermissionGrant( + _guidGenerator.Create(), + "MyResourcePermission5", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey5, + UserPermissionValueProvider.ProviderName, + User1Id.ToString() + ) + ); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/ResourcePermissionGrantRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/ResourcePermissionGrantRepository_Tests.cs new file mode 100644 index 0000000000..90652683b1 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/ResourcePermissionGrantRepository_Tests.cs @@ -0,0 +1,121 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Modularity; +using Xunit; + +namespace Volo.Abp.PermissionManagement; + +public abstract class ResourcePermissionGrantRepository_Tests : PermissionManagementTestBase + where TStartupModule : IAbpModule +{ + protected IResourcePermissionGrantRepository ResourcePermissionGrantRepository { get; } + + protected ResourcePermissionGrantRepository_Tests() + { + ResourcePermissionGrantRepository = GetRequiredService(); + } + + [Fact] + public async Task FindAsync() + { + (await ResourcePermissionGrantRepository.FindAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString())).ShouldNotBeNull(); + + (await ResourcePermissionGrantRepository.FindAsync( + "Undefined-Permission", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString())).ShouldBeNull(); + + (await ResourcePermissionGrantRepository.FindAsync( + "MyResourcePermission1", + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1, + "Undefined-Provider", + "Unknown-Id")).ShouldBeNull(); + } + + [Fact] + public async Task GetList4Async() + { + var permissionGrants = + await ResourcePermissionGrantRepository.GetListAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission3"); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission5"); + } + + [Fact] + public async Task GetList5Async() + { + var permissionGrants = + await ResourcePermissionGrantRepository.GetListAsync( + new[] { "MyResourcePermission1", "MyResourcePermission3", "MyResourcePermission5" }, + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey3, + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + + permissionGrants.ShouldNotContain(p => p.Name == "MyResourcePermission1"); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission3"); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission5"); + } + + [Fact] + public async Task GetList2Async() + { + var permissionGrants = + await ResourcePermissionGrantRepository.GetListAsync( + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User1Id.ToString()); + + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission1" && p.ResourceKey == TestEntityResource.ResourceKey1 && p.ResourceName == TestEntityResource.ResourceName); + permissionGrants.ShouldContain(p => p.Name == "MyDisabledResourcePermission1" && p.ResourceKey == TestEntityResource.ResourceKey1 && p.ResourceName == TestEntityResource.ResourceName); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission3" && p.ResourceKey == TestEntityResource.ResourceKey3 && p.ResourceName == TestEntityResource.ResourceName); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission5" && p.ResourceKey == TestEntityResource.ResourceKey3 && p.ResourceName == TestEntityResource.ResourceName); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission5" && p.ResourceKey == TestEntityResource.ResourceKey5 && p.ResourceName == TestEntityResource.ResourceName); + + permissionGrants = + await ResourcePermissionGrantRepository.GetListAsync( + UserPermissionValueProvider.ProviderName, + PermissionTestDataBuilder.User2Id.ToString()); + + permissionGrants.ShouldBeEmpty(); + } + + [Fact] + public async Task GetPermissionsAsync() + { + var permissionGrants = + await ResourcePermissionGrantRepository.GetPermissionsAsync( + TestEntityResource.ResourceName, + TestEntityResource.ResourceKey1); + + permissionGrants.Count.ShouldBe(2); + permissionGrants.ShouldContain(p => p.Name == "MyResourcePermission1"); + permissionGrants.ShouldContain(p => p.Name == "MyDisabledResourcePermission1"); + } + + [Fact] + public async Task GetResourceKeys() + { + var permissionGrants = + await ResourcePermissionGrantRepository.GetResourceKeys( + TestEntityResource.ResourceName, + "MyResourcePermission5"); + + permissionGrants.Count.ShouldBe(2); + permissionGrants.ShouldContain(p => p.ResourceKey == TestEntityResource.ResourceKey3); + permissionGrants.ShouldContain(p => p.ResourceKey == TestEntityResource.ResourceKey5); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestEntityResource.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestEntityResource.cs new file mode 100644 index 0000000000..9f631b123d --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestEntityResource.cs @@ -0,0 +1,16 @@ +using System; + +namespace Volo.Abp.PermissionManagement; + +public class TestEntityResource +{ + public static readonly string ResourceName = typeof(TestEntityResource).FullName; + + public static readonly string ResourceKey1 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey2 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey3 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey4 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey5 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey6 = Guid.NewGuid().ToString(); + public static readonly string ResourceKey7 = Guid.NewGuid().ToString(); +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionDefinitionProvider.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionDefinitionProvider.cs new file mode 100644 index 0000000000..2d5a4d5d99 --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionDefinitionProvider.cs @@ -0,0 +1,28 @@ +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement; + +public class TestResourcePermissionDefinitionProvider : PermissionDefinitionProvider +{ + public override void Define(IPermissionDefinitionContext context) + { + context.AddGroup("TestEntityManagementPermissionGroup").AddPermission("TestEntityManagementPermission"); + + context.AddResourcePermission("MyResourcePermission1", TestEntityResource.ResourceName, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourceDisabledPermission1", TestEntityResource.ResourceName, "TestEntityManagementPermission", isEnabled: false); + context.AddResourcePermission("MyResourcePermission2", TestEntityResource.ResourceName, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourcePermission3", TestEntityResource.ResourceName, "TestEntityManagementPermission", multiTenancySide: MultiTenancySides.Host); + context.AddResourcePermission("MyResourcePermission4", TestEntityResource.ResourceName, "TestEntityManagementPermission", multiTenancySide: MultiTenancySides.Host).WithProviders(UserPermissionValueProvider.ProviderName); + + var myPermission5 = context.AddResourcePermission("MyResourcePermission5", TestEntityResource.ResourceName, "TestEntityManagementPermission"); + myPermission5.StateCheckers.Add(new TestRequireRolePermissionStateProvider("super-admin")); + + context.AddResourcePermission("MyResourcePermission6", TestEntityResource.ResourceName, "TestEntityManagementPermission"); + + context.AddResourcePermission("MyResourceDisabledPermission2", TestEntityResource.ResourceName, "TestEntityManagementPermission", isEnabled: false); + + context.AddResourcePermission("MyResourcePermission7", TestEntityResource.ResourceName, "TestEntityManagementPermission"); + context.AddResourcePermission("MyResourcePermission8", TestEntityResource.ResourceName, "TestEntityManagementPermission"); + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionManagementProvider.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionManagementProvider.cs new file mode 100644 index 0000000000..e555c6133d --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionManagementProvider.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Abp.Guids; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.PermissionManagement; + +public class TestResourcePermissionManagementProvider : ResourcePermissionManagementProvider +{ + public override string Name => "Test"; + + public TestResourcePermissionManagementProvider( + IResourcePermissionGrantRepository resourcePermissionGrantRepository, + IGuidGenerator guidGenerator, + ICurrentTenant currentTenant) + : base( + resourcePermissionGrantRepository, + guidGenerator, + currentTenant) + { + + } +} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionProviderKeyLookupService.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionProviderKeyLookupService.cs new file mode 100644 index 0000000000..f42a204f7a --- /dev/null +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestResourcePermissionProviderKeyLookupService.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Localization; + +namespace Volo.Abp.PermissionManagement; + +public class TestResourcePermissionProviderKeyLookupService : IResourcePermissionProviderKeyLookupService, ITransientDependency +{ + public string Name => "Test"; + + public ILocalizableString DisplayName => new LocalizableString("Test", "TestResource"); + + public Task> SearchAsync(string filter = null, int page = 1, CancellationToken cancellationToken = default) + { + throw new System.NotImplementedException(); + } + + public Task> SearchAsync(string[] keys, CancellationToken cancellationToken = default) + { + throw new System.NotImplementedException(); + } +} diff --git a/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs b/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs index cbb97606bd..4671a82ad6 100644 --- a/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs +++ b/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Volo.Abp.Account; using Volo.Abp.Account.Web; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs index 885a556991..b4eb29c400 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs @@ -119,6 +119,8 @@ public partial class EmailSettingGroupViewComponent await EmailSettingsAppService.SendTestEmailAsync(ObjectMapper.Map(SendTestEmailInput)); await Notify.Success(L["SentSuccessfully"]); + + await CloseSendTestEmailModalAsync(); } catch (Exception ex) { diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js index 6dd040ad5c..936ef46c88 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js @@ -41,6 +41,7 @@ _sendTestEmailModal.onResult(function () { abp.notify.success(l('SentSuccessfully')); + _sendTestEmailModal.close(); }); $("#SendTestEmailButton").click(function (e) { diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IRoleData.cs b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IRoleData.cs new file mode 100644 index 0000000000..37656f6588 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IRoleData.cs @@ -0,0 +1,19 @@ +using System; +using Volo.Abp.Data; + +namespace Volo.Abp.Users; + +public interface IRoleData : IHasExtraProperties +{ + Guid Id { get; } + + Guid? TenantId { get; } + + string Name { get; } + + bool IsDefault { get; } + + bool IsStatic { get; } + + bool IsPublic { get; } +} diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/RoleData.cs b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/RoleData.cs new file mode 100644 index 0000000000..960a3dfcc7 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/RoleData.cs @@ -0,0 +1,56 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp.Data; + +namespace Volo.Abp.Users; + +public class RoleData : IRoleData +{ + public Guid Id { get; set; } + + public Guid? TenantId { get; set; } + + public string Name { get; set; } + + public bool IsDefault { get; set; } + + public bool IsStatic { get; set; } + + public bool IsPublic { get; set; } + + public ExtraPropertyDictionary ExtraProperties { get; } + + public RoleData() + { + + } + + public RoleData(IRoleData roleData) + { + Id = roleData.Id; + Name = roleData.Name; + IsDefault = roleData.IsDefault; + IsStatic = roleData.IsStatic; + IsPublic = roleData.IsPublic; + TenantId = roleData.TenantId; + ExtraProperties = roleData.ExtraProperties; + } + + public RoleData( + Guid id, + [NotNull] string name, + bool isDefault = false, + bool isStatic = false, + bool isPublic = false, + Guid? tenantId = null, + ExtraPropertyDictionary extraProperties = null) + { + Id = id; + Name = name; + IsDefault = isDefault; + IsStatic = isStatic; + IsPublic = isPublic; + TenantId = tenantId; + ExtraProperties = extraProperties; + } +} diff --git a/npm/ng-packs/apps/dev-app/project.json b/npm/ng-packs/apps/dev-app/project.json index 37f0502dde..bea3bf6612 100644 --- a/npm/ng-packs/apps/dev-app/project.json +++ b/npm/ng-packs/apps/dev-app/project.json @@ -176,9 +176,7 @@ }, "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/apps/dev-app" - ], + "outputs": ["{workspaceRoot}/coverage/apps/dev-app"], "options": { "jestConfig": "apps/dev-app/jest.config.ts" } diff --git a/npm/ng-packs/apps/dev-app/src/main.server.ts b/npm/ng-packs/apps/dev-app/src/main.server.ts index 4b9d4d1545..fbd3e9dbd7 100644 --- a/npm/ng-packs/apps/dev-app/src/main.server.ts +++ b/npm/ng-packs/apps/dev-app/src/main.server.ts @@ -1,7 +1,7 @@ -import { bootstrapApplication } from '@angular/platform-browser'; +import { bootstrapApplication, BootstrapContext } from '@angular/platform-browser'; import { AppComponent } from './app/app.component'; import { config } from './app/app.config.server'; -const bootstrap = () => bootstrapApplication(AppComponent, config); +const bootstrap = (context: BootstrapContext) => bootstrapApplication(AppComponent, config, context); export default bootstrap; diff --git a/npm/ng-packs/migrations.json b/npm/ng-packs/migrations.json index 49df20928b..3615f35e50 100644 --- a/npm/ng-packs/migrations.json +++ b/npm/ng-packs/migrations.json @@ -1,45 +1,118 @@ { "migrations": [ + { + "version": "22.0.0-beta.1", + "description": "Updates release version config based on the breaking changes in Nx v22", + "implementation": "./src/migrations/update-22-0-0/release-version-config-changes", + "package": "nx", + "name": "22-0-0-release-version-config-changes" + }, + { + "version": "22.0.0-beta.2", + "description": "Consolidates releaseTag* options into nested releaseTag object structure", + "implementation": "./src/migrations/update-22-0-0/consolidate-release-tag-config", + "package": "nx", + "name": "22-0-0-consolidate-release-tag-config" + }, { "cli": "nx", - "version": "21.2.0-beta.3", - "requires": { "@angular/core": ">=20.0.0" }, - "description": "Update the @angular/cli package version to ~20.0.0.", - "factory": "./src/migrations/update-21-2-0/update-angular-cli", + "version": "22.1.0-beta.5", + "description": "Updates the nx wrapper.", + "implementation": "./src/migrations/update-22-1-0/update-nx-wrapper", + "package": "nx", + "name": "22-1-0-update-nx-wrapper" + }, + { + "version": "21.5.0-beta.2", + "description": "Migrate the legacy 'development' custom condition to a workspace-unique custom condition name.", + "factory": "./src/migrations/update-21-5-0/migrate-development-custom-condition", + "package": "@nx/js", + "name": "migrate-development-custom-condition" + }, + { + "version": "22.0.0-beta.0", + "description": "Remove the deprecated `external` and `externalBuildTargets` options from the `@nx/js:swc` and `@nx/js:tsc` executors.", + "factory": "./src/migrations/update-22-0-0/remove-external-options-from-js-executors", + "package": "@nx/js", + "name": "remove-external-options-from-js-executors" + }, + { + "version": "22.1.0-rc.1", + "description": "Removes redundant TypeScript project references from project's tsconfig.json files when runtime tsconfig files (e.g., tsconfig.lib.json, tsconfig.app.json) exist.", + "factory": "./src/migrations/update-22-1-0/remove-redundant-ts-project-references", + "package": "@nx/js", + "name": "remove-redundant-ts-project-references" + }, + { + "version": "21.3.0-beta.3", + "description": "Rename the CLI option `testPathPattern` to `testPathPatterns`.", + "implementation": "./src/migrations/update-21-3-0/rename-test-path-pattern", + "package": "@nx/jest", + "name": "rename-test-path-pattern" + }, + { + "version": "22.2.0-beta.2", + "description": "Convert jest.config.ts files from ESM to CJS syntax (export default -> module.exports, import -> require) for projects using CommonJS resolution to ensure correct loading under Node.js type-stripping.", + "implementation": "./src/migrations/update-22-2-0/convert-jest-config-to-cjs", + "package": "@nx/jest", + "name": "convert-jest-config-to-cjs" + }, + { + "cli": "nx", + "version": "21.3.0-beta.4", + "requires": { "@angular/core": ">=20.1.0" }, + "description": "Update the @angular/cli package version to ~20.1.0.", + "factory": "./src/migrations/update-21-3-0/update-angular-cli", "package": "@nx/angular", - "name": "update-angular-cli-version-20-0-0" + "name": "update-angular-cli-version-20-1-0" }, { - "version": "21.2.0-beta.3", - "requires": { "@angular/core": ">=20.0.0" }, - "description": "Migrate imports of `provideServerRendering` from `@angular/platform-server` to `@angular/ssr`.", - "factory": "./src/migrations/update-21-2-0/migrate-provide-server-rendering-import", + "version": "21.5.0-beta.0", + "description": "Set the 'tsConfig' option to build and test targets to help with Angular migration issues.", + "factory": "./src/migrations/update-21-5-0/set-tsconfig-option", "package": "@nx/angular", - "name": "migrate-provide-server-rendering-import" + "name": "set-tsconfig-option" }, { - "version": "21.2.0-beta.3", - "requires": { "@angular/core": ">=20.0.0" }, - "description": "Replace `provideServerRouting` and `provideServerRoutesConfig` with `provideServerRendering` using `withRoutes`.", - "factory": "./src/migrations/update-21-2-0/replace-provide-server-routing", + "cli": "nx", + "version": "21.5.0-beta.2", + "requires": { "@angular/core": ">=20.2.0" }, + "description": "Update the @angular/cli package version to ~20.2.0.", + "factory": "./src/migrations/update-21-5-0/update-angular-cli", "package": "@nx/angular", - "name": "replace-provide-server-routing" + "name": "update-angular-cli-version-20-2-0" }, { - "version": "21.2.0-beta.3", - "requires": { "@angular/core": ">=20.0.0" }, - "description": "Update the generator defaults to maintain the previous style guide behavior.", - "factory": "./src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide", + "version": "21.5.0-beta.2", + "requires": { "@angular/core": ">=20.2.0" }, + "description": "Remove any Karma configuration files that only contain the default content. The default configuration is automatically available without a specific project configurationfile.", + "factory": "./src/migrations/update-21-5-0/remove-default-karma-configuration-files", "package": "@nx/angular", - "name": "set-generator-defaults-for-previous-style-guide" + "name": "remove-default-karma-configuration-files" }, { - "version": "21.2.0-beta.3", - "requires": { "@angular/core": ">=20.0.0" }, - "description": "Update 'moduleResolution' to 'bundler' in TypeScript configurations. You can read more about this here: https://www.typescriptlang.org/tsconfig/#moduleResolution.", - "factory": "./src/migrations/update-21-2-0/update-module-resolution", + "cli": "nx", + "version": "21.6.1-beta.2", + "requires": { "@angular/core": ">=20.3.0" }, + "description": "Update the @angular/cli package version to ~20.3.0.", + "factory": "./src/migrations/update-21-6-1/update-angular-cli", "package": "@nx/angular", - "name": "update-module-resolution" + "name": "update-angular-cli-version-20-3-0" + }, + { + "version": "20.2.0", + "description": "Replaces usages of the deprecated Router.getCurrentNavigation method with the Router.currentNavigation signal", + "factory": "./bundles/router-current-navigation.cjs#migrate", + "optional": true, + "package": "@angular/core", + "name": "router-current-navigation" + }, + { + "version": "20.3.0", + "description": "Adds `BootstrapContext` to `bootstrapApplication` calls in `main.server.ts` to support server rendering.", + "factory": "./bundles/add-bootstrap-context-to-server-main.cjs#migrate", + "package": "@angular/core", + "name": "add-bootstrap-context-to-server-main" } ] } diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index a2411db57d..80b1ea7f33 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -46,51 +46,51 @@ }, "private": true, "devDependencies": { - "@abp/ng.theme.lepton-x": "~5.0.2", - "@abp/utils": "~10.0.2", - "@angular-devkit/build-angular": "~20.0.0", - "@angular-devkit/core": "~20.0.0", - "@angular-devkit/schematics": "~20.0.0", - "@angular-devkit/schematics-cli": "~20.0.0", - "@angular-eslint/eslint-plugin": "~20.0.0", - "@angular-eslint/eslint-plugin-template": "~20.0.0", - "@angular-eslint/template-parser": "~20.0.0", - "@angular/animations": "~20.0.0", - "@angular/build": "~20.0.0", - "@angular/cli": "~20.0.0", - "@angular/common": "~20.0.0", - "@angular/compiler": "~20.0.0", - "@angular/compiler-cli": "~20.0.0", - "@angular/core": "~20.0.0", - "@angular/forms": "~20.0.0", - "@angular/language-service": "~20.0.0", - "@angular/localize": "~20.0.0", - "@angular/platform-browser": "~20.0.0", - "@angular/platform-browser-dynamic": "~20.0.0", - "@angular/platform-server": "~20.0.0", - "@angular/router": "~20.0.0", - "@angular/ssr": "~20.0.0", + "@abp/ng.theme.lepton-x": "~5.0.1", + "@abp/utils": "~10.0.1", + "@angular-devkit/build-angular": "~21.0.0", + "@angular-devkit/core": "~21.0.0", + "@angular-devkit/schematics": "~21.0.0", + "@angular-devkit/schematics-cli": "~21.0.0", + "@angular-eslint/eslint-plugin": "~21.0.0", + "@angular-eslint/eslint-plugin-template": "~21.0.0", + "@angular-eslint/template-parser": "~21.0.0", + "@angular/animations": "21.0.0", + "@angular/build": "~21.0.0", + "@angular/cli": "~21.0.0", + "@angular/common": "~21.0.0", + "@angular/compiler": "~21.0.0", + "@angular/compiler-cli": "~21.0.0", + "@angular/core": "~21.0.0", + "@angular/forms": "~21.0.0", + "@angular/language-service": "~21.0.0", + "@angular/localize": "~21.0.0", + "@angular/platform-browser": "~21.0.0", + "@angular/platform-browser-dynamic": "~21.0.0", + "@angular/platform-server": "~21.0.0", + "@angular/router": "~21.0.0", + "@angular/ssr": "~21.0.0", "@fortawesome/fontawesome-free": "^6.0.0", - "@ng-bootstrap/ng-bootstrap": "~19.0.0", + "@ng-bootstrap/ng-bootstrap": "~20.0.0", "@ngneat/spectator": "~19.6.2", "@ngx-validate/core": "^0.2.0", - "@nx/angular": "~21.2.0", - "@nx/cypress": "~21.2.0", - "@nx/devkit": "~21.2.0", - "@nx/eslint": "~21.2.0", - "@nx/eslint-plugin": "~21.2.0", - "@nx/jest": "~21.2.0", - "@nx/js": "~21.2.0", - "@nx/plugin": "~21.2.0", - "@nx/web": "~21.2.0", - "@nx/workspace": "~21.2.0", + "@nx/angular": "~22.2.0", + "@nx/cypress": "~22.2.0", + "@nx/devkit": "~22.2.0", + "@nx/eslint": "~22.2.0", + "@nx/eslint-plugin": "~22.2.0", + "@nx/jest": "~22.2.0", + "@nx/js": "~22.2.0", + "@nx/plugin": "~22.2.0", + "@nx/web": "~22.2.0", + "@nx/workspace": "~22.2.0", "@popperjs/core": "~2.11.0", - "@schematics/angular": "~20.0.0", + "@schematics/angular": "~21.0.0", "@swc-node/register": "1.9.2", "@swc/cli": "0.6.0", "@swc/core": "~1.5.0", "@swc/helpers": "~0.5.0", - "@swimlane/ngx-datatable": "~21.1.0", + "@swimlane/ngx-datatable": "~22.0.0", "@types/express": "~5.0.0", "@types/jest": "29.5.14", "@types/node": "~20.11.0", @@ -120,9 +120,9 @@ "just-compare": "^2.0.0", "lerna": "^4.0.0", "lint-staged": "^13.0.0", - "ng-packagr": "~20.0.0", - "ng-zorro-antd": "~20.0.0", - "nx": "~21.2.0", + "ng-packagr": "~21.0.0", + "ng-zorro-antd": "~21.0.0-next.1", + "nx": "~22.2.0", "postcss": "^8.0.0", "postcss-import": "14.1.0", "postcss-preset-env": "7.5.0", @@ -131,12 +131,12 @@ "protractor": "~7.0.0", "rxjs": "~7.8.0", "should-quote": "^1.0.0", - "ts-jest": "29.1.0", + "ts-jest": "29.4.6", "ts-node": "10.9.1", "ts-toolbelt": "^9.0.0", "tslib": "^2.3.0", "tslint": "~6.1.0", - "typescript": "~5.8.0", + "typescript": "~5.9.0", "zone.js": "~0.15.0" }, "lint-staged": { diff --git a/npm/ng-packs/packages/account-core/project.json b/npm/ng-packs/packages/account-core/project.json index 3e60410088..312bdd30e9 100644 --- a/npm/ng-packs/packages/account-core/project.json +++ b/npm/ng-packs/packages/account-core/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/account-core/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared"] + } } diff --git a/npm/ng-packs/packages/account/project.json b/npm/ng-packs/packages/account/project.json index 9514a59dc6..41c6597e2a 100644 --- a/npm/ng-packs/packages/account/project.json +++ b/npm/ng-packs/packages/account/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/account/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared", "account-core"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared", "account-core"] + } } diff --git a/npm/ng-packs/packages/components/lookup/ng-package.json b/npm/ng-packs/packages/components/lookup/ng-package.json new file mode 100644 index 0000000000..665ad2add2 --- /dev/null +++ b/npm/ng-packs/packages/components/lookup/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-entrypoint.schema.json", + "lib": { + "entryFile": "src/public-api.ts" + } +} \ No newline at end of file diff --git a/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.html b/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.html new file mode 100644 index 0000000000..5e09e264e8 --- /dev/null +++ b/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.html @@ -0,0 +1,61 @@ +
+ @if (label()) { + + } + +
+ + @if (displayValue() && !disabled()) { + + } +
+ + @if (showDropdown() && !disabled()) { +
+ @if (isLoading()) { +
+ + {{ 'AbpUi::Loading' | abpLocalization }} +
+ } @else if (searchResults().length > 0) { + @for (item of searchResults(); track item.key) { + + } + } @else if (displayValue()) { + @if (noResultsTemplate()) { + + } @else { +
+ {{ 'AbpUi::NoDataAvailableInDatatable' | abpLocalization }} +
+ } + } +
+ } +
diff --git a/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.scss b/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.scss new file mode 100644 index 0000000000..4b9a9ab12e --- /dev/null +++ b/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.scss @@ -0,0 +1,8 @@ +.abp-lookup-dropdown { + z-index: 1060; + max-height: 200px; + overflow-y: auto; + top: 100%; + margin-top: 0.25rem; + background-color: var(--lpx-content-bg); +} diff --git a/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.ts b/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.ts new file mode 100644 index 0000000000..b78bfa19ce --- /dev/null +++ b/npm/ng-packs/packages/components/lookup/src/lib/lookup-search.component.ts @@ -0,0 +1,140 @@ +import { + Component, + input, + output, + model, + signal, + OnInit, + ChangeDetectionStrategy, + TemplateRef, + contentChild, + DestroyRef, + inject, +} from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { LocalizationPipe } from '@abp/ng.core'; +import { Subject, Observable, debounceTime, distinctUntilChanged, of, finalize } from 'rxjs'; + +export interface LookupItem { + key: string; + displayName: string; + [key: string]: unknown; +} + +export type LookupSearchFn = (filter: string) => Observable; + +@Component({ + selector: 'abp-lookup-search', + templateUrl: './lookup-search.component.html', + styleUrl: './lookup-search.component.scss', + imports: [CommonModule, FormsModule, LocalizationPipe], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class LookupSearchComponent implements OnInit { + private readonly destroyRef = inject(DestroyRef); + + readonly label = input(); + readonly placeholder = input(''); + readonly debounceTime = input(300); + readonly minSearchLength = input(0); + readonly displayKey = input('displayName' as keyof T); + readonly valueKey = input('key' as keyof T); + readonly disabled = input(false); + + readonly searchFn = input>(() => of([])); + + readonly selectedValue = model(''); + readonly displayValue = model(''); + + readonly itemSelected = output(); + readonly searchChanged = output(); + + readonly itemTemplate = contentChild>('itemTemplate'); + readonly noResultsTemplate = contentChild>('noResultsTemplate'); + + readonly searchResults = signal([]); + readonly showDropdown = signal(true); + readonly isLoading = signal(false); + + private readonly searchSubject = new Subject(); + + ngOnInit() { + this.searchSubject + .pipe( + debounceTime(this.debounceTime()), + distinctUntilChanged(), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe(filter => { + this.performSearch(filter); + }); + } + + onSearchInput(filter: string) { + this.displayValue.set(filter); + this.showDropdown.set(true); + this.searchChanged.emit(filter); + + if (filter.length >= this.minSearchLength()) { + this.searchSubject.next(filter); + } else { + this.searchResults.set([]); + } + } + + onSearchFocus() { + this.showDropdown.set(true); + const currentFilter = this.displayValue() || ''; + if (currentFilter.length >= this.minSearchLength()) { + this.performSearch(currentFilter); + } + } + + onSearchBlur(event: FocusEvent) { + const relatedTarget = event.relatedTarget as HTMLElement; + if (!relatedTarget?.closest('.abp-lookup-dropdown')) { + this.showDropdown.set(false); + } + } + + selectItem(item: T) { + const displayKeyValue = String(item[this.displayKey()] ?? ''); + const valueKeyValue = String(item[this.valueKey()] ?? ''); + + this.displayValue.set(displayKeyValue); + this.selectedValue.set(valueKeyValue); + this.searchResults.set([]); + this.showDropdown.set(false); + this.itemSelected.emit(item); + } + + clearSelection() { + this.displayValue.set(''); + this.selectedValue.set(''); + this.searchResults.set([]); + } + + private performSearch(filter: string) { + this.isLoading.set(true); + + this.searchFn()(filter) + .pipe( + takeUntilDestroyed(this.destroyRef), + finalize(() => this.isLoading.set(false)), + ) + .subscribe({ + next: results => { + this.searchResults.set(results); + }, + error: () => { + this.searchResults.set([]); + }, + }); + } + + getDisplayValue(item: T): string { + return String(item[this.displayKey()] ?? item[this.valueKey()] ?? ''); + } +} diff --git a/npm/ng-packs/packages/components/lookup/src/public-api.ts b/npm/ng-packs/packages/components/lookup/src/public-api.ts new file mode 100644 index 0000000000..b1232ef08f --- /dev/null +++ b/npm/ng-packs/packages/components/lookup/src/public-api.ts @@ -0,0 +1 @@ +export * from './lib/lookup-search.component'; diff --git a/npm/ng-packs/packages/components/package.json b/npm/ng-packs/packages/components/package.json index 2e1b500990..28bc8eb30a 100644 --- a/npm/ng-packs/packages/components/package.json +++ b/npm/ng-packs/packages/components/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "chart.js": "^3.5.1", - "ng-zorro-antd": "~20.0.0", + "ng-zorro-antd": "~21.0.0-next.1", "@ctrl/tinycolor": "^4.0.0", "tslib": "^2.0.0" }, diff --git a/npm/ng-packs/packages/components/project.json b/npm/ng-packs/packages/components/project.json index 4a61b72ab4..671fabe461 100644 --- a/npm/ng-packs/packages/components/project.json +++ b/npm/ng-packs/packages/components/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/components/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared"] + } } diff --git a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts index 316200704b..5c320a539b 100644 --- a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts +++ b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts @@ -29,7 +29,7 @@ import { DISABLE_TREE_STYLE_LOADING_TOKEN } from '../disable-tree-style-loading. import { TreeNodeTemplateDirective } from '../templates/tree-node-template.directive'; import { ExpandedIconTemplateDirective } from '../templates/expanded-icon-template.directive'; import { NgTemplateOutlet } from '@angular/common'; -import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core/animation'; export type DropEvent = NzFormatEmitEvent & { pos: number }; diff --git a/npm/ng-packs/packages/components/tsconfig.lib.json b/npm/ng-packs/packages/components/tsconfig.lib.json index 22d2695db8..7dde5f04bf 100644 --- a/npm/ng-packs/packages/components/tsconfig.lib.json +++ b/npm/ng-packs/packages/components/tsconfig.lib.json @@ -2,14 +2,18 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", - "target": "ES2022", "declaration": true, "declarationMap": true, "inlineSources": true, "types": [], - "lib": ["dom", "es2020"], + "target": "ES2022", + "lib": ["ES2020", "dom"], "useDefineForClassFields": false }, - "exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": [ + "src/test-setup.ts", + "src/**/*.spec.ts", + "jest.config.ts" + ], + "include": ["src/**/*.ts"] } diff --git a/npm/ng-packs/packages/components/tsconfig.lib.prod.json b/npm/ng-packs/packages/components/tsconfig.lib.prod.json index 0e06848ce5..8bfa43c12b 100644 --- a/npm/ng-packs/packages/components/tsconfig.lib.prod.json +++ b/npm/ng-packs/packages/components/tsconfig.lib.prod.json @@ -3,7 +3,8 @@ "compilerOptions": { "declarationMap": false, "target": "ES2022", - "useDefineForClassFields": false + "useDefineForClassFields": false, + "skipLibCheck": true }, "angularCompilerOptions": { "compilationMode": "partial" diff --git a/npm/ng-packs/packages/core/project.json b/npm/ng-packs/packages/core/project.json index 9efdfd9d83..a6b7789814 100644 --- a/npm/ng-packs/packages/core/project.json +++ b/npm/ng-packs/packages/core/project.json @@ -4,6 +4,7 @@ "projectType": "library", "sourceRoot": "packages/core/src", "prefix": "abp", + "tags": [], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,6 +33,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [] + } } diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index 09607ae317..249c5246c8 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -29,6 +29,7 @@ import { ABP } from './models/common'; import './utils/date-extensions'; import { provideAbpCoreChild, provideAbpCore, withOptions } from './providers'; import { + AsyncLocalizationPipe, LazyLocalizationPipe, UtcToLocalPipe, SafeHtmlPipe, @@ -60,6 +61,7 @@ const CORE_PIPES = [ ShortDatePipe, ToInjectorPipe, UtcToLocalPipe, + AsyncLocalizationPipe, LazyLocalizationPipe, ]; diff --git a/npm/ng-packs/packages/core/src/lib/localization.module.ts b/npm/ng-packs/packages/core/src/lib/localization.module.ts index 7a74e26783..a863e95296 100644 --- a/npm/ng-packs/packages/core/src/lib/localization.module.ts +++ b/npm/ng-packs/packages/core/src/lib/localization.module.ts @@ -1,14 +1,14 @@ import { NgModule } from '@angular/core'; import { LocalizationPipe } from './pipes/localization.pipe'; -import { LazyLocalizationPipe } from './pipes'; +import { AsyncLocalizationPipe, LazyLocalizationPipe } from './pipes'; /** - * @deprecated Use `LocalizationPipe` and `LazyLocalizationPipe` directly as a standalone pipe. - * This module is no longer necessary for using the `LocalizationPipe` and `LazyLocalizationPipe` pipes. + * @deprecated Use `LocalizationPipe`, `AsyncLocalizationPipe` and `LazyLocalizationPipe` directly as a standalone pipe. + * This module is no longer necessary for using the `LocalizationPipe`, `AsyncLocalizationPipe` and `LazyLocalizationPipe` pipes. */ @NgModule({ - exports: [LocalizationPipe, LazyLocalizationPipe], - imports: [LocalizationPipe, LazyLocalizationPipe], + exports: [LocalizationPipe, AsyncLocalizationPipe, LazyLocalizationPipe], + imports: [LocalizationPipe, AsyncLocalizationPipe, LazyLocalizationPipe], }) export class LocalizationModule {} diff --git a/npm/ng-packs/packages/core/src/lib/pipes/async-localization.pipe.ts b/npm/ng-packs/packages/core/src/lib/pipes/async-localization.pipe.ts new file mode 100644 index 0000000000..0162d7c247 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/pipes/async-localization.pipe.ts @@ -0,0 +1,41 @@ +import { inject, Injectable, Pipe, PipeTransform } from '@angular/core'; +import { + Observable, + of, + filter, + take, + switchMap, + map, + startWith, + distinctUntilChanged, +} from 'rxjs'; +import { ConfigStateService, LocalizationService } from '../services'; + +@Injectable() +@Pipe({ + name: 'abpAsyncLocalization', +}) +export class AsyncLocalizationPipe implements PipeTransform { + private localizationService = inject(LocalizationService); + private configStateService = inject(ConfigStateService); + + transform(key: string, ...params: (string | string[])[]): Observable { + if (!key) { + return of(''); + } + + const flatParams = params.reduce( + (acc, val) => (Array.isArray(val) ? acc.concat(val) : [...acc, val]), + [], + ); + + return this.configStateService.getAll$().pipe( + filter(config => !!config.localization), + take(1), + switchMap(() => this.localizationService.get(key, ...flatParams)), + map(translation => (translation && translation !== key ? translation : '')), + startWith(''), + distinctUntilChanged(), + ); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/pipes/index.ts b/npm/ng-packs/packages/core/src/lib/pipes/index.ts index b7f945c6f5..0320350f55 100644 --- a/npm/ng-packs/packages/core/src/lib/pipes/index.ts +++ b/npm/ng-packs/packages/core/src/lib/pipes/index.ts @@ -6,5 +6,6 @@ export * from './short-date.pipe'; export * from './short-time.pipe'; export * from './short-date-time.pipe'; export * from './utc-to-local.pipe'; +export * from './async-localization.pipe'; export * from './lazy-localization.pipe'; export * from './html-encode.pipe'; diff --git a/npm/ng-packs/packages/core/src/lib/pipes/lazy-localization.pipe.ts b/npm/ng-packs/packages/core/src/lib/pipes/lazy-localization.pipe.ts index b715b25ad8..9cccba088e 100644 --- a/npm/ng-packs/packages/core/src/lib/pipes/lazy-localization.pipe.ts +++ b/npm/ng-packs/packages/core/src/lib/pipes/lazy-localization.pipe.ts @@ -1,41 +1,12 @@ -import { inject, Injectable, Pipe, PipeTransform } from '@angular/core'; -import { - Observable, - of, - filter, - take, - switchMap, - map, - startWith, - distinctUntilChanged, -} from 'rxjs'; -import { ConfigStateService, LocalizationService } from '../services'; +import { Injectable, Pipe } from '@angular/core'; +import { AsyncLocalizationPipe } from './async-localization.pipe'; +/** + * @deprecated Use `AsyncLocalizationPipe` instead. This pipe will be removed in a future version. + * LazyLocalizationPipe has been renamed to AsyncLocalizationPipe to better express its async nature. + */ @Injectable() @Pipe({ name: 'abpLazyLocalization', }) -export class LazyLocalizationPipe implements PipeTransform { - private localizationService = inject(LocalizationService); - private configStateService = inject(ConfigStateService); - - transform(key: string, ...params: (string | string[])[]): Observable { - if (!key) { - return of(''); - } - - const flatParams = params.reduce( - (acc, val) => (Array.isArray(val) ? acc.concat(val) : [...acc, val]), - [], - ); - - return this.configStateService.getAll$().pipe( - filter(config => !!config.localization), - take(1), - switchMap(() => this.localizationService.get(key, ...flatParams)), - map(translation => (translation && translation !== key ? translation : '')), - startWith(''), - distinctUntilChanged(), - ); - } -} +export class LazyLocalizationPipe extends AsyncLocalizationPipe {} diff --git a/npm/ng-packs/packages/core/tsconfig.lib.prod.json b/npm/ng-packs/packages/core/tsconfig.lib.prod.json index 0e06848ce5..8bfa43c12b 100644 --- a/npm/ng-packs/packages/core/tsconfig.lib.prod.json +++ b/npm/ng-packs/packages/core/tsconfig.lib.prod.json @@ -3,7 +3,8 @@ "compilerOptions": { "declarationMap": false, "target": "ES2022", - "useDefineForClassFields": false + "useDefineForClassFields": false, + "skipLibCheck": true }, "angularCompilerOptions": { "compilationMode": "partial" diff --git a/npm/ng-packs/packages/feature-management/project.json b/npm/ng-packs/packages/feature-management/project.json index b2f0e61b08..7712d1b67b 100644 --- a/npm/ng-packs/packages/feature-management/project.json +++ b/npm/ng-packs/packages/feature-management/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/feature-management/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared"] + } } diff --git a/npm/ng-packs/packages/generators/project.json b/npm/ng-packs/packages/generators/project.json index 06244af3d0..5924f7caac 100644 --- a/npm/ng-packs/packages/generators/project.json +++ b/npm/ng-packs/packages/generators/project.json @@ -3,6 +3,7 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/generators/src", "projectType": "library", + "tags": [], "targets": { "build": { "executor": "@nx/js:tsc", @@ -51,6 +52,5 @@ "jestConfig": "packages/generators/jest.config.ts" } } - }, - "tags": [] + } } diff --git a/npm/ng-packs/packages/generators/tsconfig.json b/npm/ng-packs/packages/generators/tsconfig.json index f765bc1b6a..8d1999ff05 100644 --- a/npm/ng-packs/packages/generators/tsconfig.json +++ b/npm/ng-packs/packages/generators/tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "module": "commonjs", - "skipLibCheck": true + "skipLibCheck": true, + "moduleResolution": "node" }, "files": [], "include": [], diff --git a/npm/ng-packs/packages/identity/project.json b/npm/ng-packs/packages/identity/project.json index d51409ac2a..e67a92ba2a 100644 --- a/npm/ng-packs/packages/identity/project.json +++ b/npm/ng-packs/packages/identity/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/identity/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared", "permission-management"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared", "permission-management"] + } } diff --git a/npm/ng-packs/packages/oauth/project.json b/npm/ng-packs/packages/oauth/project.json index 61662f4811..858ec5947c 100644 --- a/npm/ng-packs/packages/oauth/project.json +++ b/npm/ng-packs/packages/oauth/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/oauth/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core"], "targets": { "build": { "executor": "@nx/angular:package", @@ -31,7 +33,5 @@ "lint": { "executor": "@nx/eslint:lint" } - }, - "tags": [], - "implicitDependencies": ["core"] + } } diff --git a/npm/ng-packs/packages/oauth/src/lib/services/index.ts b/npm/ng-packs/packages/oauth/src/lib/services/index.ts index 32909341a1..9e8637a59a 100644 --- a/npm/ng-packs/packages/oauth/src/lib/services/index.ts +++ b/npm/ng-packs/packages/oauth/src/lib/services/index.ts @@ -3,3 +3,4 @@ export * from './oauth-error-filter.service'; export * from './remember-me.service'; export * from './browser-token-storage.service'; export * from './server-token-storage.service'; +export * from './memory-token-storage.service'; diff --git a/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts b/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts new file mode 100644 index 0000000000..7d531dfefd --- /dev/null +++ b/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts @@ -0,0 +1,243 @@ +import { DestroyRef, DOCUMENT, inject, Injectable } from '@angular/core'; +import { OAuthStorage } from 'angular-oauth2-oidc'; +import { AbpLocalStorageService } from '@abp/ng.core'; +import { fromEvent } from 'rxjs'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; + +@Injectable({ + providedIn: 'root', +}) +export class MemoryTokenStorageService implements OAuthStorage { + private static workerUrl: string | null = null; + + private keysShouldStoreInMemory = [ + 'access_token', + 'id_token', + 'expires_at', + 'id_token_claims_obj', + 'id_token_expires_at', + 'id_token_stored_at', + 'access_token_stored_at', + 'abpOAuthClientId', + 'granted_scopes', + ]; + + private worker?: any; + private port?: MessagePort; + private cache = new Map(); + private localStorageService = inject(AbpLocalStorageService); + private _document = inject(DOCUMENT); + private destroyRef = inject(DestroyRef); + private useSharedWorker = false; + + constructor() { + this.initializeStorage(); + this.setupCleanup(); + } + + private initializeStorage(): void { + // @ts-ignore + if (typeof SharedWorker !== 'undefined') { + try { + // Create worker from data URL to avoid path resolution issues in consuming apps + // Data URLs are deterministic - same content produces same URL across all tabs + if (!MemoryTokenStorageService.workerUrl) { + MemoryTokenStorageService.workerUrl = this.createWorkerDataUrl(); + } + // @ts-ignore + this.worker = new SharedWorker(MemoryTokenStorageService.workerUrl, { + name: 'oauth-token-storage', + }); + this.port = this.worker.port; + this.port.start(); + this.useSharedWorker = true; + + this.port.onmessage = event => { + const { action, key, value } = event.data; + + switch (action) { + case 'set': + this.checkAuthStateChanges(key); + this.cache.set(key, value); + break; + case 'remove': + this.cache.delete(key); + this.refreshDocument(); + break; + case 'clear': + this.cache.clear(); + this.refreshDocument(); + break; + case 'get': + if (value !== null) { + this.cache.set(key, value); + } + break; + } + }; + + // Load all tokens from SharedWorker on initialization + this.keysShouldStoreInMemory.forEach(key => { + this.port?.postMessage({ action: 'get', key }); + }); + } catch (error) { + this.useSharedWorker = false; + } + } else { + this.useSharedWorker = false; + } + } + + getItem(key: string): string | null { + if (!this.keysShouldStoreInMemory.includes(key)) { + return this.localStorageService.getItem(key); + } + return this.cache.get(key) || null; + } + + setItem(key: string, value: string): void { + if (!this.keysShouldStoreInMemory.includes(key)) { + this.localStorageService.setItem(key, value); + return; + } + + if (this.useSharedWorker && this.port) { + this.cache.set(key, value); + this.port.postMessage({ action: 'set', key, value }); + } else { + this.cache.set(key, value); + } + } + + removeItem(key: string): void { + if (!this.keysShouldStoreInMemory.includes(key)) { + this.localStorageService.removeItem(key); + return; + } + + if (this.useSharedWorker && this.port) { + this.cache.delete(key); + this.port.postMessage({ action: 'remove', key }); + } else { + this.cache.delete(key); + } + } + + clear(): void { + if (this.useSharedWorker && this.port) { + this.port.postMessage({ action: 'clear' }); + } + this.cache.clear(); + } + + private cleanupPort(): void { + if (this.useSharedWorker && this.port) { + try { + this.port.postMessage({ action: 'disconnect' }); + } catch (error) { + // + } + } + } + + private setupCleanup(): void { + if (this._document.defaultView) { + fromEvent(this._document.defaultView, 'beforeunload') + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => this.cleanupPort()); + + fromEvent(this._document.defaultView, 'pagehide') + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => this.cleanupPort()); + } + } + + private checkAuthStateChanges = (key: string) => { + if (key === 'access_token' && !this.cache.get('access_token')) { + this.refreshDocument(); + } + }; + + private refreshDocument(): void { + this.cleanupPort(); + setTimeout(() => { + this._document.defaultView?.location.reload(); + }, 100); + } + + private createWorkerDataUrl(): string { + const workerScript = `const tokenStore = new Map(); +const ports = new Set(); + +function broadcastToOtherPorts(senderPort, message) { + const deadPorts = []; + ports.forEach(p => { + if (p !== senderPort) { + try { + p.postMessage(message); + } catch (error) { + deadPorts.push(p); + } + } + }); + deadPorts.forEach(p => ports.delete(p)); +} + +function removePort(port) { + if (ports.has(port)) { + ports.delete(port); + } +} + +self.onconnect = (event) => { + const port = event.ports[0]; + ports.add(port); + + port.addEventListener('messageerror', () => { + removePort(port); + }); + + port.onmessage = (e) => { + const { action, key, value } = e.data; + + switch (action) { + case 'set': + if (key && value !== undefined) { + tokenStore.set(key, value); + broadcastToOtherPorts(port, { action: 'set', key, value }); + } + break; + + case 'remove': + if (key) { + tokenStore.delete(key); + broadcastToOtherPorts(port, { action: 'remove', key }); + } + break; + + case 'clear': + tokenStore.clear(); + broadcastToOtherPorts(port, { action: 'clear' }); + break; + + case 'get': + if (key) { + const value = tokenStore.get(key) ?? null; + port.postMessage({ action: 'get', key, value }); + } + break; + + case 'disconnect': + removePort(port); + break; + + default: + // + } + }; + + port.start(); +};`; + return 'data:application/javascript;base64,' + btoa(workerScript); + } +} diff --git a/npm/ng-packs/packages/oauth/src/lib/services/oauth.service.ts b/npm/ng-packs/packages/oauth/src/lib/services/oauth.service.ts index a25c3f6138..8a30b098e1 100644 --- a/npm/ng-packs/packages/oauth/src/lib/services/oauth.service.ts +++ b/npm/ng-packs/packages/oauth/src/lib/services/oauth.service.ts @@ -110,7 +110,12 @@ export class AbpOAuthService implements IAuthService { this.document.defaultView?.location.replace('/authorize'); return Promise.resolve(); } - return this.oAuthService.refreshToken(); + try { + return this.oAuthService.refreshToken(); + } catch (error) { + console.log("Error while refreshing token: ", error); + return Promise.reject(); + } } getAccessTokenExpiration(): number { diff --git a/npm/ng-packs/packages/oauth/src/lib/utils/storage.factory.ts b/npm/ng-packs/packages/oauth/src/lib/utils/storage.factory.ts index 97cd86682b..8a2f7e04c5 100644 --- a/npm/ng-packs/packages/oauth/src/lib/utils/storage.factory.ts +++ b/npm/ng-packs/packages/oauth/src/lib/utils/storage.factory.ts @@ -1,9 +1,9 @@ import { inject, PLATFORM_ID } from '@angular/core'; import { isPlatformBrowser } from '@angular/common'; import { ServerTokenStorageService } from '../services/server-token-storage.service'; -import { BrowserTokenStorageService } from '../services'; +import { BrowserTokenStorageService, MemoryTokenStorageService } from '../services'; import { OAuthStorage } from 'angular-oauth2-oidc'; -import { AbpLocalStorageService, APP_STARTED_WITH_SSR } from '@abp/ng.core'; +import { APP_STARTED_WITH_SSR } from '@abp/ng.core'; export class MockStorage implements Storage { private data = new Map(); @@ -35,5 +35,5 @@ export function oAuthStorageFactory(): OAuthStorage { ? inject(BrowserTokenStorageService) : inject(ServerTokenStorageService); } - return inject(AbpLocalStorageService); + return inject(MemoryTokenStorageService); } diff --git a/npm/ng-packs/packages/permission-management/project.json b/npm/ng-packs/packages/permission-management/project.json index eb09ef6178..3e3287256d 100644 --- a/npm/ng-packs/packages/permission-management/project.json +++ b/npm/ng-packs/packages/permission-management/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/permission-management/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared"] + } } diff --git a/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/generate-proxy.json b/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/generate-proxy.json index dbdc934ed9..05e7c1c92d 100644 --- a/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/generate-proxy.json +++ b/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/generate-proxy.json @@ -3,37 +3,69 @@ "permissionManagement" ], "modules": { - "featureManagement": { - "rootPath": "featureManagement", - "remoteServiceName": "AbpFeatureManagement", + "abp": { + "rootPath": "abp", + "remoteServiceName": "abp", "controllers": { - "Volo.Abp.FeatureManagement.FeaturesController": { - "controllerName": "Features", - "controllerGroupName": "Features", - "type": "Volo.Abp.FeatureManagement.FeaturesController", + "Pages.Abp.MultiTenancy.AbpTenantController": { + "controllerName": "AbpTenant", + "controllerGroupName": "AbpTenant", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Pages.Abp.MultiTenancy.AbpTenantController", "interfaces": [ { - "type": "Volo.Abp.FeatureManagement.IFeatureAppService" + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService", + "name": "IAbpTenantAppService", + "methods": [ + { + "name": "FindTenantByNameAsync", + "parametersOnMethod": [ + { + "name": "name", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto" + } + }, + { + "name": "FindTenantByIdAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto" + } + } + ] } ], "actions": { - "GetAsyncByProviderNameAndProviderKey": { - "uniqueName": "GetAsyncByProviderNameAndProviderKey", - "name": "GetAsync", + "FindTenantByNameAsyncByName": { + "uniqueName": "FindTenantByNameAsyncByName", + "name": "FindTenantByNameAsync", "httpMethod": "GET", - "url": "api/feature-management/features", + "url": "api/abp/multi-tenancy/tenants/by-name/{name}", "supportedVersions": [], "parametersOnMethod": [ { - "name": "providerName", - "typeAsString": "System.String, System.Private.CoreLib", - "type": "System.String", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null - }, - { - "name": "providerKey", + "name": "name", "typeAsString": "System.String, System.Private.CoreLib", "type": "System.String", "typeSimple": "string", @@ -43,181 +75,229 @@ ], "parameters": [ { - "nameOnMethod": "providerName", - "name": "providerName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "ModelBinding", - "descriptorName": "" - }, - { - "nameOnMethod": "providerKey", - "name": "providerKey", + "nameOnMethod": "name", + "name": "name", "jsonName": null, "type": "System.String", "typeSimple": "string", "isOptional": false, "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "ModelBinding", + "constraintTypes": [], + "bindingSourceId": "Path", "descriptorName": "" } ], "returnValue": { - "type": "Volo.Abp.FeatureManagement.GetFeatureListResultDto", - "typeSimple": "Volo.Abp.FeatureManagement.GetFeatureListResultDto" + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.FeatureManagement.IFeatureAppService" + "implementFrom": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService" }, - "UpdateAsyncByProviderNameAndProviderKeyAndInput": { - "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", - "name": "UpdateAsync", - "httpMethod": "PUT", - "url": "api/feature-management/features", + "FindTenantByIdAsyncById": { + "uniqueName": "FindTenantByIdAsyncById", + "name": "FindTenantByIdAsync", + "httpMethod": "GET", + "url": "api/abp/multi-tenancy/tenants/by-id/{id}", "supportedVersions": [], "parametersOnMethod": [ { - "name": "providerName", - "typeAsString": "System.String, System.Private.CoreLib", - "type": "System.String", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null - }, - { - "name": "providerKey", - "typeAsString": "System.String, System.Private.CoreLib", - "type": "System.String", + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", "typeSimple": "string", "isOptional": false, "defaultValue": null - }, - { - "name": "input", - "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", - "type": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", - "typeSimple": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", - "isOptional": false, - "defaultValue": null } ], "parameters": [ { - "nameOnMethod": "providerName", - "name": "providerName", + "nameOnMethod": "id", + "name": "id", "jsonName": null, - "type": "System.String", + "type": "System.Guid", "typeSimple": "string", "isOptional": false, "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "ModelBinding", + "constraintTypes": [], + "bindingSourceId": "Path", "descriptorName": "" - }, + } + ], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService" + } + } + }, + "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { + "controllerName": "AbpApiDefinition", + "controllerGroupName": "AbpApiDefinition", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController", + "interfaces": [], + "actions": { + "GetByModel": { + "uniqueName": "GetByModel", + "name": "Get", + "httpMethod": "GET", + "url": "api/abp/api-definition", + "supportedVersions": [], + "parametersOnMethod": [ { - "nameOnMethod": "providerKey", - "name": "providerKey", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "name": "model", + "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto, Volo.Abp.Http", + "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", + "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "ModelBinding", - "descriptorName": "" - }, + "defaultValue": null + } + ], + "parameters": [ { - "nameOnMethod": "input", - "name": "input", + "nameOnMethod": "model", + "name": "IncludeTypes", "jsonName": null, - "type": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", - "typeSimple": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", + "type": "System.Boolean", + "typeSimple": "boolean", "isOptional": false, "defaultValue": null, "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" + "bindingSourceId": "ModelBinding", + "descriptorName": "model" } ], "returnValue": { - "type": "System.Void", - "typeSimple": "System.Void" + "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel", + "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.FeatureManagement.IFeatureAppService" + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController" } } - } - } - }, - "multi-tenancy": { - "rootPath": "multi-tenancy", - "remoteServiceName": "AbpTenantManagement", - "controllers": { - "Volo.Abp.TenantManagement.TenantController": { - "controllerName": "Tenant", - "controllerGroupName": "Tenant", - "type": "Volo.Abp.TenantManagement.TenantController", + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { + "controllerName": "AbpApplicationConfiguration", + "controllerGroupName": "AbpApplicationConfiguration", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController", "interfaces": [ { - "type": "Volo.Abp.TenantManagement.ITenantAppService" + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService", + "name": "IAbpApplicationConfigurationAppService", + "methods": [ + { + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "options", + "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions, Volo.Abp.AspNetCore.Mvc.Contracts", + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto" + } + } + ] } ], "actions": { - "GetAsyncById": { - "uniqueName": "GetAsyncById", + "GetAsyncByOptions": { + "uniqueName": "GetAsyncByOptions", "name": "GetAsync", "httpMethod": "GET", - "url": "api/multi-tenancy/tenants/{id}", + "url": "api/abp/application-configuration", "supportedVersions": [], "parametersOnMethod": [ { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", + "name": "options", + "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions, Volo.Abp.AspNetCore.Mvc.Contracts", + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions", "isOptional": false, "defaultValue": null } ], "parameters": [ { - "nameOnMethod": "id", - "name": "id", + "nameOnMethod": "options", + "name": "IncludeLocalizationResources", "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", + "type": "System.Boolean", + "typeSimple": "boolean", "isOptional": false, "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", - "descriptorName": "" + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "options" } ], "returnValue": { - "type": "Volo.Abp.TenantManagement.TenantDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Application.Services.IReadOnlyAppService" - }, - "GetListAsyncByInput": { - "uniqueName": "GetListAsyncByInput", - "name": "GetListAsync", + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" + } + } + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationLocalizationController": { + "controllerName": "AbpApplicationLocalization", + "controllerGroupName": "AbpApplicationLocalization", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationLocalizationController", + "interfaces": [ + { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationLocalizationAppService", + "name": "IAbpApplicationLocalizationAppService", + "methods": [ + { + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto, Volo.Abp.AspNetCore.Mvc.Contracts", + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationDto" + } + } + ] + } + ], + "actions": { + "GetAsyncByInput": { + "uniqueName": "GetAsyncByInput", + "name": "GetAsync", "httpMethod": "GET", - "url": "api/multi-tenancy/tenants", + "url": "api/abp/application-localization", "supportedVersions": [], "parametersOnMethod": [ { "name": "input", - "typeAsString": "Volo.Abp.TenantManagement.GetTenantsInput, Volo.Abp.TenantManagement.Application.Contracts", - "type": "Volo.Abp.TenantManagement.GetTenantsInput", - "typeSimple": "Volo.Abp.TenantManagement.GetTenantsInput", + "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto, Volo.Abp.AspNetCore.Mvc.Contracts", + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto", "isOptional": false, "defaultValue": null } @@ -225,7 +305,7 @@ "parameters": [ { "nameOnMethod": "input", - "name": "Filter", + "name": "CultureName", "jsonName": null, "type": "System.String", "typeSimple": "string", @@ -237,60 +317,165 @@ }, { "nameOnMethod": "input", - "name": "Sorting", + "name": "OnlyDynamics", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "System.Boolean", + "typeSimple": "boolean", "isOptional": false, "defaultValue": null, "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationLocalizationAppService" + } + } + } + } + }, + "account": { + "rootPath": "account", + "remoteServiceName": "AbpAccount", + "controllers": { + "Volo.Abp.Account.AccountController": { + "controllerName": "Account", + "controllerGroupName": "Account", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.Account.AccountController", + "interfaces": [ + { + "type": "Volo.Abp.Account.IAccountAppService", + "name": "IAccountAppService", + "methods": [ + { + "name": "RegisterAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.RegisterDto", + "typeSimple": "Volo.Abp.Account.RegisterDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" + } }, { - "nameOnMethod": "input", - "name": "SkipCount", - "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "ModelBinding", - "descriptorName": "input" + "name": "SendPasswordResetCodeAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.SendPasswordResetCodeDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.SendPasswordResetCodeDto", + "typeSimple": "Volo.Abp.Account.SendPasswordResetCodeDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } }, + { + "name": "VerifyPasswordResetTokenAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.VerifyPasswordResetTokenInput, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.VerifyPasswordResetTokenInput", + "typeSimple": "Volo.Abp.Account.VerifyPasswordResetTokenInput", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Boolean", + "typeSimple": "boolean" + } + }, + { + "name": "ResetPasswordAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.ResetPasswordDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.ResetPasswordDto", + "typeSimple": "Volo.Abp.Account.ResetPasswordDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "RegisterAsyncByInput": { + "uniqueName": "RegisterAsyncByInput", + "name": "RegisterAsync", + "httpMethod": "POST", + "url": "api/account/register", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.RegisterDto", + "typeSimple": "Volo.Abp.Account.RegisterDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ { "nameOnMethod": "input", - "name": "MaxResultCount", + "name": "input", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", + "type": "Volo.Abp.Account.RegisterDto", + "typeSimple": "Volo.Abp.Account.RegisterDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, - "bindingSourceId": "ModelBinding", - "descriptorName": "input" + "bindingSourceId": "Body", + "descriptorName": "" } ], "returnValue": { - "type": "Volo.Abp.Application.Dtos.PagedResultDto", - "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Application.Services.IReadOnlyAppService" + "implementFrom": "Volo.Abp.Account.IAccountAppService" }, - "CreateAsyncByInput": { - "uniqueName": "CreateAsyncByInput", - "name": "CreateAsync", + "SendPasswordResetCodeAsyncByInput": { + "uniqueName": "SendPasswordResetCodeAsyncByInput", + "name": "SendPasswordResetCodeAsync", "httpMethod": "POST", - "url": "api/multi-tenancy/tenants", + "url": "api/account/send-password-reset-code", "supportedVersions": [], "parametersOnMethod": [ { "name": "input", - "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", - "type": "Volo.Abp.TenantManagement.TenantCreateDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantCreateDto", + "typeAsString": "Volo.Abp.Account.SendPasswordResetCodeDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.SendPasswordResetCodeDto", + "typeSimple": "Volo.Abp.Account.SendPasswordResetCodeDto", "isOptional": false, "defaultValue": null } @@ -300,8 +485,8 @@ "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "Volo.Abp.TenantManagement.TenantCreateDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantCreateDto", + "type": "Volo.Abp.Account.SendPasswordResetCodeDto", + "typeSimple": "Volo.Abp.Account.SendPasswordResetCodeDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -310,55 +495,35 @@ } ], "returnValue": { - "type": "Volo.Abp.TenantManagement.TenantDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + "type": "System.Void", + "typeSimple": "System.Void" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Application.Services.ICreateAppService" + "implementFrom": "Volo.Abp.Account.IAccountAppService" }, - "UpdateAsyncByIdAndInput": { - "uniqueName": "UpdateAsyncByIdAndInput", - "name": "UpdateAsync", - "httpMethod": "PUT", - "url": "api/multi-tenancy/tenants/{id}", + "VerifyPasswordResetTokenAsyncByInput": { + "uniqueName": "VerifyPasswordResetTokenAsyncByInput", + "name": "VerifyPasswordResetTokenAsync", + "httpMethod": "POST", + "url": "api/account/verify-password-reset-token", "supportedVersions": [], "parametersOnMethod": [ - { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null - }, { "name": "input", - "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", - "type": "Volo.Abp.TenantManagement.TenantUpdateDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantUpdateDto", + "typeAsString": "Volo.Abp.Account.VerifyPasswordResetTokenInput, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.VerifyPasswordResetTokenInput", + "typeSimple": "Volo.Abp.Account.VerifyPasswordResetTokenInput", "isOptional": false, "defaultValue": null } ], "parameters": [ - { - "nameOnMethod": "id", - "name": "id", - "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", - "descriptorName": "" - }, { "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "Volo.Abp.TenantManagement.TenantUpdateDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantUpdateDto", + "type": "Volo.Abp.Account.VerifyPasswordResetTokenInput", + "typeSimple": "Volo.Abp.Account.VerifyPasswordResetTokenInput", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -367,39 +532,39 @@ } ], "returnValue": { - "type": "Volo.Abp.TenantManagement.TenantDto", - "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + "type": "System.Boolean", + "typeSimple": "boolean" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Application.Services.IUpdateAppService" + "implementFrom": "Volo.Abp.Account.IAccountAppService" }, - "DeleteAsyncById": { - "uniqueName": "DeleteAsyncById", - "name": "DeleteAsync", - "httpMethod": "DELETE", - "url": "api/multi-tenancy/tenants/{id}", + "ResetPasswordAsyncByInput": { + "uniqueName": "ResetPasswordAsyncByInput", + "name": "ResetPasswordAsync", + "httpMethod": "POST", + "url": "api/account/reset-password", "supportedVersions": [], "parametersOnMethod": [ { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", + "name": "input", + "typeAsString": "Volo.Abp.Account.ResetPasswordDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.ResetPasswordDto", + "typeSimple": "Volo.Abp.Account.ResetPasswordDto", "isOptional": false, "defaultValue": null } ], "parameters": [ { - "nameOnMethod": "id", - "name": "id", + "nameOnMethod": "input", + "name": "input", "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", + "type": "Volo.Abp.Account.ResetPasswordDto", + "typeSimple": "Volo.Abp.Account.ResetPasswordDto", "isOptional": false, "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", + "constraintTypes": null, + "bindingSourceId": "Body", "descriptorName": "" } ], @@ -408,92 +573,188 @@ "typeSimple": "System.Void" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Application.Services.IDeleteAppService" - }, - "GetDefaultConnectionStringAsyncById": { - "uniqueName": "GetDefaultConnectionStringAsyncById", - "name": "GetDefaultConnectionStringAsync", + "implementFrom": "Volo.Abp.Account.IAccountAppService" + } + } + }, + "Volo.Abp.Account.DynamicClaimsController": { + "controllerName": "DynamicClaims", + "controllerGroupName": "DynamicClaims", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.Account.DynamicClaimsController", + "interfaces": [ + { + "type": "Volo.Abp.Account.IDynamicClaimsAppService", + "name": "IDynamicClaimsAppService", + "methods": [ + { + "name": "RefreshAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "RefreshAsync": { + "uniqueName": "RefreshAsync", + "name": "RefreshAsync", + "httpMethod": "POST", + "url": "api/account/dynamic-claims/refresh", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Account.IDynamicClaimsAppService" + } + } + }, + "Volo.Abp.Account.ProfileController": { + "controllerName": "Profile", + "controllerGroupName": "Profile", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.Account.ProfileController", + "interfaces": [ + { + "type": "Volo.Abp.Account.IProfileAppService", + "name": "IProfileAppService", + "methods": [ + { + "name": "GetAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "Volo.Abp.Account.ProfileDto", + "typeSimple": "Volo.Abp.Account.ProfileDto" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.UpdateProfileDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.UpdateProfileDto", + "typeSimple": "Volo.Abp.Account.UpdateProfileDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Account.ProfileDto", + "typeSimple": "Volo.Abp.Account.ProfileDto" + } + }, + { + "name": "ChangePasswordAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Account.ChangePasswordInput, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.ChangePasswordInput", + "typeSimple": "Volo.Abp.Account.ChangePasswordInput", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "GetAsync": { + "uniqueName": "GetAsync", + "name": "GetAsync", "httpMethod": "GET", - "url": "api/multi-tenancy/tenants/{id}/default-connection-string", + "url": "api/account/my-profile", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.Abp.Account.ProfileDto", + "typeSimple": "Volo.Abp.Account.ProfileDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Account.IProfileAppService" + }, + "UpdateAsyncByInput": { + "uniqueName": "UpdateAsyncByInput", + "name": "UpdateAsync", + "httpMethod": "PUT", + "url": "api/account/my-profile", "supportedVersions": [], "parametersOnMethod": [ { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", + "name": "input", + "typeAsString": "Volo.Abp.Account.UpdateProfileDto, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.UpdateProfileDto", + "typeSimple": "Volo.Abp.Account.UpdateProfileDto", "isOptional": false, "defaultValue": null } ], "parameters": [ { - "nameOnMethod": "id", - "name": "id", + "nameOnMethod": "input", + "name": "input", "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", + "type": "Volo.Abp.Account.UpdateProfileDto", + "typeSimple": "Volo.Abp.Account.UpdateProfileDto", "isOptional": false, "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", + "constraintTypes": null, + "bindingSourceId": "Body", "descriptorName": "" } ], "returnValue": { - "type": "System.String", - "typeSimple": "string" + "type": "Volo.Abp.Account.ProfileDto", + "typeSimple": "Volo.Abp.Account.ProfileDto" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.TenantManagement.ITenantAppService" + "implementFrom": "Volo.Abp.Account.IProfileAppService" }, - "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString": { - "uniqueName": "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString", - "name": "UpdateDefaultConnectionStringAsync", - "httpMethod": "PUT", - "url": "api/multi-tenancy/tenants/{id}/default-connection-string", + "ChangePasswordAsyncByInput": { + "uniqueName": "ChangePasswordAsyncByInput", + "name": "ChangePasswordAsync", + "httpMethod": "POST", + "url": "api/account/my-profile/change-password", "supportedVersions": [], "parametersOnMethod": [ { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null - }, - { - "name": "defaultConnectionString", - "typeAsString": "System.String, System.Private.CoreLib", - "type": "System.String", - "typeSimple": "string", + "name": "input", + "typeAsString": "Volo.Abp.Account.ChangePasswordInput, Volo.Abp.Account.Application.Contracts", + "type": "Volo.Abp.Account.ChangePasswordInput", + "typeSimple": "Volo.Abp.Account.ChangePasswordInput", "isOptional": false, "defaultValue": null } ], "parameters": [ { - "nameOnMethod": "id", - "name": "id", - "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", - "descriptorName": "" - }, - { - "nameOnMethod": "defaultConnectionString", - "name": "defaultConnectionString", + "nameOnMethod": "input", + "name": "input", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "Volo.Abp.Account.ChangePasswordInput", + "typeSimple": "Volo.Abp.Account.ChangePasswordInput", "isOptional": false, "defaultValue": null, "constraintTypes": null, - "bindingSourceId": "ModelBinding", + "bindingSourceId": "Body", "descriptorName": "" } ], @@ -502,179 +763,16 @@ "typeSimple": "System.Void" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.TenantManagement.ITenantAppService" - }, - "DeleteDefaultConnectionStringAsyncById": { - "uniqueName": "DeleteDefaultConnectionStringAsyncById", - "name": "DeleteDefaultConnectionStringAsync", - "httpMethod": "DELETE", - "url": "api/multi-tenancy/tenants/{id}/default-connection-string", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ - { - "nameOnMethod": "id", - "name": "id", - "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", - "descriptorName": "" - } - ], - "returnValue": { - "type": "System.Void", - "typeSimple": "System.Void" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.TenantManagement.ITenantAppService" - } - } - } - } - }, - "account": { - "rootPath": "account", - "remoteServiceName": "AbpAccount", - "controllers": { - "Volo.Abp.Account.AccountController": { - "controllerName": "Account", - "controllerGroupName": "Account", - "type": "Volo.Abp.Account.AccountController", - "interfaces": [ - { - "type": "Volo.Abp.Account.IAccountAppService" - } - ], - "actions": { - "RegisterAsyncByInput": { - "uniqueName": "RegisterAsyncByInput", - "name": "RegisterAsync", - "httpMethod": "POST", - "url": "api/account/register", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "input", - "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", - "type": "Volo.Abp.Account.RegisterDto", - "typeSimple": "Volo.Abp.Account.RegisterDto", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ - { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "Volo.Abp.Account.RegisterDto", - "typeSimple": "Volo.Abp.Account.RegisterDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" - } - ], - "returnValue": { - "type": "Volo.Abp.Identity.IdentityUserDto", - "typeSimple": "Volo.Abp.Identity.IdentityUserDto" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.Account.IAccountAppService" - }, - "SendPasswordResetCodeAsyncByInput": { - "uniqueName": "SendPasswordResetCodeAsyncByInput", - "name": "SendPasswordResetCodeAsync", - "httpMethod": "POST", - "url": "api/account/send-password-reset-code", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "input", - "typeAsString": "Volo.Abp.Account.SendPasswordResetCodeDto, Volo.Abp.Account.Application.Contracts", - "type": "Volo.Abp.Account.SendPasswordResetCodeDto", - "typeSimple": "Volo.Abp.Account.SendPasswordResetCodeDto", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ - { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "Volo.Abp.Account.SendPasswordResetCodeDto", - "typeSimple": "Volo.Abp.Account.SendPasswordResetCodeDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" - } - ], - "returnValue": { - "type": "System.Void", - "typeSimple": "System.Void" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.Account.IAccountAppService" - }, - "ResetPasswordAsyncByInput": { - "uniqueName": "ResetPasswordAsyncByInput", - "name": "ResetPasswordAsync", - "httpMethod": "POST", - "url": "api/account/reset-password", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "input", - "typeAsString": "Volo.Abp.Account.ResetPasswordDto, Volo.Abp.Account.Application.Contracts", - "type": "Volo.Abp.Account.ResetPasswordDto", - "typeSimple": "Volo.Abp.Account.ResetPasswordDto", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ - { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "Volo.Abp.Account.ResetPasswordDto", - "typeSimple": "Volo.Abp.Account.ResetPasswordDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" - } - ], - "returnValue": { - "type": "System.Void", - "typeSimple": "System.Void" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.Account.IAccountAppService" + "implementFrom": "Volo.Abp.Account.IProfileAppService" } } }, "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController": { "controllerName": "Account", "controllerGroupName": "Login", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, "type": "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController", "interfaces": [], "actions": { @@ -771,87 +869,106 @@ } } }, - "settingManagement": { - "rootPath": "settingManagement", - "remoteServiceName": "SettingManagement", + "featureManagement": { + "rootPath": "featureManagement", + "remoteServiceName": "AbpFeatureManagement", "controllers": { - "Volo.Abp.SettingManagement.EmailSettingsController": { - "controllerName": "EmailSettings", - "controllerGroupName": "EmailSettings", - "type": "Volo.Abp.SettingManagement.EmailSettingsController", + "Volo.Abp.FeatureManagement.FeaturesController": { + "controllerName": "Features", + "controllerGroupName": "Features", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.FeatureManagement.FeaturesController", "interfaces": [ { - "type": "Volo.Abp.SettingManagement.IEmailSettingsAppService" - } - ], - "actions": { - "GetAsync": { - "uniqueName": "GetAsync", - "name": "GetAsync", - "httpMethod": "GET", - "url": "api/setting-management/emailing", - "supportedVersions": [], - "parametersOnMethod": [], - "parameters": [], - "returnValue": { - "type": "Volo.Abp.SettingManagement.EmailSettingsDto", - "typeSimple": "Volo.Abp.SettingManagement.EmailSettingsDto" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.SettingManagement.IEmailSettingsAppService" - }, - "UpdateAsyncByInput": { - "uniqueName": "UpdateAsyncByInput", - "name": "UpdateAsync", - "httpMethod": "POST", - "url": "api/setting-management/emailing", - "supportedVersions": [], - "parametersOnMethod": [ + "type": "Volo.Abp.FeatureManagement.IFeatureAppService", + "name": "IFeatureAppService", + "methods": [ { - "name": "input", - "typeAsString": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto, Volo.Abp.SettingManagement.Application.Contracts", - "type": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", - "typeSimple": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.FeatureManagement.GetFeatureListResultDto", + "typeSimple": "Volo.Abp.FeatureManagement.GetFeatureListResultDto" + } + }, { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", - "typeSimple": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", + "type": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", + "typeSimple": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "DeleteAsync", + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } } - ], - "returnValue": { - "type": "System.Void", - "typeSimple": "System.Void" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.SettingManagement.IEmailSettingsAppService" - } - } - } - } - }, - "permissionManagement": { - "rootPath": "permissionManagement", - "remoteServiceName": "AbpPermissionManagement", - "controllers": { - "Volo.Abp.PermissionManagement.PermissionsController": { - "controllerName": "Permissions", - "controllerGroupName": "Permissions", - "type": "Volo.Abp.PermissionManagement.PermissionsController", - "interfaces": [ - { - "type": "Volo.Abp.PermissionManagement.IPermissionAppService" + ] } ], "actions": { @@ -859,7 +976,7 @@ "uniqueName": "GetAsyncByProviderNameAndProviderKey", "name": "GetAsync", "httpMethod": "GET", - "url": "api/permission-management/permissions", + "url": "api/feature-management/features", "supportedVersions": [], "parametersOnMethod": [ { @@ -906,17 +1023,17 @@ } ], "returnValue": { - "type": "Volo.Abp.PermissionManagement.GetPermissionListResultDto", - "typeSimple": "Volo.Abp.PermissionManagement.GetPermissionListResultDto" + "type": "Volo.Abp.FeatureManagement.GetFeatureListResultDto", + "typeSimple": "Volo.Abp.FeatureManagement.GetFeatureListResultDto" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + "implementFrom": "Volo.Abp.FeatureManagement.IFeatureAppService" }, "UpdateAsyncByProviderNameAndProviderKeyAndInput": { "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", "name": "UpdateAsync", "httpMethod": "PUT", - "url": "api/permission-management/permissions", + "url": "api/feature-management/features", "supportedVersions": [], "parametersOnMethod": [ { @@ -937,9 +1054,9 @@ }, { "name": "input", - "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", - "type": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", - "typeSimple": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", + "type": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", + "typeSimple": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", "isOptional": false, "defaultValue": null } @@ -973,8 +1090,8 @@ "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", - "typeSimple": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "type": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", + "typeSimple": "Volo.Abp.FeatureManagement.UpdateFeaturesDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -987,171 +1104,64 @@ "typeSimple": "System.Void" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" - } - } - } - } - }, - "abp": { - "rootPath": "abp", - "remoteServiceName": "abp", - "controllers": { - "Pages.Abp.MultiTenancy.AbpTenantController": { - "controllerName": "AbpTenant", - "controllerGroupName": "AbpTenant", - "type": "Pages.Abp.MultiTenancy.AbpTenantController", - "interfaces": [ - { - "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService" - } - ], - "actions": { - "FindTenantByNameAsyncByName": { - "uniqueName": "FindTenantByNameAsyncByName", - "name": "FindTenantByNameAsync", - "httpMethod": "GET", - "url": "api/abp/multi-tenancy/tenants/by-name/{name}", + "implementFrom": "Volo.Abp.FeatureManagement.IFeatureAppService" + }, + "DeleteAsyncByProviderNameAndProviderKey": { + "uniqueName": "DeleteAsyncByProviderNameAndProviderKey", + "name": "DeleteAsync", + "httpMethod": "DELETE", + "url": "api/feature-management/features", "supportedVersions": [], "parametersOnMethod": [ { - "name": "name", + "name": "providerName", "typeAsString": "System.String, System.Private.CoreLib", "type": "System.String", "typeSimple": "string", "isOptional": false, "defaultValue": null - } - ], - "parameters": [ + }, { - "nameOnMethod": "name", - "name": "name", - "jsonName": null, + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", "type": "System.String", "typeSimple": "string", "isOptional": false, - "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", - "descriptorName": "" - } - ], - "returnValue": { - "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService" - }, - "FindTenantByIdAsyncById": { - "uniqueName": "FindTenantByIdAsyncById", - "name": "FindTenantByIdAsync", - "httpMethod": "GET", - "url": "api/abp/multi-tenancy/tenants/by-id/{id}", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "id", - "typeAsString": "System.Guid, System.Private.CoreLib", - "type": "System.Guid", - "typeSimple": "string", - "isOptional": false, "defaultValue": null } ], "parameters": [ { - "nameOnMethod": "id", - "name": "id", + "nameOnMethod": "providerName", + "name": "providerName", "jsonName": null, - "type": "System.Guid", + "type": "System.String", "typeSimple": "string", "isOptional": false, "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", + "constraintTypes": null, + "bindingSourceId": "ModelBinding", "descriptorName": "" - } - ], - "returnValue": { - "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService" - } - } - }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { - "controllerName": "AbpApplicationConfiguration", - "controllerGroupName": "AbpApplicationConfiguration", - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController", - "interfaces": [ - { - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" - } - ], - "actions": { - "GetAsync": { - "uniqueName": "GetAsync", - "name": "GetAsync", - "httpMethod": "GET", - "url": "api/abp/application-configuration", - "supportedVersions": [], - "parametersOnMethod": [], - "parameters": [], - "returnValue": { - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" - } - } - }, - "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { - "controllerName": "AbpApiDefinition", - "controllerGroupName": "AbpApiDefinition", - "type": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController", - "interfaces": [], - "actions": { - "GetByModel": { - "uniqueName": "GetByModel", - "name": "Get", - "httpMethod": "GET", - "url": "api/abp/api-definition", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "model", - "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto, Volo.Abp.Http", - "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", - "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ + }, { - "nameOnMethod": "model", - "name": "IncludeTypes", + "nameOnMethod": "providerKey", + "name": "providerKey", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", + "type": "System.String", + "typeSimple": "string", "isOptional": false, "defaultValue": null, "constraintTypes": null, "bindingSourceId": "ModelBinding", - "descriptorName": "model" + "descriptorName": "" } ], "returnValue": { - "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel", - "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel" + "type": "System.Void", + "typeSimple": "System.Void" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController" + "implementFrom": "Volo.Abp.FeatureManagement.IFeatureAppService" } } } @@ -1164,10 +1174,117 @@ "Volo.Abp.Identity.IdentityRoleController": { "controllerName": "IdentityRole", "controllerGroupName": "Role", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, "type": "Volo.Abp.Identity.IdentityRoleController", "interfaces": [ { - "type": "Volo.Abp.Identity.IIdentityRoleAppService" + "type": "Volo.Abp.Identity.IIdentityRoleAppService", + "name": "IIdentityRoleAppService", + "methods": [ + { + "name": "GetAllListAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, + { + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityRoleDto", + "typeSimple": "Volo.Abp.Identity.IdentityRoleDto" + } + }, + { + "name": "GetListAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.GetIdentityRolesInput, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.GetIdentityRolesInput", + "typeSimple": "Volo.Abp.Identity.GetIdentityRolesInput", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + } + }, + { + "name": "CreateAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.IdentityRoleCreateDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.IdentityRoleCreateDto", + "typeSimple": "Volo.Abp.Identity.IdentityRoleCreateDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityRoleDto", + "typeSimple": "Volo.Abp.Identity.IdentityRoleDto" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.IdentityRoleUpdateDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.IdentityRoleUpdateDto", + "typeSimple": "Volo.Abp.Identity.IdentityRoleUpdateDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityRoleDto", + "typeSimple": "Volo.Abp.Identity.IdentityRoleDto" + } + }, + { + "name": "DeleteAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] } ], "actions": { @@ -1250,6 +1367,18 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { @@ -1432,10 +1561,193 @@ "Volo.Abp.Identity.IdentityUserController": { "controllerName": "IdentityUser", "controllerGroupName": "User", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, "type": "Volo.Abp.Identity.IdentityUserController", "interfaces": [ { - "type": "Volo.Abp.Identity.IIdentityUserAppService" + "type": "Volo.Abp.Identity.IIdentityUserAppService", + "name": "IIdentityUserAppService", + "methods": [ + { + "name": "GetRolesAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, + { + "name": "GetAssignableRolesAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, + { + "name": "UpdateRolesAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateRolesDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.IdentityUserUpdateRolesDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserUpdateRolesDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "FindByUsernameAsync", + "parametersOnMethod": [ + { + "name": "userName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" + } + }, + { + "name": "FindByEmailAsync", + "parametersOnMethod": [ + { + "name": "email", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" + } + }, + { + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" + } + }, + { + "name": "GetListAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.GetIdentityUsersInput, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.GetIdentityUsersInput", + "typeSimple": "Volo.Abp.Identity.GetIdentityUsersInput", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + } + }, + { + "name": "CreateAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.IdentityUserCreateDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.IdentityUserCreateDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserCreateDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.IdentityUserUpdateDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserUpdateDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Identity.IdentityUserDto", + "typeSimple": "Volo.Abp.Identity.IdentityUserDto" + } + }, + { + "name": "DeleteAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] } ], "actions": { @@ -1540,6 +1852,18 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { @@ -1868,10 +2192,84 @@ "Volo.Abp.Identity.IdentityUserLookupController": { "controllerName": "IdentityUserLookup", "controllerGroupName": "UserLookup", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, "type": "Volo.Abp.Identity.IdentityUserLookupController", "interfaces": [ { - "type": "Volo.Abp.Identity.IIdentityUserLookupAppService" + "type": "Volo.Abp.Identity.IIdentityUserLookupAppService", + "name": "IIdentityUserLookupAppService", + "methods": [ + { + "name": "FindByIdAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Users.UserData", + "typeSimple": "Volo.Abp.Users.UserData" + } + }, + { + "name": "FindByUserNameAsync", + "parametersOnMethod": [ + { + "name": "userName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Users.UserData", + "typeSimple": "Volo.Abp.Users.UserData" + } + }, + { + "name": "SearchAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.UserLookupSearchInputDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.UserLookupSearchInputDto", + "typeSimple": "Volo.Abp.Identity.UserLookupSearchInputDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.ListResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.ListResultDto" + } + }, + { + "name": "GetCountAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Identity.UserLookupCountInputDto, Volo.Abp.Identity.Application.Contracts", + "type": "Volo.Abp.Identity.UserLookupCountInputDto", + "typeSimple": "Volo.Abp.Identity.UserLookupCountInputDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Int64", + "typeSimple": "number" + } + } + ] } ], "actions": { @@ -2013,6 +2411,18 @@ "constraintTypes": null, "bindingSourceId": "ModelBinding", "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "ExtraProperties", + "jsonName": null, + "type": "Volo.Abp.Data.ExtraPropertyDictionary", + "typeSimple": "{string:object}", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" } ], "returnValue": { @@ -2060,44 +2470,303 @@ "implementFrom": "Volo.Abp.Identity.IIdentityUserLookupAppService" } } - }, - "Volo.Abp.Identity.ProfileController": { - "controllerName": "Profile", - "controllerGroupName": "Profile", - "type": "Volo.Abp.Identity.ProfileController", + } + } + }, + "multi-tenancy": { + "rootPath": "multi-tenancy", + "remoteServiceName": "AbpTenantManagement", + "controllers": { + "Volo.Abp.TenantManagement.TenantController": { + "controllerName": "Tenant", + "controllerGroupName": "Tenant", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.TenantManagement.TenantController", "interfaces": [ { - "type": "Volo.Abp.Identity.IProfileAppService" - } - ], - "actions": { - "GetAsync": { - "uniqueName": "GetAsync", - "name": "GetAsync", - "httpMethod": "GET", - "url": "api/identity/my-profile", - "supportedVersions": [], - "parametersOnMethod": [], - "parameters": [], - "returnValue": { - "type": "Volo.Abp.Identity.ProfileDto", - "typeSimple": "Volo.Abp.Identity.ProfileDto" - }, + "type": "Volo.Abp.TenantManagement.ITenantAppService", + "name": "ITenantAppService", + "methods": [ + { + "name": "GetDefaultConnectionStringAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.String", + "typeSimple": "string" + } + }, + { + "name": "UpdateDefaultConnectionStringAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "defaultConnectionString", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "DeleteDefaultConnectionStringAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.TenantManagement.TenantDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + } + }, + { + "name": "GetListAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.TenantManagement.GetTenantsInput, Volo.Abp.TenantManagement.Application.Contracts", + "type": "Volo.Abp.TenantManagement.GetTenantsInput", + "typeSimple": "Volo.Abp.TenantManagement.GetTenantsInput", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + } + }, + { + "name": "CreateAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", + "type": "Volo.Abp.TenantManagement.TenantCreateDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantCreateDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.TenantManagement.TenantDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", + "type": "Volo.Abp.TenantManagement.TenantUpdateDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantUpdateDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.TenantManagement.TenantDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + } + }, + { + "name": "DeleteAsync", + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "GetAsyncById": { + "uniqueName": "GetAsyncById", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/multi-tenancy/tenants/{id}", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.TenantManagement.TenantDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Identity.IProfileAppService" + "implementFrom": "Volo.Abp.Application.Services.IReadOnlyAppService" }, - "UpdateAsyncByInput": { - "uniqueName": "UpdateAsyncByInput", - "name": "UpdateAsync", - "httpMethod": "PUT", - "url": "api/identity/my-profile", + "GetListAsyncByInput": { + "uniqueName": "GetListAsyncByInput", + "name": "GetListAsync", + "httpMethod": "GET", + "url": "api/multi-tenancy/tenants", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.TenantManagement.GetTenantsInput, Volo.Abp.TenantManagement.Application.Contracts", + "type": "Volo.Abp.TenantManagement.GetTenantsInput", + "typeSimple": "Volo.Abp.TenantManagement.GetTenantsInput", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "Sorting", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Application.Services.IReadOnlyAppService" + }, + "CreateAsyncByInput": { + "uniqueName": "CreateAsyncByInput", + "name": "CreateAsync", + "httpMethod": "POST", + "url": "api/multi-tenancy/tenants", "supportedVersions": [], "parametersOnMethod": [ { "name": "input", - "typeAsString": "Volo.Abp.Identity.UpdateProfileDto, Volo.Abp.Identity.Application.Contracts", - "type": "Volo.Abp.Identity.UpdateProfileDto", - "typeSimple": "Volo.Abp.Identity.UpdateProfileDto", + "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", + "type": "Volo.Abp.TenantManagement.TenantCreateDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantCreateDto", "isOptional": false, "defaultValue": null } @@ -2107,8 +2776,8 @@ "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "Volo.Abp.Identity.UpdateProfileDto", - "typeSimple": "Volo.Abp.Identity.UpdateProfileDto", + "type": "Volo.Abp.TenantManagement.TenantCreateDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantCreateDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -2117,35 +2786,55 @@ } ], "returnValue": { - "type": "Volo.Abp.Identity.ProfileDto", - "typeSimple": "Volo.Abp.Identity.ProfileDto" + "type": "Volo.Abp.TenantManagement.TenantDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantDto" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Identity.IProfileAppService" + "implementFrom": "Volo.Abp.Application.Services.ICreateAppService" }, - "ChangePasswordAsyncByInput": { - "uniqueName": "ChangePasswordAsyncByInput", - "name": "ChangePasswordAsync", - "httpMethod": "POST", - "url": "api/identity/my-profile/change-password", + "UpdateAsyncByIdAndInput": { + "uniqueName": "UpdateAsyncByIdAndInput", + "name": "UpdateAsync", + "httpMethod": "PUT", + "url": "api/multi-tenancy/tenants/{id}", "supportedVersions": [], "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, { "name": "input", - "typeAsString": "Volo.Abp.Identity.ChangePasswordInput, Volo.Abp.Identity.Application.Contracts", - "type": "Volo.Abp.Identity.ChangePasswordInput", - "typeSimple": "Volo.Abp.Identity.ChangePasswordInput", + "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", + "type": "Volo.Abp.TenantManagement.TenantUpdateDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantUpdateDto", "isOptional": false, "defaultValue": null } ], "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + }, { "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "Volo.Abp.Identity.ChangePasswordInput", - "typeSimple": "Volo.Abp.Identity.ChangePasswordInput", + "type": "Volo.Abp.TenantManagement.TenantUpdateDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantUpdateDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -2153,259 +2842,2882 @@ "descriptorName": "" } ], + "returnValue": { + "type": "Volo.Abp.TenantManagement.TenantDto", + "typeSimple": "Volo.Abp.TenantManagement.TenantDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.Application.Services.IUpdateAppService" + }, + "DeleteAsyncById": { + "uniqueName": "DeleteAsyncById", + "name": "DeleteAsync", + "httpMethod": "DELETE", + "url": "api/multi-tenancy/tenants/{id}", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], "returnValue": { "type": "System.Void", "typeSimple": "System.Void" }, "allowAnonymous": null, - "implementFrom": "Volo.Abp.Identity.IProfileAppService" - } - } + "implementFrom": "Volo.Abp.Application.Services.IDeleteAppService" + }, + "GetDefaultConnectionStringAsyncById": { + "uniqueName": "GetDefaultConnectionStringAsyncById", + "name": "GetDefaultConnectionStringAsync", + "httpMethod": "GET", + "url": "api/multi-tenancy/tenants/{id}/default-connection-string", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.String", + "typeSimple": "string" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.TenantManagement.ITenantAppService" + }, + "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString": { + "uniqueName": "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString", + "name": "UpdateDefaultConnectionStringAsync", + "httpMethod": "PUT", + "url": "api/multi-tenancy/tenants/{id}/default-connection-string", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "defaultConnectionString", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + }, + { + "nameOnMethod": "defaultConnectionString", + "name": "defaultConnectionString", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.TenantManagement.ITenantAppService" + }, + "DeleteDefaultConnectionStringAsyncById": { + "uniqueName": "DeleteDefaultConnectionStringAsyncById", + "name": "DeleteDefaultConnectionStringAsync", + "httpMethod": "DELETE", + "url": "api/multi-tenancy/tenants/{id}/default-connection-string", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.TenantManagement.ITenantAppService" + } + } + } + } + }, + "permissionManagement": { + "rootPath": "permissionManagement", + "remoteServiceName": "AbpPermissionManagement", + "controllers": { + "Volo.Abp.PermissionManagement.PermissionsController": { + "controllerName": "Permissions", + "controllerGroupName": "Permissions", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.PermissionManagement.PermissionsController", + "interfaces": [ + { + "type": "Volo.Abp.PermissionManagement.IPermissionAppService", + "name": "IPermissionAppService", + "methods": [ + { + "name": "GetAsync", + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetPermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetPermissionListResultDto" + } + }, + { + "name": "GetByGroupAsync", + "parametersOnMethod": [ + { + "name": "groupName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetPermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetPermissionListResultDto" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", + "type": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "GetResourceProviderKeyLookupServicesAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto" + } + }, + { + "name": "SearchResourceProviderKeyAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "serviceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "filter", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "page", + "typeAsString": "System.Int32, System.Private.CoreLib", + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto" + } + }, + { + "name": "GetResourceDefinitionsAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto" + } + }, + { + "name": "GetResourceAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto" + } + }, + { + "name": "GetResourceByProviderAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto" + } + }, + { + "name": "UpdateResourceAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", + "type": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "DeleteResourceAsync", + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "GetAsyncByProviderNameAndProviderKey": { + "uniqueName": "GetAsyncByProviderNameAndProviderKey", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetPermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetPermissionListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetByGroupAsyncByGroupNameAndProviderNameAndProviderKey": { + "uniqueName": "GetByGroupAsyncByGroupNameAndProviderNameAndProviderKey", + "name": "GetByGroupAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/by-group", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "groupName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "groupName", + "name": "groupName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetPermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetPermissionListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "UpdateAsyncByProviderNameAndProviderKeyAndInput": { + "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", + "name": "UpdateAsync", + "httpMethod": "PUT", + "url": "api/permission-management/permissions", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", + "type": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdatePermissionsDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceProviderKeyLookupServicesAsyncByResourceName": { + "uniqueName": "GetResourceProviderKeyLookupServicesAsyncByResourceName", + "name": "GetResourceProviderKeyLookupServicesAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource-provider-key-lookup-services", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "SearchResourceProviderKeyAsyncByResourceNameAndServiceNameAndFilterAndPage": { + "uniqueName": "SearchResourceProviderKeyAsyncByResourceNameAndServiceNameAndFilterAndPage", + "name": "SearchResourceProviderKeyAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/search-resource-provider-keys", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "serviceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "filter", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "page", + "typeAsString": "System.Int32, System.Private.CoreLib", + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "serviceName", + "name": "serviceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "filter", + "name": "filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "page", + "name": "page", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceDefinitionsAsyncByResourceName": { + "uniqueName": "GetResourceDefinitionsAsyncByResourceName", + "name": "GetResourceDefinitionsAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource-definitions", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceAsyncByResourceNameAndResourceKey": { + "uniqueName": "GetResourceAsyncByResourceNameAndResourceKey", + "name": "GetResourceAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "GetResourceByProviderAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey": { + "uniqueName": "GetResourceByProviderAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey", + "name": "GetResourceByProviderAsync", + "httpMethod": "GET", + "url": "api/permission-management/permissions/resource/by-provider", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto", + "typeSimple": "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "UpdateResourceAsyncByResourceNameAndResourceKeyAndInput": { + "uniqueName": "UpdateResourceAsyncByResourceNameAndResourceKeyAndInput", + "name": "UpdateResourceAsync", + "httpMethod": "PUT", + "url": "api/permission-management/permissions/resource", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", + "type": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "typeSimple": "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + }, + "DeleteResourceAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey": { + "uniqueName": "DeleteResourceAsyncByResourceNameAndResourceKeyAndProviderNameAndProviderKey", + "name": "DeleteResourceAsync", + "httpMethod": "DELETE", + "url": "api/permission-management/permissions/resource", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "resourceName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "resourceKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "providerKey", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "resourceName", + "name": "resourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "resourceKey", + "name": "resourceKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerName", + "name": "providerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "providerKey", + "name": "providerKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.PermissionManagement.IPermissionAppService" + } + } + } + } + }, + "settingManagement": { + "rootPath": "settingManagement", + "remoteServiceName": "SettingManagement", + "controllers": { + "Volo.Abp.SettingManagement.EmailSettingsController": { + "controllerName": "EmailSettings", + "controllerGroupName": "EmailSettings", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.SettingManagement.EmailSettingsController", + "interfaces": [ + { + "type": "Volo.Abp.SettingManagement.IEmailSettingsAppService", + "name": "IEmailSettingsAppService", + "methods": [ + { + "name": "GetAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "Volo.Abp.SettingManagement.EmailSettingsDto", + "typeSimple": "Volo.Abp.SettingManagement.EmailSettingsDto" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto, Volo.Abp.SettingManagement.Application.Contracts", + "type": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", + "typeSimple": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + }, + { + "name": "SendTestEmailAsync", + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.SettingManagement.SendTestEmailInput, Volo.Abp.SettingManagement.Application.Contracts", + "type": "Volo.Abp.SettingManagement.SendTestEmailInput", + "typeSimple": "Volo.Abp.SettingManagement.SendTestEmailInput", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "GetAsync": { + "uniqueName": "GetAsync", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/setting-management/emailing", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.Abp.SettingManagement.EmailSettingsDto", + "typeSimple": "Volo.Abp.SettingManagement.EmailSettingsDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.SettingManagement.IEmailSettingsAppService" + }, + "UpdateAsyncByInput": { + "uniqueName": "UpdateAsyncByInput", + "name": "UpdateAsync", + "httpMethod": "POST", + "url": "api/setting-management/emailing", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto, Volo.Abp.SettingManagement.Application.Contracts", + "type": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", + "typeSimple": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", + "typeSimple": "Volo.Abp.SettingManagement.UpdateEmailSettingsDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.SettingManagement.IEmailSettingsAppService" + }, + "SendTestEmailAsyncByInput": { + "uniqueName": "SendTestEmailAsyncByInput", + "name": "SendTestEmailAsync", + "httpMethod": "POST", + "url": "api/setting-management/emailing/send-test-email", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.SettingManagement.SendTestEmailInput, Volo.Abp.SettingManagement.Application.Contracts", + "type": "Volo.Abp.SettingManagement.SendTestEmailInput", + "typeSimple": "Volo.Abp.SettingManagement.SendTestEmailInput", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "Volo.Abp.SettingManagement.SendTestEmailInput", + "typeSimple": "Volo.Abp.SettingManagement.SendTestEmailInput", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.SettingManagement.IEmailSettingsAppService" + } + } + }, + "Volo.Abp.SettingManagement.TimeZoneSettingsController": { + "controllerName": "TimeZoneSettings", + "controllerGroupName": "TimeZoneSettings", + "isRemoteService": true, + "isIntegrationService": false, + "apiVersion": null, + "type": "Volo.Abp.SettingManagement.TimeZoneSettingsController", + "interfaces": [ + { + "type": "Volo.Abp.SettingManagement.ITimeZoneSettingsAppService", + "name": "ITimeZoneSettingsAppService", + "methods": [ + { + "name": "GetAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "System.String", + "typeSimple": "string" + } + }, + { + "name": "GetTimezonesAsync", + "parametersOnMethod": [], + "returnValue": { + "type": "System.Collections.Generic.List", + "typeSimple": "[Volo.Abp.NameValue]" + } + }, + { + "name": "UpdateAsync", + "parametersOnMethod": [ + { + "name": "timezone", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + } + } + ] + } + ], + "actions": { + "GetAsync": { + "uniqueName": "GetAsync", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/setting-management/timezone", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "System.String", + "typeSimple": "string" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.SettingManagement.ITimeZoneSettingsAppService" + }, + "GetTimezonesAsync": { + "uniqueName": "GetTimezonesAsync", + "name": "GetTimezonesAsync", + "httpMethod": "GET", + "url": "api/setting-management/timezone/timezones", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "System.Collections.Generic.List", + "typeSimple": "[Volo.Abp.NameValue]" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.SettingManagement.ITimeZoneSettingsAppService" + }, + "UpdateAsyncByTimezone": { + "uniqueName": "UpdateAsyncByTimezone", + "name": "UpdateAsync", + "httpMethod": "POST", + "url": "api/setting-management/timezone", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "timezone", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "timezone", + "name": "timezone", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.SettingManagement.ITimeZoneSettingsAppService" + } + } + } + } + } + }, + "types": { + "Volo.Abp.Account.ChangePasswordInput": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "CurrentPassword", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "NewPassword", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.ProfileDto": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Email", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Surname", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "PhoneNumber", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsExternal", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "HasPassword", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ConcurrencyStamp", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.RegisterDto": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "EmailAddress", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Password", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "AppName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.ResetPasswordDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserId", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ResetToken", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Password", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.SendPasswordResetCodeDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Email", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "AppName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ReturnUrl", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ReturnUrlHash", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.UpdateProfileDto": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Email", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 64, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Surname", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 64, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "PhoneNumber", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 16, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ConcurrencyStamp", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.VerifyPasswordResetTokenInput": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserId", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ResetToken", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.AbpLoginResult": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Result", + "jsonName": null, + "type": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.LoginResultType", + "typeSimple": "enum", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Description", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.LoginResultType": { + "baseType": "System.Enum", + "isEnum": true, + "enumNames": [ + "Success", + "InvalidUserNameOrPassword", + "NotAllowed", + "LockedOut", + "RequiresTwoFactor" + ], + "enumValues": [ + 1, + 2, + 3, + 4, + 5 + ], + "genericArguments": null, + "properties": null + }, + "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserNameOrEmailAddress", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 255, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Password", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 32, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "RememberMe", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Application.Dtos.ExtensibleAuditedEntityDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleCreationAuditedEntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TPrimaryKey" + ], + "properties": [ + { + "name": "LastModificationTime", + "jsonName": null, + "type": "System.DateTime?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "LastModifierId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.Application.Dtos.ExtensibleCreationAuditedEntityDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TPrimaryKey" + ], + "properties": [ + { + "name": "CreationTime", + "jsonName": null, + "type": "System.DateTime", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "CreatorId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.Application.Dtos.ExtensibleEntityDto": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [] + }, + "Volo.Abp.Application.Dtos.ExtensibleEntityDto": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [ + { + "name": "Id", + "jsonName": null, + "type": "TKey", + "typeSimple": "TKey", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.Application.Dtos.ExtensibleFullAuditedEntityDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleAuditedEntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TPrimaryKey" + ], + "properties": [ + { + "name": "IsDeleted", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DeleterId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "DeletionTime", + "jsonName": null, + "type": "System.DateTime?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.Application.Dtos.ExtensibleLimitedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": "1", + "maximum": "2147483647", + "regex": null, + "isNullable": false } - } - } - }, - "types": { - "Volo.Abp.Account.RegisterDto": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + ] + }, + "Volo.Abp.Application.Dtos.ExtensiblePagedAndSortedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensiblePagedResultRequestDto", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "UserName", + "name": "Sorting", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true - }, + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.Application.Dtos.ExtensiblePagedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleLimitedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "EmailAddress", + "name": "SkipCount", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true - }, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": "0", + "maximum": "2147483647", + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Application.Dtos.LimitedResultRequestDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "Password", + "name": "MaxResultCount", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true - }, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": "1", + "maximum": "2147483647", + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Application.Dtos.ListResultDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "T" + ], + "properties": [ { - "name": "AppName", + "name": "Items", + "jsonName": null, + "type": "[T]", + "typeSimple": "[T]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.PagedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Sorting", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.ObjectExtending.ExtensibleObject": { + "Volo.Abp.Application.Dtos.PagedResultDto": { + "baseType": "Volo.Abp.Application.Dtos.ListResultDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "T" + ], + "properties": [ + { + "name": "TotalCount", + "jsonName": null, + "type": "System.Int64", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Application.Dtos.PagedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.LimitedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": "0", + "maximum": "2147483647", + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "GrantedPolicies", + "jsonName": null, + "type": "{System.String:System.Boolean}", + "typeSimple": "{string:boolean}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto": { "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ + { + "name": "Localization", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Auth", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Setting", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "CurrentUser", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Features", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "GlobalFeatures", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationGlobalFeatureConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationGlobalFeatureConfigurationDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "MultiTenancy", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "CurrentTenant", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Timing", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Clock", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ObjectExtensions", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { "name": "ExtraProperties", "jsonName": null, "type": "{System.String:System.Object}", "typeSimple": "{string:object}", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.IdentityUserDto": { - "baseType": "Volo.Abp.Application.Dtos.ExtensibleFullAuditedEntityDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationRequestOptions": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "TenantId", + "name": "IncludeLocalizationResources", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false - }, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "UserName", + "name": "Values", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, + "type": "{System.String:System.String}", + "typeSimple": "{string:string}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationGlobalFeatureConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "Name", + "name": "EnabledFeatures", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Values", + "jsonName": null, + "type": "{System.String:System.Collections.Generic.Dictionary}", + "typeSimple": "{string:System.Collections.Generic.Dictionary}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Surname", + "name": "Resources", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationResourceDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationResourceDto}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Email", + "name": "Languages", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[Volo.Abp.Localization.LanguageInfo]", + "typeSimple": "[Volo.Abp.Localization.LanguageInfo]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "EmailConfirmed", + "name": "CurrentCulture", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "PhoneNumber", + "name": "DefaultResourceName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "PhoneNumberConfirmed", + "name": "LanguagesMap", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "{System.String:[Volo.Abp.NameValue]}", + "typeSimple": "{string:[Volo.Abp.NameValue]}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "LockoutEnabled", + "name": "LanguageFilesMap", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - }, + "type": "{System.String:[Volo.Abp.NameValue]}", + "typeSimple": "{string:[Volo.Abp.NameValue]}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "LockoutEnd", + "name": "Resources", "jsonName": null, - "type": "System.DateTimeOffset?", - "typeSimple": "string?", - "isRequired": false + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationResourceDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationResourceDto}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ConcurrencyStamp", + "name": "CurrentCulture", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Application.Dtos.ExtensibleFullAuditedEntityDto": { - "baseType": "Volo.Abp.Application.Dtos.ExtensibleAuditedEntityDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationRequestDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, - "genericArguments": [ - "TPrimaryKey" - ], + "genericArguments": null, "properties": [ { - "name": "IsDeleted", - "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - }, - { - "name": "DeleterId", + "name": "CultureName", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DeletionTime", + "name": "OnlyDynamics", "jsonName": null, - "type": "System.DateTime?", - "typeSimple": "string?", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Application.Dtos.ExtensibleAuditedEntityDto": { - "baseType": "Volo.Abp.Application.Dtos.ExtensibleCreationAuditedEntityDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationResourceDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, - "genericArguments": [ - "TPrimaryKey" - ], + "genericArguments": null, "properties": [ { - "name": "LastModificationTime", + "name": "Texts", "jsonName": null, - "type": "System.DateTime?", - "typeSimple": "string?", - "isRequired": false + "type": "{System.String:System.String}", + "typeSimple": "{string:string}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "LastModifierId", + "name": "BaseResources", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Application.Dtos.ExtensibleCreationAuditedEntityDto": { - "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, - "genericArguments": [ - "TPrimaryKey" - ], + "genericArguments": null, "properties": [ { - "name": "CreationTime", - "jsonName": null, - "type": "System.DateTime", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "CreatorId", + "name": "Values", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "{System.String:System.String}", + "typeSimple": "{string:string}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Application.Dtos.ExtensibleEntityDto": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, - "genericArguments": [ - "TKey" - ], + "genericArguments": null, "properties": [ { - "name": "Id", + "name": "Kind", "jsonName": null, - "type": "TKey", - "typeSimple": "TKey", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Account.SendPasswordResetCodeDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -2413,66 +5725,125 @@ "genericArguments": null, "properties": [ { - "name": "Email", + "name": "DisplayName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "AppName", + "name": "EnglishName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ReturnUrl", + "name": "ThreeLetterIsoLanguageName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ReturnUrlHash", + "name": "TwoLetterIsoLanguageName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - } - ] - }, - "Volo.Abp.Account.ResetPasswordDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "UserId", + "name": "IsRightToLeft", "jsonName": null, - "type": "System.Guid", + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "CultureName", + "jsonName": null, + "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ResetToken", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Password", + "name": "NativeName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DateTimeFormat", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -2480,219 +5851,338 @@ "genericArguments": null, "properties": [ { - "name": "UserNameOrEmailAddress", + "name": "IsAuthenticated", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Id", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "TenantId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "ImpersonatorUserId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "ImpersonatorTenantId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "ImpersonatorUserName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "Password", + "name": "ImpersonatorTenantName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "RememberMe", + "name": "UserName", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - } - ] - }, - "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.AbpLoginResult": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, { - "name": "Result", + "name": "Name", "jsonName": null, - "type": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.LoginResultType", - "typeSimple": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.LoginResultType", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "Description", + "name": "SurName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - } - ] - }, - "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.LoginResultType": { - "baseType": "System.Enum", - "isEnum": true, - "enumNames": [ - "Success", - "InvalidUserNameOrPassword", - "NotAllowed", - "LockedOut", - "RequiresTwoFactor" - ], - "enumValues": [ - 1, - 2, - 3, - 4, - 5 - ], - "genericArguments": null, - "properties": null - }, - "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, { - "name": "Success", + "name": "Email", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "TenantId", + "name": "EmailVerified", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Name", + "name": "PhoneNumber", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "IsActive", + "name": "PhoneNumberVerified", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false - } - ] - }, - "Volo.Abp.Application.Dtos.ListResultDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": [ - "T" - ], - "properties": [ + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "Items", + "name": "Roles", "jsonName": null, - "type": "[T]", - "typeSimple": "[T]", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "SessionId", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.Identity.IdentityRoleDto": { - "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Name", + "name": "CalendarAlgorithmType", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsDefault", + "name": "DateTimeFormatLong", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsStatic", + "name": "ShortDatePattern", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsPublic", + "name": "FullDateTimePattern", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ConcurrencyStamp", + "name": "DateSeparator", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - } - ] - }, - "Volo.Abp.Identity.GetIdentityRolesInput": { - "baseType": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "Filter", + "name": "ShortTimePattern", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - } - ] - }, - "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto": { - "baseType": "Volo.Abp.Application.Dtos.PagedResultRequestDto", - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "Sorting", + "name": "LongTimePattern", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Application.Dtos.PagedResultRequestDto": { - "baseType": "Volo.Abp.Application.Dtos.LimitedResultRequestDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "SkipCount", + "name": "TimeZoneName", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.Application.Dtos.LimitedResultRequestDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -2700,56 +6190,70 @@ "genericArguments": null, "properties": [ { - "name": "DefaultMaxResultCount", - "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false - }, - { - "name": "MaxMaxResultCount", + "name": "Properties", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "MaxResultCount", + "name": "Configuration", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Application.Dtos.PagedResultDto": { - "baseType": "Volo.Abp.Application.Dtos.ListResultDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, - "genericArguments": [ - "T" - ], + "genericArguments": null, "properties": [ { - "name": "TotalCount", + "name": "Fields", "jsonName": null, - "type": "System.Int64", - "typeSimple": "number", - "isRequired": false + "type": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto]", + "typeSimple": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "LocalizationResource", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.Identity.IdentityRoleCreateDto": { - "baseType": "Volo.Abp.Identity.IdentityRoleCreateOrUpdateDtoBase", - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [] - }, - "Volo.Abp.Identity.IdentityRoleCreateOrUpdateDtoBase": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, @@ -2760,154 +6264,144 @@ "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true - }, - { - "name": "IsDefault", - "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "IsPublic", + "name": "Value", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.Object", + "typeSimple": "object", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.Identity.IdentityRoleUpdateDto": { - "baseType": "Volo.Abp.Identity.IdentityRoleCreateOrUpdateDtoBase", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "ConcurrencyStamp", + "name": "IsAvailable", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.GetIdentityUsersInput": { - "baseType": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Filter", + "name": "OnGet", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - } - ] - }, - "Volo.Abp.Identity.IdentityUserCreateDto": { - "baseType": "Volo.Abp.Identity.IdentityUserCreateOrUpdateDtoBase", - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "Password", + "name": "OnCreate", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "OnUpdate", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.IdentityUserCreateOrUpdateDtoBase": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "UserName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true - }, - { - "name": "Name", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "Surname", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "Email", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true - }, - { - "name": "PhoneNumber", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "LockoutEnabled", + "name": "IsAvailable", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false - }, - { - "name": "RoleNames", - "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.IdentityUserUpdateDto": { - "baseType": "Volo.Abp.Identity.IdentityUserCreateOrUpdateDtoBase", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Password", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "ConcurrencyStamp", + "name": "IsAvailable", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.IdentityUserUpdateRolesDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -2915,15 +6409,34 @@ "genericArguments": null, "properties": [ { - "name": "RoleNames", + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Config", "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": true + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Users.UserData": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -2931,87 +6444,160 @@ "genericArguments": null, "properties": [ { - "name": "Id", + "name": "Type", "jsonName": null, - "type": "System.Guid", + "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TenantId", + "name": "TypeSimple", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "UserName", + "name": "DisplayName", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "Name", + "name": "Api", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Surname", + "name": "Ui", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Email", + "name": "Policy", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyPolicyDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyPolicyDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "EmailConfirmed", + "name": "Attributes", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto]", + "typeSimple": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "PhoneNumber", + "name": "Configuration", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "PhoneNumberConfirmed", + "name": "DefaultValue", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.Object", + "typeSimple": "object", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.Identity.UserLookupSearchInputDto": { - "baseType": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyFeaturePolicyDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Filter", + "name": "Features", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "RequiresAll", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.UserLookupCountInputDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyGlobalFeaturePolicyDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3019,131 +6605,274 @@ "genericArguments": null, "properties": [ { - "name": "Filter", + "name": "Features", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "RequiresAll", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.ProfileDto": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyPermissionPolicyDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "UserName", + "name": "PermissionNames", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Email", + "name": "RequiresAll", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyPolicyDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "Name", + "name": "GlobalFeatures", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyGlobalFeaturePolicyDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyGlobalFeaturePolicyDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Surname", + "name": "Features", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyFeaturePolicyDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyFeaturePolicyDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "PhoneNumber", + "name": "Permissions", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyPermissionPolicyDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyPermissionPolicyDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "OnTable", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsExternal", + "name": "OnCreateForm", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "HasPassword", + "name": "OnEditForm", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ConcurrencyStamp", + "name": "Lookup", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.UpdateProfileDto": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "UserName", + "name": "IsVisible", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "Email", + "name": "Url", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Name", + "name": "ResultListPropertyName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Surname", + "name": "DisplayPropertyName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "PhoneNumber", + "name": "ValuePropertyName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ConcurrencyStamp", + "name": "FilterParamName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Identity.ChangePasswordInput": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3151,22 +6880,21 @@ "genericArguments": null, "properties": [ { - "name": "CurrentPassword", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "NewPassword", + "name": "IsVisible", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.PermissionManagement.GetPermissionListResultDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3174,22 +6902,34 @@ "genericArguments": null, "properties": [ { - "name": "EntityDisplayName", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Groups", + "name": "Resource", "jsonName": null, - "type": "[Volo.Abp.PermissionManagement.PermissionGroupDto]", - "typeSimple": "[Volo.Abp.PermissionManagement.PermissionGroupDto]", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.PermissionManagement.PermissionGroupDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3197,29 +6937,34 @@ "genericArguments": null, "properties": [ { - "name": "Name", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "DisplayName", + "name": "Entities", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Permissions", + "name": "Configuration", "jsonName": null, - "type": "[Volo.Abp.PermissionManagement.PermissionGrantInfoDto]", - "typeSimple": "[Volo.Abp.PermissionManagement.PermissionGrantInfoDto]", - "isRequired": false + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.PermissionManagement.PermissionGrantInfoDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3227,50 +6972,34 @@ "genericArguments": null, "properties": [ { - "name": "Name", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "DisplayName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "ParentName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "IsGranted", - "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - }, - { - "name": "AllowedProviders", + "name": "Modules", "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "GrantedProviders", + "name": "Enums", "jsonName": null, - "type": "[Volo.Abp.PermissionManagement.ProviderInfoDto]", - "typeSimple": "[Volo.Abp.PermissionManagement.ProviderInfoDto]", - "isRequired": false + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.PermissionManagement.ProviderInfoDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3278,22 +7007,34 @@ "genericArguments": null, "properties": [ { - "name": "ProviderName", + "name": "Iana", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ProviderKey", + "name": "Windows", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.PermissionManagement.UpdatePermissionsDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3301,38 +7042,91 @@ "genericArguments": null, "properties": [ { - "name": "Permissions", + "name": "TimeZone", "jsonName": null, - "type": "[Volo.Abp.PermissionManagement.UpdatePermissionDto]", - "typeSimple": "[Volo.Abp.PermissionManagement.UpdatePermissionDto]", - "isRequired": false + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.PermissionManagement.UpdatePermissionDto": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone": { "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ + { + "name": "TimeZoneId", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Id", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, { "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "IsGranted", + "name": "IsAvailable", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.SettingManagement.EmailSettingsDto": { + "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3340,71 +7134,95 @@ "genericArguments": null, "properties": [ { - "name": "SmtpHost", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "SmtpPort", + "name": "Success", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpUserName", + "name": "TenantId", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "SmtpPassword", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "SmtpDomain", + "name": "NormalizedName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "SmtpEnableSsl", + "name": "IsActive", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false - }, + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "SmtpUseDefaultCredentials", + "name": "IsEnabled", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false - }, - { - "name": "DefaultFromAddress", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "DefaultFromDisplayName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.SettingManagement.UpdateEmailSettingsDto": { + "Volo.Abp.FeatureManagement.FeatureDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3412,72 +7230,161 @@ "genericArguments": null, "properties": [ { - "name": "SmtpHost", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpPort", + "name": "DisplayName", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpUserName", + "name": "Value", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpPassword", + "name": "Provider", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "Volo.Abp.FeatureManagement.FeatureProviderDto", + "typeSimple": "Volo.Abp.FeatureManagement.FeatureProviderDto", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpDomain", + "name": "Description", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpEnableSsl", + "name": "ValueType", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "Volo.Abp.Validation.StringValues.IStringValueType", + "typeSimple": "Volo.Abp.Validation.StringValues.IStringValueType", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SmtpUseDefaultCredentials", + "name": "Depth", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DefaultFromAddress", + "name": "ParentName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.FeatureManagement.FeatureGroupDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DefaultFromDisplayName", + "name": "DisplayName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Features", + "jsonName": null, + "type": "[Volo.Abp.FeatureManagement.FeatureDto]", + "typeSimple": "[Volo.Abp.FeatureManagement.FeatureDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.TenantManagement.TenantDto": { - "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", + "Volo.Abp.FeatureManagement.FeatureProviderDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, @@ -3488,89 +7395,248 @@ "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ConcurrencyStamp", + "name": "Key", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.TenantManagement.GetTenantsInput": { - "baseType": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "Volo.Abp.FeatureManagement.GetFeatureListResultDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Filter", + "name": "Groups", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[Volo.Abp.FeatureManagement.FeatureGroupDto]", + "typeSimple": "[Volo.Abp.FeatureManagement.FeatureGroupDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.TenantManagement.TenantCreateDto": { - "baseType": "Volo.Abp.TenantManagement.TenantCreateOrUpdateDtoBase", + "Volo.Abp.FeatureManagement.UpdateFeatureDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "AdminEmailAddress", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "AdminPassword", + "name": "Value", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": true + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.TenantManagement.TenantCreateOrUpdateDtoBase": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "Volo.Abp.FeatureManagement.UpdateFeaturesDto": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Name", + "name": "Features", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": true + "type": "[Volo.Abp.FeatureManagement.UpdateFeatureDto]", + "typeSimple": "[Volo.Abp.FeatureManagement.UpdateFeatureDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.TenantManagement.TenantUpdateDto": { - "baseType": "Volo.Abp.TenantManagement.TenantCreateOrUpdateDtoBase", + "Volo.Abp.Http.Modeling.ActionApiDescriptionModel": { + "baseType": null, "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "ConcurrencyStamp", + "name": "UniqueName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "HttpMethod", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "Url", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "SupportedVersions", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "ParametersOnMethod", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Parameters", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.ParameterApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.ParameterApiDescriptionModel]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ReturnValue", + "jsonName": null, + "type": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", + "typeSimple": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "AllowAnonymous", + "jsonName": null, + "type": "System.Boolean?", + "typeSimple": "boolean?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "ImplementFrom", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.FeatureManagement.GetFeatureListResultDto": { + "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3578,15 +7644,34 @@ "genericArguments": null, "properties": [ { - "name": "Groups", + "name": "Modules", "jsonName": null, - "type": "[Volo.Abp.FeatureManagement.FeatureGroupDto]", - "typeSimple": "[Volo.Abp.FeatureManagement.FeatureGroupDto]", - "isRequired": false + "type": "{System.String:Volo.Abp.Http.Modeling.ModuleApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.ModuleApiDescriptionModel}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Types", + "jsonName": null, + "type": "{System.String:Volo.Abp.Http.Modeling.TypeApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.TypeApiDescriptionModel}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.FeatureManagement.FeatureGroupDto": { + "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3594,29 +7679,21 @@ "genericArguments": null, "properties": [ { - "name": "Name", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "DisplayName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "Features", + "name": "IncludeTypes", "jsonName": null, - "type": "[Volo.Abp.FeatureManagement.FeatureDto]", - "typeSimple": "[Volo.Abp.FeatureManagement.FeatureDto]", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.FeatureManagement.FeatureDto": { + "Volo.Abp.Http.Modeling.ControllerApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3624,64 +7701,112 @@ "genericArguments": null, "properties": [ { - "name": "Name", + "name": "ControllerName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DisplayName", + "name": "ControllerGroupName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "Value", + "name": "IsRemoteService", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Provider", + "name": "IsIntegrationService", "jsonName": null, - "type": "Volo.Abp.FeatureManagement.FeatureProviderDto", - "typeSimple": "Volo.Abp.FeatureManagement.FeatureProviderDto", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Description", + "name": "ApiVersion", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "ValueType", + "name": "Type", "jsonName": null, - "type": "Volo.Abp.Validation.StringValues.IStringValueType", - "typeSimple": "Volo.Abp.Validation.StringValues.IStringValueType", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Depth", + "name": "Interfaces", "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false + "type": "[Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ParentName", + "name": "Actions", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "{System.String:Volo.Abp.Http.Modeling.ActionApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.ActionApiDescriptionModel}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.FeatureManagement.FeatureProviderDto": { + "Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3689,22 +7814,47 @@ "genericArguments": null, "properties": [ { - "name": "Name", + "name": "Type", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Key", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Methods", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.InterfaceMethodApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.InterfaceMethodApiDescriptionModel]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Validation.StringValues.IStringValueType": { + "Volo.Abp.Http.Modeling.InterfaceMethodApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3716,32 +7866,43 @@ "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, - { - "name": "Item", - "jsonName": null, - "type": "System.Object", - "typeSimple": "object", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Properties", + "name": "ParametersOnMethod", "jsonName": null, - "type": "{System.String:System.Object}", - "typeSimple": "{string:object}", - "isRequired": false + "type": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Validator", + "name": "ReturnValue", "jsonName": null, - "type": "Volo.Abp.Validation.StringValues.IValueValidator", - "typeSimple": "Volo.Abp.Validation.StringValues.IValueValidator", - "isRequired": false + "type": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", + "typeSimple": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Validation.StringValues.IValueValidator": { + "Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3753,64 +7914,82 @@ "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Item", + "name": "TypeAsString", "jsonName": null, - "type": "System.Object", - "typeSimple": "object", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Properties", - "jsonName": null, - "type": "{System.String:System.Object}", - "typeSimple": "{string:object}", - "isRequired": false - } - ] - }, - "Volo.Abp.FeatureManagement.UpdateFeaturesDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ - { - "name": "Features", - "jsonName": null, - "type": "[Volo.Abp.FeatureManagement.UpdateFeatureDto]", - "typeSimple": "[Volo.Abp.FeatureManagement.UpdateFeatureDto]", - "isRequired": false - } - ] - }, - "Volo.Abp.FeatureManagement.UpdateFeatureDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ - { - "name": "Name", + "name": "Type", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Value", + "name": "TypeSimple", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsOptional", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DefaultValue", + "jsonName": null, + "type": "System.Object", + "typeSimple": "object", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto": { + "Volo.Abp.Http.Modeling.ModuleApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3818,78 +7997,47 @@ "genericArguments": null, "properties": [ { - "name": "Localization", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto", - "isRequired": false - }, - { - "name": "Auth", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto", - "isRequired": false - }, - { - "name": "Setting", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto", - "isRequired": false - }, - { - "name": "CurrentUser", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto", - "isRequired": false - }, - { - "name": "Features", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto", - "isRequired": false - }, - { - "name": "MultiTenancy", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto", - "isRequired": false - }, - { - "name": "CurrentTenant", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto", - "isRequired": false - }, - { - "name": "Timing", + "name": "RootPath", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Clock", + "name": "RemoteServiceName", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ObjectExtensions", + "name": "Controllers", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto", - "isRequired": false + "type": "{System.String:Volo.Abp.Http.Modeling.ControllerApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.ControllerApiDescriptionModel}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto": { + "Volo.Abp.Http.Modeling.ParameterApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3897,87 +8045,138 @@ "genericArguments": null, "properties": [ { - "name": "Values", + "name": "NameOnMethod", "jsonName": null, - "type": "{System.String:System.Collections.Generic.Dictionary}", - "typeSimple": "{string:System.Collections.Generic.Dictionary}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Languages", + "name": "Name", "jsonName": null, - "type": "[Volo.Abp.Localization.LanguageInfo]", - "typeSimple": "[Volo.Abp.Localization.LanguageInfo]", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "CurrentCulture", + "name": "JsonName", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "DefaultResourceName", + "name": "Type", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "LanguagesMap", + "name": "TypeSimple", "jsonName": null, - "type": "{System.String:[Volo.Abp.NameValue]}", - "typeSimple": "{string:[Volo.Abp.NameValue]}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "LanguageFilesMap", + "name": "IsOptional", "jsonName": null, - "type": "{System.String:[Volo.Abp.NameValue]}", - "typeSimple": "{string:[Volo.Abp.NameValue]}", - "isRequired": false - } - ] - }, - "Volo.Abp.Localization.LanguageInfo": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "CultureName", + "name": "DefaultValue", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Object", + "typeSimple": "object", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "UiCultureName", + "name": "ConstraintTypes", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "DisplayName", + "name": "BindingSourceId", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "FlagIcon", + "name": "DescriptorName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto": { + "Volo.Abp.Http.Modeling.PropertyApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -3985,71 +8184,151 @@ "genericArguments": null, "properties": [ { - "name": "DisplayName", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "EnglishName", + "name": "JsonName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "ThreeLetterIsoLanguageName", + "name": "Type", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TwoLetterIsoLanguageName", + "name": "TypeSimple", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsRightToLeft", + "name": "IsRequired", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "CultureName", + "name": "MinLength", + "jsonName": null, + "type": "System.Int32?", + "typeSimple": "number?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "MaxLength", + "jsonName": null, + "type": "System.Int32?", + "typeSimple": "number?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "Minimum", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "Name", + "name": "Maximum", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "NativeName", + "name": "Regex", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "DateTimeFormat", + "name": "IsNullable", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto": { + "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4057,330 +8336,704 @@ "genericArguments": null, "properties": [ { - "name": "CalendarAlgorithmType", + "name": "Type", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DateTimeFormatLong", + "name": "TypeSimple", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Http.Modeling.TypeApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "ShortDatePattern", + "name": "BaseType", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "FullDateTimePattern", + "name": "IsEnum", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DateSeparator", + "name": "EnumNames", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "ShortTimePattern", + "name": "EnumValues", + "jsonName": null, + "type": "[System.Object]", + "typeSimple": "[object]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "GenericArguments", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + }, + { + "name": "Properties", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.PropertyApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.PropertyApiDescriptionModel]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true + } + ] + }, + "Volo.Abp.Identity.GetIdentityRolesInput": { + "baseType": "Volo.Abp.Application.Dtos.ExtensiblePagedAndSortedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Filter", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Identity.GetIdentityUsersInput": { + "baseType": "Volo.Abp.Application.Dtos.ExtensiblePagedAndSortedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "LongTimePattern", + "name": "Filter", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.NameValue": { - "baseType": "Volo.Abp.NameValue", + "Volo.Abp.Identity.IdentityRoleCreateDto": { + "baseType": "Volo.Abp.Identity.IdentityRoleCreateOrUpdateDtoBase", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [] }, - "Volo.Abp.NameValue": { - "baseType": null, + "Volo.Abp.Identity.IdentityRoleCreateOrUpdateDtoBase": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", "isEnum": false, "enumNames": null, "enumValues": null, - "genericArguments": [ - "T" - ], + "genericArguments": null, "properties": [ { "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": true, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Value", + "name": "IsDefault", "jsonName": null, - "type": "T", - "typeSimple": "T", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsPublic", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto": { - "baseType": null, + "Volo.Abp.Identity.IdentityRoleDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Policies", + "name": "Name", "jsonName": null, - "type": "{System.String:System.Boolean}", - "typeSimple": "{string:boolean}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "GrantedPolicies", + "name": "IsDefault", "jsonName": null, - "type": "{System.String:System.Boolean}", - "typeSimple": "{string:boolean}", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsStatic", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsPublic", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ConcurrencyStamp", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "CreationTime", + "jsonName": null, + "type": "System.DateTime", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto": { - "baseType": null, + "Volo.Abp.Identity.IdentityRoleUpdateDto": { + "baseType": "Volo.Abp.Identity.IdentityRoleCreateOrUpdateDtoBase", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Values", + "name": "ConcurrencyStamp", "jsonName": null, - "type": "{System.String:System.String}", - "typeSimple": "{string:string}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto": { - "baseType": null, + "Volo.Abp.Identity.IdentityUserCreateDto": { + "baseType": "Volo.Abp.Identity.IdentityUserCreateOrUpdateDtoBase", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "IsAuthenticated", + "name": "Password", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Identity.IdentityUserCreateOrUpdateDtoBase": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Id", + "name": "Name", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 64, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TenantId", + "name": "Surname", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 64, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ImpersonatorUserId", + "name": "Email", "jsonName": null, - "type": "System.Guid?", - "typeSimple": "string?", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "PhoneNumber", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 16, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsActive", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "LockoutEnabled", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ImpersonatorTenantId", + "name": "RoleNames", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.Identity.IdentityUserDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleFullAuditedEntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "TenantId", "jsonName": null, "type": "System.Guid?", "typeSimple": "string?", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { "name": "UserName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SurName", + "name": "Surname", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { "name": "Email", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "EmailVerified", + "name": "EmailConfirmed", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { "name": "PhoneNumber", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "PhoneNumberVerified", + "name": "PhoneNumberConfirmed", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Roles", - "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false - } - ] - }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ - { - "name": "Values", + "name": "IsActive", "jsonName": null, - "type": "{System.String:System.String}", - "typeSimple": "{string:string}", - "isRequired": false - } - ] - }, - "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "IsEnabled", + "name": "LockoutEnabled", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false - } - ] - }, - "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "Id", + "name": "AccessFailedCount", "jsonName": null, - "type": "System.Guid?", + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "LockoutEnd", + "jsonName": null, + "type": "System.DateTimeOffset?", "typeSimple": "string?", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "Name", + "name": "ConcurrencyStamp", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsAvailable", + "name": "EntityVersion", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - } - ] - }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, { - "name": "TimeZone", + "name": "LastPasswordChangeTime", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone", - "isRequired": false + "type": "System.DateTimeOffset?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone": { - "baseType": null, + "Volo.Abp.Identity.IdentityUserUpdateDto": { + "baseType": "Volo.Abp.Identity.IdentityUserCreateOrUpdateDtoBase", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Iana", + "name": "Password", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Windows", + "name": "ConcurrencyStamp", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone": { + "Volo.Abp.Identity.IdentityUserUpdateRolesDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4388,15 +9041,21 @@ "genericArguments": null, "properties": [ { - "name": "TimeZoneName", + "name": "RoleNames", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone": { + "Volo.Abp.Identity.UserLookupCountInputDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4404,31 +9063,43 @@ "genericArguments": null, "properties": [ { - "name": "TimeZoneId", + "name": "Filter", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto": { - "baseType": null, + "Volo.Abp.Identity.UserLookupSearchInputDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensiblePagedAndSortedResultRequestDto", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Kind", + "name": "Filter", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto": { + "Volo.Abp.Localization.LanguageInfo": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4436,45 +9107,105 @@ "genericArguments": null, "properties": [ { - "name": "Modules", + "name": "CultureName", "jsonName": null, - "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto}", - "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Enums", + "name": "UiCultureName", "jsonName": null, - "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto}", - "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DisplayName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "TwoLetterISOLanguageName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto": { - "baseType": null, + "Volo.Abp.NameValue": { + "baseType": "Volo.Abp.NameValue", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, + "properties": [] + }, + "Volo.Abp.NameValue": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "T" + ], "properties": [ { - "name": "Entities", + "name": "Name", "jsonName": null, - "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto}", - "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Configuration", + "name": "Value", "jsonName": null, - "type": "{System.String:System.Object}", - "typeSimple": "{string:object}", - "isRequired": false + "type": "T", + "typeSimple": "T", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto": { + "Volo.Abp.ObjectExtending.ExtensibleObject": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4482,22 +9213,21 @@ "genericArguments": null, "properties": [ { - "name": "Properties", - "jsonName": null, - "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto}", - "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto}", - "isRequired": false - }, - { - "name": "Configuration", + "name": "ExtraProperties", "jsonName": null, "type": "{System.String:System.Object}", "typeSimple": "{string:object}", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto": { + "Volo.Abp.PermissionManagement.GetPermissionListResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4505,64 +9235,34 @@ "genericArguments": null, "properties": [ { - "name": "Type", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "TypeSimple", + "name": "EntityDisplayName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, - { - "name": "DisplayName", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto", - "isRequired": false - }, - { - "name": "Api", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto", - "isRequired": false - }, - { - "name": "Ui", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto", - "isRequired": false - }, - { - "name": "Attributes", - "jsonName": null, - "type": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto]", - "typeSimple": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto]", - "isRequired": false - }, - { - "name": "Configuration", - "jsonName": null, - "type": "{System.String:System.Object}", - "typeSimple": "{string:object}", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DefaultValue", + "name": "Groups", "jsonName": null, - "type": "System.Object", - "typeSimple": "object", - "isRequired": false + "type": "[Volo.Abp.PermissionManagement.PermissionGroupDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.PermissionGroupDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto": { + "Volo.Abp.PermissionManagement.GetResourcePermissionDefinitionListResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4570,22 +9270,21 @@ "genericArguments": null, "properties": [ { - "name": "Name", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "Resource", + "name": "Permissions", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[Volo.Abp.PermissionManagement.ResourcePermissionDefinitionDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.ResourcePermissionDefinitionDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto": { + "Volo.Abp.PermissionManagement.GetResourcePermissionListResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4593,29 +9292,21 @@ "genericArguments": null, "properties": [ { - "name": "OnGet", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto", - "isRequired": false - }, - { - "name": "OnCreate", - "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto", - "isRequired": false - }, - { - "name": "OnUpdate", + "name": "Permissions", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto", - "isRequired": false + "type": "[Volo.Abp.PermissionManagement.ResourcePermissionGrantInfoDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.ResourcePermissionGrantInfoDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto": { + "Volo.Abp.PermissionManagement.GetResourcePermissionWithProviderListResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4623,15 +9314,21 @@ "genericArguments": null, "properties": [ { - "name": "IsAvailable", + "name": "Permissions", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "[Volo.Abp.PermissionManagement.ResourcePermissionWithProdiverGrantInfoDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.ResourcePermissionWithProdiverGrantInfoDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto": { + "Volo.Abp.PermissionManagement.GetResourceProviderListResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4639,15 +9336,56 @@ "genericArguments": null, "properties": [ { - "name": "IsAvailable", + "name": "Providers", + "jsonName": null, + "type": "[Volo.Abp.PermissionManagement.ResourceProviderDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.ResourceProviderDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.PermissionManagement.GrantedResourcePermissionDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DisplayName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto": { + "Volo.Abp.PermissionManagement.PermissionGrantInfoDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4655,15 +9393,86 @@ "genericArguments": null, "properties": [ { - "name": "IsAvailable", + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DisplayName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ParentName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsGranted", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "AllowedProviders", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "GrantedProviders", + "jsonName": null, + "type": "[Volo.Abp.PermissionManagement.ProviderInfoDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.ProviderInfoDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto": { + "Volo.Abp.PermissionManagement.PermissionGroupDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4671,36 +9480,73 @@ "genericArguments": null, "properties": [ { - "name": "OnTable", + "name": "Name", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "OnCreateForm", + "name": "DisplayName", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "OnEditForm", + "name": "DisplayNameKey", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Lookup", + "name": "DisplayNameResource", "jsonName": null, - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Permissions", + "jsonName": null, + "type": "[Volo.Abp.PermissionManagement.PermissionGrantInfoDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.PermissionGrantInfoDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto": { + "Volo.Abp.PermissionManagement.ProviderInfoDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4708,15 +9554,34 @@ "genericArguments": null, "properties": [ { - "name": "IsVisible", + "name": "ProviderName", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "ProviderKey", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto": { + "Volo.Abp.PermissionManagement.ResourcePermissionDefinitionDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4724,15 +9589,34 @@ "genericArguments": null, "properties": [ { - "name": "IsVisible", + "name": "Name", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DisplayName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto": { + "Volo.Abp.PermissionManagement.ResourcePermissionGrantInfoDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4740,43 +9624,73 @@ "genericArguments": null, "properties": [ { - "name": "Url", + "name": "ProviderName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ResultListPropertyName", + "name": "ProviderKey", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DisplayPropertyName", + "name": "ProviderDisplayName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ValuePropertyName", + "name": "ProviderNameDisplayName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "FilterParamName", + "name": "Permissions", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "[Volo.Abp.PermissionManagement.GrantedResourcePermissionDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.GrantedResourcePermissionDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto": { + "Volo.Abp.PermissionManagement.ResourcePermissionWithProdiverGrantInfoDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4784,22 +9698,60 @@ "genericArguments": null, "properties": [ { - "name": "TypeSimple", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Config", + "name": "DisplayName", "jsonName": null, - "type": "{System.String:System.Object}", - "typeSimple": "{string:object}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Providers", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "IsGranted", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto": { + "Volo.Abp.PermissionManagement.ResourceProviderDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4807,22 +9759,34 @@ "genericArguments": null, "properties": [ { - "name": "Fields", + "name": "Name", "jsonName": null, - "type": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto]", - "typeSimple": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto]", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "LocalizationResource", + "name": "DisplayName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto": { + "Volo.Abp.PermissionManagement.SearchProviderKeyInfo": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4830,22 +9794,34 @@ "genericArguments": null, "properties": [ { - "name": "Name", + "name": "ProviderKey", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Value", + "name": "ProviderDisplayName", "jsonName": null, - "type": "System.Object", - "typeSimple": "object", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto": { + "Volo.Abp.PermissionManagement.SearchProviderKeyListResultDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4853,15 +9829,21 @@ "genericArguments": null, "properties": [ { - "name": "IncludeTypes", - "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "name": "Keys", + "jsonName": null, + "type": "[Volo.Abp.PermissionManagement.SearchProviderKeyInfo]", + "typeSimple": "[Volo.Abp.PermissionManagement.SearchProviderKeyInfo]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel": { + "Volo.Abp.PermissionManagement.UpdatePermissionDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4869,22 +9851,34 @@ "genericArguments": null, "properties": [ { - "name": "Modules", + "name": "Name", "jsonName": null, - "type": "{System.String:Volo.Abp.Http.Modeling.ModuleApiDescriptionModel}", - "typeSimple": "{string:Volo.Abp.Http.Modeling.ModuleApiDescriptionModel}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Types", + "name": "IsGranted", "jsonName": null, - "type": "{System.String:Volo.Abp.Http.Modeling.TypeApiDescriptionModel}", - "typeSimple": "{string:Volo.Abp.Http.Modeling.TypeApiDescriptionModel}", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ModuleApiDescriptionModel": { + "Volo.Abp.PermissionManagement.UpdatePermissionsDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4892,29 +9886,69 @@ "genericArguments": null, "properties": [ { - "name": "RootPath", + "name": "Permissions", + "jsonName": null, + "type": "[Volo.Abp.PermissionManagement.UpdatePermissionDto]", + "typeSimple": "[Volo.Abp.PermissionManagement.UpdatePermissionDto]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.PermissionManagement.UpdateResourcePermissionsDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "ProviderName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "RemoteServiceName", + "name": "ProviderKey", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Controllers", + "name": "Permissions", "jsonName": null, - "type": "{System.String:Volo.Abp.Http.Modeling.ControllerApiDescriptionModel}", - "typeSimple": "{string:Volo.Abp.Http.Modeling.ControllerApiDescriptionModel}", - "isRequired": false + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ControllerApiDescriptionModel": { + "Volo.Abp.SettingManagement.EmailSettingsDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4922,43 +9956,125 @@ "genericArguments": null, "properties": [ { - "name": "ControllerName", + "name": "SmtpHost", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ControllerGroupName", + "name": "SmtpPort", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "SmtpUserName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Type", + "name": "SmtpPassword", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Interfaces", + "name": "SmtpDomain", "jsonName": null, - "type": "[Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel]", - "typeSimple": "[Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel]", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Actions", + "name": "SmtpEnableSsl", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "SmtpUseDefaultCredentials", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DefaultFromAddress", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "DefaultFromDisplayName", "jsonName": null, - "type": "{System.String:Volo.Abp.Http.Modeling.ActionApiDescriptionModel}", - "typeSimple": "{string:Volo.Abp.Http.Modeling.ActionApiDescriptionModel}", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel": { + "Volo.Abp.SettingManagement.SendTestEmailInput": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4966,15 +10082,60 @@ "genericArguments": null, "properties": [ { - "name": "Type", + "name": "SenderEmailAddress", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "TargetEmailAddress", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Subject", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + }, + { + "name": "Body", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ActionApiDescriptionModel": { + "Volo.Abp.SettingManagement.UpdateEmailSettingsDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -4982,129 +10143,261 @@ "genericArguments": null, "properties": [ { - "name": "UniqueName", + "name": "SmtpHost", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Name", + "name": "SmtpPort", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": "1", + "maximum": "65535", + "regex": null, + "isNullable": false }, { - "name": "HttpMethod", + "name": "SmtpUserName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": 1024, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Url", + "name": "SmtpPassword", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": 1024, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "SupportedVersions", + "name": "SmtpDomain", "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": 1024, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ParametersOnMethod", + "name": "SmtpEnableSsl", "jsonName": null, - "type": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", - "typeSimple": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Parameters", + "name": "SmtpUseDefaultCredentials", "jsonName": null, - "type": "[Volo.Abp.Http.Modeling.ParameterApiDescriptionModel]", - "typeSimple": "[Volo.Abp.Http.Modeling.ParameterApiDescriptionModel]", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ReturnValue", + "name": "DefaultFromAddress", "jsonName": null, - "type": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", - "typeSimple": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": 1024, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "AllowAnonymous", + "name": "DefaultFromDisplayName", "jsonName": null, - "type": "System.Boolean?", - "typeSimple": "boolean?", - "isRequired": false - }, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": 1024, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.TenantManagement.GetTenantsInput": { + "baseType": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "ImplementFrom", + "name": "Filter", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel": { - "baseType": null, + "Volo.Abp.TenantManagement.TenantCreateDto": { + "baseType": "Volo.Abp.TenantManagement.TenantCreateOrUpdateDtoBase", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "Name", + "name": "AdminEmailAddress", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": true, + "minLength": null, + "maxLength": 256, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TypeAsString", + "name": "AdminPassword", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, + "isRequired": true, + "minLength": null, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.TenantManagement.TenantCreateOrUpdateDtoBase": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "Type", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, + "isRequired": true, + "minLength": 0, + "maxLength": 64, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.TenantManagement.TenantDto": { + "baseType": "Volo.Abp.Application.Dtos.ExtensibleEntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "TypeSimple", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsOptional", + "name": "ConcurrencyStamp", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - }, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false + } + ] + }, + "Volo.Abp.TenantManagement.TenantUpdateDto": { + "baseType": "Volo.Abp.TenantManagement.TenantCreateOrUpdateDtoBase", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ { - "name": "DefaultValue", + "name": "ConcurrencyStamp", "jsonName": null, - "type": "System.Object", - "typeSimple": "object", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.ParameterApiDescriptionModel": { + "Volo.Abp.Users.UserData": { "baseType": null, "isEnum": false, "enumNames": null, @@ -5112,101 +10405,151 @@ "genericArguments": null, "properties": [ { - "name": "NameOnMethod", + "name": "Id", "jsonName": null, - "type": "System.String", + "type": "System.Guid", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Name", + "name": "TenantId", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "JsonName", + "name": "UserName", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Type", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TypeSimple", + "name": "Surname", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "IsOptional", + "name": "IsActive", "jsonName": null, "type": "System.Boolean", "typeSimple": "boolean", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DefaultValue", + "name": "Email", "jsonName": null, - "type": "System.Object", - "typeSimple": "object", - "isRequired": false + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "ConstraintTypes", + "name": "EmailConfirmed", "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "BindingSourceId", + "name": "PhoneNumber", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "DescriptorName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - } - ] - }, - "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ - { - "name": "Type", + "name": "PhoneNumberConfirmed", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TypeSimple", + "name": "ExtraProperties", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.TypeApiDescriptionModel": { + "Volo.Abp.Validation.StringValues.IStringValueType": { "baseType": null, "isEnum": false, "enumNames": null, @@ -5214,50 +10557,60 @@ "genericArguments": null, "properties": [ { - "name": "BaseType", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, - { - "name": "IsEnum", - "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false - }, - { - "name": "EnumNames", - "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "EnumValues", + "name": "Item", "jsonName": null, - "type": "[System.Object]", - "typeSimple": "[object]", - "isRequired": false + "type": "System.Object", + "typeSimple": "object", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "GenericArguments", + "name": "Properties", "jsonName": null, - "type": "[System.String]", - "typeSimple": "[string]", - "isRequired": false + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "Properties", + "name": "Validator", "jsonName": null, - "type": "[Volo.Abp.Http.Modeling.PropertyApiDescriptionModel]", - "typeSimple": "[Volo.Abp.Http.Modeling.PropertyApiDescriptionModel]", - "isRequired": false + "type": "Volo.Abp.Validation.StringValues.IValueValidator", + "typeSimple": "Volo.Abp.Validation.StringValues.IValueValidator", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] }, - "Volo.Abp.Http.Modeling.PropertyApiDescriptionModel": { + "Volo.Abp.Validation.StringValues.IValueValidator": { "baseType": null, "isEnum": false, "enumNames": null, @@ -5269,35 +10622,39 @@ "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false - }, - { - "name": "JsonName", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "Type", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false }, { - "name": "TypeSimple", + "name": "Item", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false + "type": "System.Object", + "typeSimple": "object", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": true }, { - "name": "IsRequired", + "name": "Properties", "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isRequired": false + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null, + "isNullable": false } ] } diff --git a/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/models.ts b/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/models.ts index cbba2214ec..49e67f7614 100644 --- a/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/models.ts +++ b/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/models.ts @@ -4,6 +4,27 @@ export interface GetPermissionListResultDto { groups: PermissionGroupDto[]; } +export interface GetResourcePermissionDefinitionListResultDto { + permissions?: ResourcePermissionDefinitionDto[]; +} + +export interface GetResourcePermissionListResultDto { + permissions?: ResourcePermissionGrantInfoDto[]; +} + +export interface GetResourcePermissionWithProviderListResultDto { + permissions?: ResourcePermissionWithProdiverGrantInfoDto[]; +} + +export interface GetResourceProviderListResultDto { + providers?: ResourceProviderDto[]; +} + +export interface GrantedResourcePermissionDto { + name?: string; + displayName?: string; +} + export interface PermissionGrantInfoDto { name?: string; displayName?: string; @@ -17,6 +38,8 @@ export interface PermissionGroupDto { name?: string; displayName?: string; permissions: PermissionGrantInfoDto[]; + displayNameKey?: string; + displayNameResource?: string; } export interface ProviderInfoDto { @@ -24,6 +47,40 @@ export interface ProviderInfoDto { providerKey?: string; } +export interface ResourcePermissionDefinitionDto { + name?: string; + displayName?: string; +} + +export interface ResourcePermissionGrantInfoDto { + providerName?: string; + providerKey?: string; + providerDisplayName?: string; + providerNameDisplayName?: string; + permissions?: GrantedResourcePermissionDto[]; +} + +export interface ResourcePermissionWithProdiverGrantInfoDto { + name?: string; + displayName?: string; + providers?: string[]; + isGranted?: boolean; +} + +export interface ResourceProviderDto { + name?: string; + displayName?: string; +} + +export interface SearchProviderKeyInfo { + providerKey?: string; + providerDisplayName?: string; +} + +export interface SearchProviderKeyListResultDto { + keys?: SearchProviderKeyInfo[]; +} + export interface UpdatePermissionDto { name?: string; isGranted: boolean; @@ -32,3 +89,9 @@ export interface UpdatePermissionDto { export interface UpdatePermissionsDto { permissions: UpdatePermissionDto[]; } + +export interface UpdateResourcePermissionsDto { + providerName?: string; + providerKey?: string; + permissions?: string[]; +} diff --git a/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/permissions.service.ts b/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/permissions.service.ts index dbd13ca778..8f28edf3fb 100644 --- a/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/permissions.service.ts +++ b/npm/ng-packs/packages/permission-management/proxy/src/lib/proxy/permissions.service.ts @@ -1,5 +1,5 @@ -import type { GetPermissionListResultDto, UpdatePermissionsDto } from './models'; -import { RestService } from '@abp/ng.core'; +import type { GetPermissionListResultDto, GetResourcePermissionDefinitionListResultDto, GetResourcePermissionListResultDto, GetResourcePermissionWithProviderListResultDto, GetResourceProviderListResultDto, SearchProviderKeyListResultDto, UpdatePermissionsDto, UpdateResourcePermissionsDto } from './models'; +import { RestService, Rest } from '@abp/ng.core'; import { Injectable, inject } from '@angular/core'; @Injectable({ @@ -7,23 +7,97 @@ import { Injectable, inject } from '@angular/core'; }) export class PermissionsService { private restService = inject(RestService); - apiName = 'AbpPermissionManagement'; - get = (providerName: string, providerKey: string) => + + deleteResource = (resourceName: string, resourceKey: string, providerName: string, providerKey: string, config?: Partial) => + this.restService.request({ + method: 'DELETE', + url: '/api/permission-management/permissions/resource', + params: { resourceName, resourceKey, providerName, providerKey }, + }, + { apiName: this.apiName, ...config }); + + + get = (providerName: string, providerKey: string, config?: Partial) => this.restService.request({ method: 'GET', url: '/api/permission-management/permissions', params: { providerName, providerKey }, }, - { apiName: this.apiName }); + { apiName: this.apiName, ...config }); + + + getByGroup = (groupName: string, providerName: string, providerKey: string, config?: Partial) => + this.restService.request({ + method: 'GET', + url: '/api/permission-management/permissions/by-group', + params: { groupName, providerName, providerKey }, + }, + { apiName: this.apiName, ...config }); + + + getResource = (resourceName: string, resourceKey: string, config?: Partial) => + this.restService.request({ + method: 'GET', + url: '/api/permission-management/permissions/resource', + params: { resourceName, resourceKey }, + }, + { apiName: this.apiName, ...config }); + + + getResourceByProvider = (resourceName: string, resourceKey: string, providerName: string, providerKey: string, config?: Partial) => + this.restService.request({ + method: 'GET', + url: '/api/permission-management/permissions/resource/by-provider', + params: { resourceName, resourceKey, providerName, providerKey }, + }, + { apiName: this.apiName, ...config }); - update = (providerName: string, providerKey: string, input: UpdatePermissionsDto) => + + getResourceDefinitions = (resourceName: string, config?: Partial) => + this.restService.request({ + method: 'GET', + url: '/api/permission-management/permissions/resource-definitions', + params: { resourceName }, + }, + { apiName: this.apiName, ...config }); + + + getResourceProviderKeyLookupServices = (resourceName: string, config?: Partial) => + this.restService.request({ + method: 'GET', + url: '/api/permission-management/permissions/resource-provider-key-lookup-services', + params: { resourceName }, + }, + { apiName: this.apiName, ...config }); + + + searchResourceProviderKey = (resourceName: string, serviceName: string, filter: string, page: number, config?: Partial) => + this.restService.request({ + method: 'GET', + url: '/api/permission-management/permissions/search-resource-provider-keys', + params: { resourceName, serviceName, filter, page }, + }, + { apiName: this.apiName, ...config }); + + + update = (providerName: string, providerKey: string, input: UpdatePermissionsDto, config?: Partial) => this.restService.request({ method: 'PUT', url: '/api/permission-management/permissions', params: { providerName, providerKey }, body: input, }, - { apiName: this.apiName }); + { apiName: this.apiName, ...config }); + + + updateResource = (resourceName: string, resourceKey: string, input: UpdateResourcePermissionsDto, config?: Partial) => + this.restService.request({ + method: 'PUT', + url: '/api/permission-management/permissions/resource', + params: { resourceName, resourceKey }, + body: input, + }, + { apiName: this.apiName, ...config }); } diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/index.ts b/npm/ng-packs/packages/permission-management/src/lib/components/index.ts index efa91b45a2..074ddb880d 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/components/index.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/components/index.ts @@ -1 +1,6 @@ export * from './permission-management.component'; +export * from './resource-permission-management/resource-permission-management.component'; +export * from './resource-permission-management/provider-key-search/provider-key-search.component'; +export * from './resource-permission-management/permission-checkbox-list/permission-checkbox-list.component'; +export * from './resource-permission-management/resource-permission-list/resource-permission-list.component'; +export * from './resource-permission-management/resource-permission-form/resource-permission-form.component'; diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.html new file mode 100644 index 0000000000..aeaefdff20 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.html @@ -0,0 +1,33 @@ +
+ @if (showTitle()) { +
{{ title() | abpLocalization }}
+ } +
+ + +
+
+ @for (perm of permissions(); track perm.name) { +
+ + +
+ } +
+
diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.scss b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.scss new file mode 100644 index 0000000000..0562864716 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.scss @@ -0,0 +1,4 @@ +.abp-permission-list-container { + max-height: 300px; + overflow-y: auto; +} \ No newline at end of file diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.ts new file mode 100644 index 0000000000..26c5a314f9 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/permission-checkbox-list/permission-checkbox-list.component.ts @@ -0,0 +1,24 @@ +import { Component, input, inject, ChangeDetectionStrategy } from '@angular/core'; +import { LocalizationPipe } from '@abp/ng.core'; +import { ResourcePermissionStateService } from '../../../services/resource-permission-state.service'; + +interface PermissionItem { + name?: string | null; + displayName?: string | null; +} + +@Component({ + selector: 'abp-permission-checkbox-list', + templateUrl: './permission-checkbox-list.component.html', + styleUrl: './permission-checkbox-list.component.scss', + imports: [LocalizationPipe], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class PermissionCheckboxListComponent { + readonly state = inject(ResourcePermissionStateService); + + readonly permissions = input.required(); + readonly idPrefix = input('default'); + readonly title = input('AbpPermissionManagement::ResourcePermissionPermissions'); + readonly showTitle = input(true); +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/provider-key-search/provider-key-search.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/provider-key-search/provider-key-search.component.html new file mode 100644 index 0000000000..b04e1552c9 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/provider-key-search/provider-key-search.component.html @@ -0,0 +1,10 @@ + diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/provider-key-search/provider-key-search.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/provider-key-search/provider-key-search.component.ts new file mode 100644 index 0000000000..d8379890fb --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/provider-key-search/provider-key-search.component.ts @@ -0,0 +1,67 @@ +import { + Component, + input, + inject, + OnInit, + ChangeDetectionStrategy, + DestroyRef, +} from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { PermissionsService } from '@abp/ng.permission-management/proxy'; +import { LookupSearchComponent, LookupItem } from '@abp/ng.components/lookup'; +import { Observable, map } from 'rxjs'; +import { ResourcePermissionStateService } from '../../../services/resource-permission-state.service'; + +interface ProviderKeyLookupItem extends LookupItem { + providerKey: string; + providerDisplayName?: string; +} + +@Component({ + selector: 'abp-provider-key-search', + templateUrl: './provider-key-search.component.html', + imports: [LookupSearchComponent], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ProviderKeySearchComponent implements OnInit { + readonly state = inject(ResourcePermissionStateService); + private readonly service = inject(PermissionsService); + private readonly destroyRef = inject(DestroyRef); + + readonly resourceName = input.required(); + + searchFn: (filter: string) => Observable = () => new Observable(); + + ngOnInit() { + this.searchFn = (filter: string) => this.loadProviderKeys(filter); + } + + onItemSelected(item: ProviderKeyLookupItem) { + // State is already updated via displayValue and selectedValue bindings + // This handler can be used for additional side effects if needed + } + + private loadProviderKeys(filter: string): Observable { + const providerName = this.state.selectedProviderName(); + if (!providerName) { + return new Observable(subscriber => { + subscriber.next([]); + subscriber.complete(); + }); + } + + return this.service + .searchResourceProviderKey(this.resourceName(), providerName, filter, 1) + .pipe( + map(res => + (res.keys || []).map(k => ({ + key: k.providerKey || '', + displayName: k.providerDisplayName || k.providerKey || '', + providerKey: k.providerKey || '', + providerDisplayName: k.providerDisplayName || undefined, + })), + ), + takeUntilDestroyed(this.destroyRef), + ); + } +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-form/resource-permission-form.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-form/resource-permission-form.component.html new file mode 100644 index 0000000000..50d6370185 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-form/resource-permission-form.component.html @@ -0,0 +1,37 @@ +@if (mode() === eResourcePermissionViewModes.Add) { +
+ +
+ @for (provider of state.providers(); track provider.name; let i = $index) { +
+ + +
+ } +
+ + +
+ + +} @else { +
+

{{ 'AbpPermissionManagement::Permissions' | abpLocalization }}

+ +
+} diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-form/resource-permission-form.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-form/resource-permission-form.component.ts new file mode 100644 index 0000000000..8761da7f90 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-form/resource-permission-form.component.ts @@ -0,0 +1,31 @@ +import { Component, input, inject, output, ChangeDetectionStrategy } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { LocalizationPipe } from '@abp/ng.core'; +import { ResourcePermissionStateService } from '../../../services/resource-permission-state.service'; +import { ProviderKeySearchComponent } from '../provider-key-search/provider-key-search.component'; +import { PermissionCheckboxListComponent } from '../permission-checkbox-list/permission-checkbox-list.component'; + +import { eResourcePermissionViewModes } from '../../../enums/view-modes'; + +@Component({ + selector: 'abp-resource-permission-form', + templateUrl: './resource-permission-form.component.html', + imports: [ + FormsModule, + LocalizationPipe, + ProviderKeySearchComponent, + PermissionCheckboxListComponent, + ], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ResourcePermissionFormComponent { + readonly state = inject(ResourcePermissionStateService); + readonly eResourcePermissionViewModes = eResourcePermissionViewModes; + + readonly mode = input.required(); + readonly resourceName = input.required(); + + readonly save = output(); + readonly cancel = output(); +} + diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-list/resource-permission-list.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-list/resource-permission-list.component.html new file mode 100644 index 0000000000..a00c909aff --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-list/resource-permission-list.component.html @@ -0,0 +1,41 @@ +
+ +
+ + +
+ + +
+
+ +@if (state.resourcePermissions().length > 0) { + +} @else { +
+ {{ 'AbpPermissionManagement::NoPermissionsAssigned' | abpLocalization }} +
+} diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-list/resource-permission-list.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-list/resource-permission-list.component.ts new file mode 100644 index 0000000000..777246af9a --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-list/resource-permission-list.component.ts @@ -0,0 +1,33 @@ +import { Component, inject, output, ChangeDetectionStrategy } from '@angular/core'; +import { ListService, LocalizationPipe } from '@abp/ng.core'; +import { ExtensibleTableComponent, EXTENSIONS_IDENTIFIER } from '@abp/ng.components/extensible'; +import { ResourcePermissionGrantInfoDto } from '@abp/ng.permission-management/proxy'; +import { ResourcePermissionStateService } from '../../../services/resource-permission-state.service'; +import { ePermissionManagementComponents } from '../../../enums/components'; +import { configureResourcePermissionExtensions } from '../../../services/extensions.service'; + +@Component({ + selector: 'abp-resource-permission-list', + templateUrl: './resource-permission-list.component.html', + providers: [ + ListService, + { + provide: EXTENSIONS_IDENTIFIER, + useValue: ePermissionManagementComponents.ResourcePermissions, + }, + ], + imports: [LocalizationPipe, ExtensibleTableComponent], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ResourcePermissionListComponent { + readonly state = inject(ResourcePermissionStateService); + readonly list = inject(ListService); + + readonly addClicked = output(); + readonly editClicked = output(); + readonly deleteClicked = output(); + + constructor() { + configureResourcePermissionExtensions(); + } +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-management.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-management.component.html new file mode 100644 index 0000000000..aa26f12bb3 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-management.component.html @@ -0,0 +1,67 @@ + + + + + + + @if (!state.hasResourcePermission() || !state.hasProviderKeyLookupService()) { + + } @else { + @switch (state.viewMode()) { + @case (eResourcePermissionViewModes.List) { + + } + @case (eResourcePermissionViewModes.Add) { + + } + @case (eResourcePermissionViewModes.Edit) { + + } + } + } + + + + @if (state.isListMode()) { + + } @else { + + + {{ 'AbpUi::Save' | abpLocalization }} + + } + + diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-management.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-management.component.ts new file mode 100644 index 0000000000..49437e183e --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/components/resource-permission-management/resource-permission-management.component.ts @@ -0,0 +1,216 @@ +import { ListService, LocalizationPipe } from '@abp/ng.core'; +import { + ButtonComponent, + Confirmation, + ConfirmationService, + ModalCloseDirective, + ModalComponent, + ToasterService, +} from '@abp/ng.theme.shared'; +import { + PermissionsService, + ResourcePermissionGrantInfoDto, +} from '@abp/ng.permission-management/proxy'; +import { Component, inject, input, model, OnInit, effect, untracked, signal } from '@angular/core'; +import { finalize, switchMap, of } from 'rxjs'; +import { ResourcePermissionStateService } from '../../services/resource-permission-state.service'; +import { ResourcePermissionListComponent } from './resource-permission-list/resource-permission-list.component'; +import { ResourcePermissionFormComponent } from './resource-permission-form/resource-permission-form.component'; + +import { eResourcePermissionViewModes } from '../../enums/view-modes'; + +const DEFAULT_MAX_RESULT_COUNT = 10; + +@Component({ + selector: 'abp-resource-permission-management', + templateUrl: './resource-permission-management.component.html', + exportAs: 'abpResourcePermissionManagement', + providers: [ResourcePermissionStateService, ListService], + imports: [ + ModalComponent, + LocalizationPipe, + ButtonComponent, + ModalCloseDirective, + ResourcePermissionListComponent, + ResourcePermissionFormComponent, + ], +}) +export class ResourcePermissionManagementComponent implements OnInit { + readonly eResourcePermissionViewModes = eResourcePermissionViewModes; + + protected readonly service = inject(PermissionsService); + protected readonly toasterService = inject(ToasterService); + protected readonly confirmationService = inject(ConfirmationService); + protected readonly state = inject(ResourcePermissionStateService); + private readonly list = inject(ListService); + + readonly resourceName = input.required(); + readonly resourceKey = input.required(); + readonly resourceDisplayName = input(); + + readonly visible = model(false); + + private readonly previousVisible = signal(false); + + constructor() { + effect(() => { + const resourceName = this.resourceName(); + const resourceKey = this.resourceKey(); + const resourceDisplayName = this.resourceDisplayName(); + + untracked(() => { + this.state.resourceName.set(resourceName); + this.state.resourceKey.set(resourceKey); + this.state.resourceDisplayName.set(resourceDisplayName); + }); + }); + + effect(() => { + const isVisible = this.visible(); + const wasVisible = this.previousVisible(); + if (isVisible && !wasVisible) { + this.openModal(); + } else if (!isVisible && wasVisible) { + this.state.reset(); + } + untracked(() => this.previousVisible.set(isVisible)); + }); + } + + ngOnInit() { + this.list.maxResultCount = DEFAULT_MAX_RESULT_COUNT; + + this.list + .hookToQuery(query => { + const allData = this.state.allResourcePermissions(); + const skipCount = query.skipCount || 0; + const maxResultCount = query.maxResultCount || DEFAULT_MAX_RESULT_COUNT; + + const paginatedData = allData.slice(skipCount, skipCount + maxResultCount); + + return of({ + items: paginatedData, + totalCount: allData.length, + }); + }) + .subscribe(result => { + this.state.resourcePermissions.set(result.items); + this.state.totalCount.set(result.totalCount); + }); + } + + openModal() { + this.state.modalBusy.set(true); + + this.service + .getResource(this.resourceName(), this.resourceKey()) + .pipe( + switchMap(permRes => { + this.state.setResourceData(permRes.permissions || []); + this.list.get(); + return this.service.getResourceProviderKeyLookupServices(this.resourceName()); + }), + switchMap(providerRes => { + this.state.setProviders(providerRes.providers || []); + return this.service.getResourceDefinitions(this.resourceName()); + }), + finalize(() => this.state.modalBusy.set(false)), + ) + .subscribe({ + next: defRes => { + this.state.setDefinitions(defRes.permissions || []); + }, + error: () => { + this.toasterService.error('AbpPermissionManagement::ErrorLoadingPermissions'); + }, + }); + } + + onAddClicked() { + this.state.goToAddMode(); + } + + onEditClicked(grant: ResourcePermissionGrantInfoDto) { + this.state.prepareEditMode(grant); + this.state.modalBusy.set(true); + + this.service + .getResourceByProvider( + this.resourceName(), + this.resourceKey(), + grant.providerName || '', + grant.providerKey || '', + ) + .pipe(finalize(() => this.state.modalBusy.set(false))) + .subscribe({ + next: res => { + this.state.setEditModePermissions(res.permissions || []); + }, + }); + } + + onDeleteClicked(grant: ResourcePermissionGrantInfoDto) { + this.confirmationService + .warn( + 'AbpPermissionManagement::ResourcePermissionDeletionConfirmationMessage', + 'AbpPermissionManagement::AreYouSure', + { + messageLocalizationParams: [grant.providerKey || ''], + }, + ) + .subscribe((status: Confirmation.Status) => { + if (status === Confirmation.Status.confirm) { + this.state.modalBusy.set(true); + this.service + .deleteResource( + this.resourceName(), + this.resourceKey(), + grant.providerName || '', + grant.providerKey || '', + ) + .pipe( + switchMap(() => this.service.getResource(this.resourceName(), this.resourceKey())), + finalize(() => this.state.modalBusy.set(false)), + ) + .subscribe({ + next: res => { + this.state.setResourceData(res.permissions || []); + this.list.get(); + this.toasterService.success('AbpUi::DeletedSuccessfully'); + }, + }); + } + }); + } + + savePermission() { + const isEdit = this.state.isEditMode(); + const providerName = isEdit ? this.state.editProviderName() : this.state.selectedProviderName(); + const providerKey = isEdit ? this.state.editProviderKey() : this.state.selectedProviderKey(); + + if (!isEdit && !this.state.canSave()) { + this.toasterService.warn('AbpPermissionManagement::PleaseSelectProviderAndPermissions'); + return; + } + + this.state.modalBusy.set(true); + this.service + .updateResource(this.resourceName(), this.resourceKey(), { + providerName, + providerKey, + permissions: this.state.selectedPermissions(), + }) + .pipe( + switchMap(() => this.service.getResource(this.resourceName(), this.resourceKey())), + finalize(() => this.state.modalBusy.set(false)), + ) + .subscribe({ + next: res => { + this.state.setResourceData(res.permissions || []); + this.list.get(); + this.toasterService.success('AbpUi::SavedSuccessfully'); + this.state.goToListMode(); + }, + }); + } +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/defaults/default-resource-permission-entity-props.ts b/npm/ng-packs/packages/permission-management/src/lib/defaults/default-resource-permission-entity-props.ts new file mode 100644 index 0000000000..107410f73c --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/defaults/default-resource-permission-entity-props.ts @@ -0,0 +1,34 @@ +import { EntityProp, ePropType } from '@abp/ng.components/extensible'; +import { ResourcePermissionGrantInfoDto } from '@abp/ng.permission-management/proxy'; +import { of } from 'rxjs'; + +export const DEFAULT_RESOURCE_PERMISSION_ENTITY_PROPS = EntityProp.createMany([ + { + type: ePropType.String, + name: 'providerWithKey', + displayName: 'AbpPermissionManagement::Provider', + sortable: false, + valueResolver: data => { + const providerName = data.record.providerName || ''; + const providerDisplayName = data.record.providerDisplayName || data.record.providerKey || ''; + // Get first letter of provider name for abbreviation + const abbr = providerName.charAt(0).toUpperCase(); + return of( + `${abbr}${providerDisplayName}` + ); + }, + }, + { + type: ePropType.String, + name: 'permissions', + displayName: 'AbpPermissionManagement::Permissions', + sortable: false, + valueResolver: data => { + const permissions = data.record.permissions || []; + const pills = permissions + .map(p => `${p.displayName}`) + .join(''); + return of(pills); + }, + }, +]); diff --git a/npm/ng-packs/packages/permission-management/src/lib/defaults/index.ts b/npm/ng-packs/packages/permission-management/src/lib/defaults/index.ts new file mode 100644 index 0000000000..930121e6f1 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/defaults/index.ts @@ -0,0 +1 @@ +export * from './default-resource-permission-entity-props'; diff --git a/npm/ng-packs/packages/permission-management/src/lib/enums/components.ts b/npm/ng-packs/packages/permission-management/src/lib/enums/components.ts index 175d39c999..5db553c4e9 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/enums/components.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/enums/components.ts @@ -1,3 +1,4 @@ export const enum ePermissionManagementComponents { PermissionManagement = 'PermissionManagement.PermissionManagementComponent', + ResourcePermissions = 'PermissionManagement.ResourcePermissionsComponent', } diff --git a/npm/ng-packs/packages/permission-management/src/lib/enums/index.ts b/npm/ng-packs/packages/permission-management/src/lib/enums/index.ts new file mode 100644 index 0000000000..df29235e5b --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/enums/index.ts @@ -0,0 +1,2 @@ +export * from './view-modes'; +export * from './components'; diff --git a/npm/ng-packs/packages/permission-management/src/lib/enums/view-modes.ts b/npm/ng-packs/packages/permission-management/src/lib/enums/view-modes.ts new file mode 100644 index 0000000000..4611dda210 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/enums/view-modes.ts @@ -0,0 +1,5 @@ +export enum eResourcePermissionViewModes { + List = 'list', + Add = 'add', + Edit = 'edit', +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/services/extensions.service.ts b/npm/ng-packs/packages/permission-management/src/lib/services/extensions.service.ts new file mode 100644 index 0000000000..ef9de4bc37 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/services/extensions.service.ts @@ -0,0 +1,23 @@ +import { + ExtensionsService, + mergeWithDefaultProps, +} from '@abp/ng.components/extensible'; +import { inject } from '@angular/core'; +import { + RESOURCE_PERMISSION_ENTITY_PROP_CONTRIBUTORS, + DEFAULT_RESOURCE_PERMISSION_ENTITY_PROPS_MAP, +} from '../tokens'; + +export function configureResourcePermissionExtensions() { + const extensions = inject(ExtensionsService); + + const config = { optional: true }; + + const propContributors = inject(RESOURCE_PERMISSION_ENTITY_PROP_CONTRIBUTORS, config) || {}; + + mergeWithDefaultProps( + extensions.entityProps, + DEFAULT_RESOURCE_PERMISSION_ENTITY_PROPS_MAP, + propContributors, + ); +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/services/index.ts b/npm/ng-packs/packages/permission-management/src/lib/services/index.ts new file mode 100644 index 0000000000..f4dae3a571 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/services/index.ts @@ -0,0 +1,2 @@ +export * from './extensions.service'; +export * from './resource-permission-state.service'; diff --git a/npm/ng-packs/packages/permission-management/src/lib/services/resource-permission-state.service.ts b/npm/ng-packs/packages/permission-management/src/lib/services/resource-permission-state.service.ts new file mode 100644 index 0000000000..e27bcd10c4 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/services/resource-permission-state.service.ts @@ -0,0 +1,164 @@ +import { Injectable, signal, computed } from '@angular/core'; +import { + ResourcePermissionGrantInfoDto, + ResourceProviderDto, + ResourcePermissionDefinitionDto, + SearchProviderKeyInfo, + ResourcePermissionWithProdiverGrantInfoDto, +} from '@abp/ng.permission-management/proxy'; +import { eResourcePermissionViewModes } from '../enums/view-modes'; + +@Injectable() +export class ResourcePermissionStateService { + // View state + readonly viewMode = signal(eResourcePermissionViewModes.List); + readonly modalBusy = signal(false); + readonly hasResourcePermission = signal(false); + readonly hasProviderKeyLookupService = signal(false); + + // Resource data + readonly resourceName = signal(''); + readonly resourceKey = signal(''); + readonly resourceDisplayName = signal(undefined); + + // Permissions data + readonly allResourcePermissions = signal([]); + readonly resourcePermissions = signal([]); + readonly totalCount = signal(0); + readonly permissionDefinitions = signal([]); + readonly permissionsWithProvider = signal([]); + readonly selectedPermissions = signal([]); + + // Provider data + readonly providers = signal([]); + readonly selectedProviderName = signal(''); + readonly selectedProviderKey = signal(''); + + // Edit mode specific + readonly editProviderName = signal(''); + readonly editProviderKey = signal(''); + + // Search state + readonly searchFilter = signal(''); + readonly searchResults = signal([]); + readonly showDropdown = signal(false); + + // Computed properties + readonly isAddMode = computed(() => this.viewMode() === eResourcePermissionViewModes.Add); + readonly isEditMode = computed(() => this.viewMode() === eResourcePermissionViewModes.Edit); + readonly isListMode = computed(() => this.viewMode() === eResourcePermissionViewModes.List); + + readonly currentPermissionsList = computed(() => + this.isAddMode() ? this.permissionDefinitions() : this.permissionsWithProvider() + ); + + readonly allPermissionsSelected = computed(() => { + const definitions = this.currentPermissionsList(); + return definitions.length > 0 && + definitions.every(p => this.selectedPermissions().includes(p.name || '')); + }); + + readonly canSave = computed(() => { + if (this.isAddMode()) { + return !!this.selectedProviderKey() && this.selectedPermissions().length > 0; + } + return this.selectedPermissions().length >= 0; + }); + + // State transition methods + goToListMode() { + this.viewMode.set(eResourcePermissionViewModes.List); + this.selectedPermissions.set([]); + } + + goToAddMode() { + this.viewMode.set(eResourcePermissionViewModes.Add); + this.selectedPermissions.set([]); + this.selectedProviderKey.set(''); + this.searchResults.set([]); + this.searchFilter.set(''); + } + + prepareEditMode(grant: ResourcePermissionGrantInfoDto) { + this.editProviderName.set(grant.providerName || ''); + this.editProviderKey.set(grant.providerKey || ''); + } + + setEditModePermissions(permissions: ResourcePermissionWithProdiverGrantInfoDto[]) { + this.permissionsWithProvider.set(permissions); + this.selectedPermissions.set( + permissions.filter(p => p.isGranted).map(p => p.name || '') + ); + this.viewMode.set(eResourcePermissionViewModes.Edit); + } + + // Permission selection methods + togglePermission(permissionName: string) { + const current = this.selectedPermissions(); + if (current.includes(permissionName)) { + this.selectedPermissions.set(current.filter(p => p !== permissionName)); + } else { + this.selectedPermissions.set([...current, permissionName]); + } + } + + toggleAllPermissions(selectAll: boolean) { + const permissions = this.currentPermissionsList(); + this.selectedPermissions.set( + selectAll ? permissions.map(p => p.name || '') : [] + ); + } + + isPermissionSelected(permissionName: string): boolean { + return this.selectedPermissions().includes(permissionName); + } + + // Provider search methods + onProviderChange(providerName: string) { + this.selectedProviderName.set(providerName); + this.selectedProviderKey.set(''); + this.searchResults.set([]); + this.searchFilter.set(''); + } + + selectProviderKey(key: SearchProviderKeyInfo) { + this.selectedProviderKey.set(key.providerKey || ''); + this.searchFilter.set(key.providerDisplayName || key.providerKey || ''); + this.searchResults.set([]); + this.showDropdown.set(false); + } + + // Reset all state + reset() { + this.viewMode.set(eResourcePermissionViewModes.List); + this.allResourcePermissions.set([]); + this.resourcePermissions.set([]); + this.totalCount.set(0); + this.selectedProviderName.set(''); + this.selectedProviderKey.set(''); + this.searchFilter.set(''); + this.selectedPermissions.set([]); + this.searchResults.set([]); + this.editProviderName.set(''); + this.editProviderKey.set(''); + } + + // Data loading helpers + setResourceData(permissions: ResourcePermissionGrantInfoDto[]) { + this.allResourcePermissions.set(permissions); + this.totalCount.set(permissions.length); + } + + setProviders(providers: ResourceProviderDto[]) { + this.providers.set(providers); + this.hasProviderKeyLookupService.set(providers.length > 0); + if (providers.length) { + this.selectedProviderName.set(providers[0].name || ''); + } + } + + setDefinitions(permissions: ResourcePermissionDefinitionDto[]) { + this.permissionDefinitions.set(permissions); + this.hasResourcePermission.set(permissions.length > 0); + } +} diff --git a/npm/ng-packs/packages/permission-management/src/lib/tokens/extensions.token.ts b/npm/ng-packs/packages/permission-management/src/lib/tokens/extensions.token.ts new file mode 100644 index 0000000000..b87f253eb1 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/tokens/extensions.token.ts @@ -0,0 +1,17 @@ +import { ResourcePermissionGrantInfoDto } from '@abp/ng.permission-management/proxy'; +import { EntityPropContributorCallback } from '@abp/ng.components/extensible'; +import { InjectionToken } from '@angular/core'; +import { DEFAULT_RESOURCE_PERMISSION_ENTITY_PROPS } from '../defaults/default-resource-permission-entity-props'; +import { ePermissionManagementComponents } from '../enums/components'; + +export const DEFAULT_RESOURCE_PERMISSION_ENTITY_PROPS_MAP = { + [ePermissionManagementComponents.ResourcePermissions]: DEFAULT_RESOURCE_PERMISSION_ENTITY_PROPS, +}; + +export const RESOURCE_PERMISSION_ENTITY_PROP_CONTRIBUTORS = new InjectionToken( + 'RESOURCE_PERMISSION_ENTITY_PROP_CONTRIBUTORS', +); + +type EntityPropContributors = Partial<{ + [ePermissionManagementComponents.ResourcePermissions]: EntityPropContributorCallback[]; +}>; diff --git a/npm/ng-packs/packages/permission-management/src/lib/tokens/index.ts b/npm/ng-packs/packages/permission-management/src/lib/tokens/index.ts new file mode 100644 index 0000000000..33233400a2 --- /dev/null +++ b/npm/ng-packs/packages/permission-management/src/lib/tokens/index.ts @@ -0,0 +1 @@ +export * from './extensions.token'; diff --git a/npm/ng-packs/packages/schematics/package.json b/npm/ng-packs/packages/schematics/package.json index ae09d6e777..244791a604 100644 --- a/npm/ng-packs/packages/schematics/package.json +++ b/npm/ng-packs/packages/schematics/package.json @@ -4,16 +4,16 @@ "author": "", "schematics": "./collection.json", "dependencies": { - "@angular-devkit/core": "~20.0.0", - "@angular-devkit/schematics": "~20.0.0", - "@angular/cli": "~20.0.0", + "@angular-devkit/core": "~21.0.0", + "@angular-devkit/schematics": "~21.0.0", + "@angular/cli": "~21.0.0", "got": "^11.5.2", "jsonc-parser": "^2.3.0", "should-quote": "^1.0.0", - "typescript": "~5.8.0" + "typescript": "~5.9.0" }, "devDependencies": { - "@schematics/angular": "~20.0.0", + "@schematics/angular": "~21.0.0", "@types/jest": "29.4.4", "@types/node": "20.2.5", "jest": "29.4.3", diff --git a/npm/ng-packs/packages/schematics/project.json b/npm/ng-packs/packages/schematics/project.json index 7e3f6a8fd3..74a01e9f03 100644 --- a/npm/ng-packs/packages/schematics/project.json +++ b/npm/ng-packs/packages/schematics/project.json @@ -4,6 +4,7 @@ "projectType": "library", "sourceRoot": "packages/schematics/src", "prefix": "abp", + "tags": [], "targets": { "test": { "executor": "@nx/jest:jest", @@ -16,6 +17,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [] + } } diff --git a/npm/ng-packs/packages/schematics/src/collection.json b/npm/ng-packs/packages/schematics/src/collection.json index b84de19733..1116a7e15a 100644 --- a/npm/ng-packs/packages/schematics/src/collection.json +++ b/npm/ng-packs/packages/schematics/src/collection.json @@ -35,6 +35,11 @@ "factory": "./commands/change-theme", "schema": "./commands/change-theme/schema.json" }, + "ai-config": { + "description": "Generates AI configuration files for Angular projects", + "factory": "./commands/ai-config", + "schema": "./commands/ai-config/schema.json" + }, "server": { "factory": "./commands/ssr-add/server", "description": "Create an Angular server app.", diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md new file mode 100644 index 0000000000..32dfab0275 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md @@ -0,0 +1,186 @@ +# 💻 ABP Full-Stack Development Rules +_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_ + +You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**. +You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**. + +--- + +## 🧩 1. General Principles +- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers. +- Follow **modular architecture** — each layer or feature should be independently testable and reusable. +- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**. +- Prioritize **readability, maintainability, and performance**. +- Write **idiomatic** and **self-documenting** code. + +--- + +## ⚙️ 2. ABP / .NET Development Rules + +### Code Style and Structure +- Follow ABP’s standard folder structure: + - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi` +- Write concise, idiomatic C# code using modern language features. +- Apply **modular and layered design** (Domain, Application, Infrastructure, UI). +- Prefer **LINQ** and **lambda expressions** for collection operations. +- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`). + +### Naming Conventions +- **PascalCase** → Classes, Methods, Properties +- **camelCase** → Local variables and private fields +- **UPPER_CASE** → Constants +- Prefix interfaces with **`I`** (e.g., `IUserRepository`). + +### C# and .NET Usage +- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment). +- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging). +- Integrate **Entity Framework Core** with ABP’s repository abstractions. + +### Syntax and Formatting +- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions). +- Use `var` when the type is clear. +- Use `string interpolation` and null-conditional operators. +- Keep code consistent and well-formatted. + +### Error Handling and Validation +- Use exceptions only for exceptional cases. +- Log errors via ABP’s built-in logging or a compatible provider. +- Validate models with **DataAnnotations** or **FluentValidation**. +- Rely on ABP’s global exception middleware for unified responses. +- Return consistent HTTP status codes and error DTOs. + +### API Design +- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**. +- Use **attribute-based routing** and versioning when needed. +- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization). + +### Performance Optimization +- Use `async/await` for I/O operations. +- Use `IDistributedCache` over `IMemoryCache`. +- Avoid N+1 queries — include relations explicitly. +- Implement pagination with `PagedResultDto`. + +### Key Conventions +- Use **Dependency Injection** via ABP’s DI system. +- Apply **repository pattern** or EF Core directly as needed. +- Use **AutoMapper** or ABP object mapping for DTOs. +- Implement **background jobs** with ABP’s job system or `IHostedService`. +- Follow **domain-driven design (DDD)** principles: + - Business rules in Domain layer. + - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc. +- Avoid unnecessary dependencies between layers. + +### Testing +- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing. +- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`). +- Mock dependencies properly and use ABP’s test base classes. + +### Security +- Use **OpenIddict** for authentication & authorization. +- Implement permission checks through ABP’s infrastructure. +- Enforce **HTTPS** and properly configure **CORS**. + +### API Documentation +- Use **Swagger / OpenAPI** (Swashbuckle or NSwag). +- Add XML comments to controllers and DTOs. +- Follow ABP’s documentation conventions for module APIs. + +**Reference Best Practices:** +- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services) +- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories) +- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities) +- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services) +- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects) +- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration) + +--- + +## 🌐 3. Angular / TypeScript Development Rules + +### TypeScript Best Practices +- Enable **strict type checking** in `tsconfig.json`. +- Use **type inference** when the type is obvious. +- Avoid `any`; use `unknown` or generics instead. +- Use interfaces and types for clarity and structure. + +### Angular Best Practices +- Prefer **standalone components** (no `NgModules`). +- Do **NOT** set `standalone: true` manually — it’s default. +- Use **signals** for state management. +- Implement **lazy loading** for feature routes. +- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators. +- Use **`NgOptimizedImage`** for static images (not base64). + +### Components +- Keep components small, focused, and reusable. +- Use `input()` and `output()` functions instead of decorators. +- Use `computed()` for derived state. +- Always set `changeDetection: ChangeDetectionStrategy.OnPush`. +- Use **inline templates** for small components. +- Prefer **Reactive Forms** over template-driven forms. +- Avoid `ngClass` → use `[class]` bindings. +- Avoid `ngStyle` → use `[style]` bindings. + +### State Management +- Manage **local component state** with signals. +- Use **`computed()`** for derived data. +- Keep state transformations **pure and predictable**. +- Avoid `mutate()` on signals — use `update()` or `set()`. + +### Templates +- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives. +- Keep templates minimal and declarative. +- Use the **async pipe** for observable bindings. + +### Services +- Design services for **single responsibility**. +- Provide services using `providedIn: 'root'`. +- Use the **`inject()` function** instead of constructor injection. + +### Component Replacement +ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`: + +**Key Features:** +- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations +- Replace layouts (Application, Account, Empty) +- Replace UI elements (Logo, Routes, NavItems) + +**Basic Usage:** +```typescript +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; + +constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ + component: YourCustomComponent, + key: eIdentityComponents.Roles, + }); +} +``` + +**Important Notes:** +- Component templates must include `` for layouts +- Use the second parameter as `true` for runtime replacement (refreshes route) +- Runtime replacement clears component state and re-runs initialization logic + +**📚 Full Documentation:** +For detailed examples, layout replacement, and advanced scenarios: +[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface) + +--- + +## 🔒 4. Combined Full-Stack Practices +- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**. +- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation). +- Version APIs carefully and handle changes in Angular clients. +- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration. +- Apply **global error handling** and consistent response wrappers in both layers. +- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**. + +--- + +## ✅ Summary +This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring: +- Code is **modular**, **performant**, and **maintainable**. +- Teams follow **consistent conventions** across backend and frontend. +- Every layer (Domain, Application, UI) is **clean, testable, and scalable**. diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md new file mode 100644 index 0000000000..32dfab0275 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md @@ -0,0 +1,186 @@ +# 💻 ABP Full-Stack Development Rules +_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_ + +You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**. +You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**. + +--- + +## 🧩 1. General Principles +- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers. +- Follow **modular architecture** — each layer or feature should be independently testable and reusable. +- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**. +- Prioritize **readability, maintainability, and performance**. +- Write **idiomatic** and **self-documenting** code. + +--- + +## ⚙️ 2. ABP / .NET Development Rules + +### Code Style and Structure +- Follow ABP’s standard folder structure: + - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi` +- Write concise, idiomatic C# code using modern language features. +- Apply **modular and layered design** (Domain, Application, Infrastructure, UI). +- Prefer **LINQ** and **lambda expressions** for collection operations. +- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`). + +### Naming Conventions +- **PascalCase** → Classes, Methods, Properties +- **camelCase** → Local variables and private fields +- **UPPER_CASE** → Constants +- Prefix interfaces with **`I`** (e.g., `IUserRepository`). + +### C# and .NET Usage +- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment). +- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging). +- Integrate **Entity Framework Core** with ABP’s repository abstractions. + +### Syntax and Formatting +- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions). +- Use `var` when the type is clear. +- Use `string interpolation` and null-conditional operators. +- Keep code consistent and well-formatted. + +### Error Handling and Validation +- Use exceptions only for exceptional cases. +- Log errors via ABP’s built-in logging or a compatible provider. +- Validate models with **DataAnnotations** or **FluentValidation**. +- Rely on ABP’s global exception middleware for unified responses. +- Return consistent HTTP status codes and error DTOs. + +### API Design +- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**. +- Use **attribute-based routing** and versioning when needed. +- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization). + +### Performance Optimization +- Use `async/await` for I/O operations. +- Use `IDistributedCache` over `IMemoryCache`. +- Avoid N+1 queries — include relations explicitly. +- Implement pagination with `PagedResultDto`. + +### Key Conventions +- Use **Dependency Injection** via ABP’s DI system. +- Apply **repository pattern** or EF Core directly as needed. +- Use **AutoMapper** or ABP object mapping for DTOs. +- Implement **background jobs** with ABP’s job system or `IHostedService`. +- Follow **domain-driven design (DDD)** principles: + - Business rules in Domain layer. + - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc. +- Avoid unnecessary dependencies between layers. + +### Testing +- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing. +- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`). +- Mock dependencies properly and use ABP’s test base classes. + +### Security +- Use **OpenIddict** for authentication & authorization. +- Implement permission checks through ABP’s infrastructure. +- Enforce **HTTPS** and properly configure **CORS**. + +### API Documentation +- Use **Swagger / OpenAPI** (Swashbuckle or NSwag). +- Add XML comments to controllers and DTOs. +- Follow ABP’s documentation conventions for module APIs. + +**Reference Best Practices:** +- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services) +- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories) +- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities) +- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services) +- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects) +- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration) + +--- + +## 🌐 3. Angular / TypeScript Development Rules + +### TypeScript Best Practices +- Enable **strict type checking** in `tsconfig.json`. +- Use **type inference** when the type is obvious. +- Avoid `any`; use `unknown` or generics instead. +- Use interfaces and types for clarity and structure. + +### Angular Best Practices +- Prefer **standalone components** (no `NgModules`). +- Do **NOT** set `standalone: true` manually — it’s default. +- Use **signals** for state management. +- Implement **lazy loading** for feature routes. +- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators. +- Use **`NgOptimizedImage`** for static images (not base64). + +### Components +- Keep components small, focused, and reusable. +- Use `input()` and `output()` functions instead of decorators. +- Use `computed()` for derived state. +- Always set `changeDetection: ChangeDetectionStrategy.OnPush`. +- Use **inline templates** for small components. +- Prefer **Reactive Forms** over template-driven forms. +- Avoid `ngClass` → use `[class]` bindings. +- Avoid `ngStyle` → use `[style]` bindings. + +### State Management +- Manage **local component state** with signals. +- Use **`computed()`** for derived data. +- Keep state transformations **pure and predictable**. +- Avoid `mutate()` on signals — use `update()` or `set()`. + +### Templates +- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives. +- Keep templates minimal and declarative. +- Use the **async pipe** for observable bindings. + +### Services +- Design services for **single responsibility**. +- Provide services using `providedIn: 'root'`. +- Use the **`inject()` function** instead of constructor injection. + +### Component Replacement +ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`: + +**Key Features:** +- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations +- Replace layouts (Application, Account, Empty) +- Replace UI elements (Logo, Routes, NavItems) + +**Basic Usage:** +```typescript +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; + +constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ + component: YourCustomComponent, + key: eIdentityComponents.Roles, + }); +} +``` + +**Important Notes:** +- Component templates must include `` for layouts +- Use the second parameter as `true` for runtime replacement (refreshes route) +- Runtime replacement clears component state and re-runs initialization logic + +**📚 Full Documentation:** +For detailed examples, layout replacement, and advanced scenarios: +[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface) + +--- + +## 🔒 4. Combined Full-Stack Practices +- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**. +- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation). +- Version APIs carefully and handle changes in Angular clients. +- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration. +- Apply **global error handling** and consistent response wrappers in both layers. +- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**. + +--- + +## ✅ Summary +This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring: +- Code is **modular**, **performant**, and **maintainable**. +- Teams follow **consistent conventions** across backend and frontend. +- Every layer (Domain, Application, UI) is **clean, testable, and scalable**. diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc new file mode 100644 index 0000000000..32dfab0275 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc @@ -0,0 +1,186 @@ +# 💻 ABP Full-Stack Development Rules +_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_ + +You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**. +You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**. + +--- + +## 🧩 1. General Principles +- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers. +- Follow **modular architecture** — each layer or feature should be independently testable and reusable. +- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**. +- Prioritize **readability, maintainability, and performance**. +- Write **idiomatic** and **self-documenting** code. + +--- + +## ⚙️ 2. ABP / .NET Development Rules + +### Code Style and Structure +- Follow ABP’s standard folder structure: + - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi` +- Write concise, idiomatic C# code using modern language features. +- Apply **modular and layered design** (Domain, Application, Infrastructure, UI). +- Prefer **LINQ** and **lambda expressions** for collection operations. +- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`). + +### Naming Conventions +- **PascalCase** → Classes, Methods, Properties +- **camelCase** → Local variables and private fields +- **UPPER_CASE** → Constants +- Prefix interfaces with **`I`** (e.g., `IUserRepository`). + +### C# and .NET Usage +- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment). +- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging). +- Integrate **Entity Framework Core** with ABP’s repository abstractions. + +### Syntax and Formatting +- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions). +- Use `var` when the type is clear. +- Use `string interpolation` and null-conditional operators. +- Keep code consistent and well-formatted. + +### Error Handling and Validation +- Use exceptions only for exceptional cases. +- Log errors via ABP’s built-in logging or a compatible provider. +- Validate models with **DataAnnotations** or **FluentValidation**. +- Rely on ABP’s global exception middleware for unified responses. +- Return consistent HTTP status codes and error DTOs. + +### API Design +- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**. +- Use **attribute-based routing** and versioning when needed. +- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization). + +### Performance Optimization +- Use `async/await` for I/O operations. +- Use `IDistributedCache` over `IMemoryCache`. +- Avoid N+1 queries — include relations explicitly. +- Implement pagination with `PagedResultDto`. + +### Key Conventions +- Use **Dependency Injection** via ABP’s DI system. +- Apply **repository pattern** or EF Core directly as needed. +- Use **AutoMapper** or ABP object mapping for DTOs. +- Implement **background jobs** with ABP’s job system or `IHostedService`. +- Follow **domain-driven design (DDD)** principles: + - Business rules in Domain layer. + - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc. +- Avoid unnecessary dependencies between layers. + +### Testing +- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing. +- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`). +- Mock dependencies properly and use ABP’s test base classes. + +### Security +- Use **OpenIddict** for authentication & authorization. +- Implement permission checks through ABP’s infrastructure. +- Enforce **HTTPS** and properly configure **CORS**. + +### API Documentation +- Use **Swagger / OpenAPI** (Swashbuckle or NSwag). +- Add XML comments to controllers and DTOs. +- Follow ABP’s documentation conventions for module APIs. + +**Reference Best Practices:** +- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services) +- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories) +- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities) +- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services) +- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects) +- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration) + +--- + +## 🌐 3. Angular / TypeScript Development Rules + +### TypeScript Best Practices +- Enable **strict type checking** in `tsconfig.json`. +- Use **type inference** when the type is obvious. +- Avoid `any`; use `unknown` or generics instead. +- Use interfaces and types for clarity and structure. + +### Angular Best Practices +- Prefer **standalone components** (no `NgModules`). +- Do **NOT** set `standalone: true` manually — it’s default. +- Use **signals** for state management. +- Implement **lazy loading** for feature routes. +- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators. +- Use **`NgOptimizedImage`** for static images (not base64). + +### Components +- Keep components small, focused, and reusable. +- Use `input()` and `output()` functions instead of decorators. +- Use `computed()` for derived state. +- Always set `changeDetection: ChangeDetectionStrategy.OnPush`. +- Use **inline templates** for small components. +- Prefer **Reactive Forms** over template-driven forms. +- Avoid `ngClass` → use `[class]` bindings. +- Avoid `ngStyle` → use `[style]` bindings. + +### State Management +- Manage **local component state** with signals. +- Use **`computed()`** for derived data. +- Keep state transformations **pure and predictable**. +- Avoid `mutate()` on signals — use `update()` or `set()`. + +### Templates +- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives. +- Keep templates minimal and declarative. +- Use the **async pipe** for observable bindings. + +### Services +- Design services for **single responsibility**. +- Provide services using `providedIn: 'root'`. +- Use the **`inject()` function** instead of constructor injection. + +### Component Replacement +ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`: + +**Key Features:** +- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations +- Replace layouts (Application, Account, Empty) +- Replace UI elements (Logo, Routes, NavItems) + +**Basic Usage:** +```typescript +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; + +constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ + component: YourCustomComponent, + key: eIdentityComponents.Roles, + }); +} +``` + +**Important Notes:** +- Component templates must include `` for layouts +- Use the second parameter as `true` for runtime replacement (refreshes route) +- Runtime replacement clears component state and re-runs initialization logic + +**📚 Full Documentation:** +For detailed examples, layout replacement, and advanced scenarios: +[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface) + +--- + +## 🔒 4. Combined Full-Stack Practices +- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**. +- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation). +- Version APIs carefully and handle changes in Angular clients. +- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration. +- Apply **global error handling** and consistent response wrappers in both layers. +- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**. + +--- + +## ✅ Summary +This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring: +- Code is **modular**, **performant**, and **maintainable**. +- Teams follow **consistent conventions** across backend and frontend. +- Every layer (Domain, Application, UI) is **clean, testable, and scalable**. diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/files/gemini/.gemini/GEMINI.md b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/gemini/.gemini/GEMINI.md new file mode 100644 index 0000000000..32dfab0275 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/gemini/.gemini/GEMINI.md @@ -0,0 +1,186 @@ +# 💻 ABP Full-Stack Development Rules +_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_ + +You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**. +You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**. + +--- + +## 🧩 1. General Principles +- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers. +- Follow **modular architecture** — each layer or feature should be independently testable and reusable. +- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**. +- Prioritize **readability, maintainability, and performance**. +- Write **idiomatic** and **self-documenting** code. + +--- + +## ⚙️ 2. ABP / .NET Development Rules + +### Code Style and Structure +- Follow ABP’s standard folder structure: + - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi` +- Write concise, idiomatic C# code using modern language features. +- Apply **modular and layered design** (Domain, Application, Infrastructure, UI). +- Prefer **LINQ** and **lambda expressions** for collection operations. +- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`). + +### Naming Conventions +- **PascalCase** → Classes, Methods, Properties +- **camelCase** → Local variables and private fields +- **UPPER_CASE** → Constants +- Prefix interfaces with **`I`** (e.g., `IUserRepository`). + +### C# and .NET Usage +- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment). +- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging). +- Integrate **Entity Framework Core** with ABP’s repository abstractions. + +### Syntax and Formatting +- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions). +- Use `var` when the type is clear. +- Use `string interpolation` and null-conditional operators. +- Keep code consistent and well-formatted. + +### Error Handling and Validation +- Use exceptions only for exceptional cases. +- Log errors via ABP’s built-in logging or a compatible provider. +- Validate models with **DataAnnotations** or **FluentValidation**. +- Rely on ABP’s global exception middleware for unified responses. +- Return consistent HTTP status codes and error DTOs. + +### API Design +- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**. +- Use **attribute-based routing** and versioning when needed. +- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization). + +### Performance Optimization +- Use `async/await` for I/O operations. +- Use `IDistributedCache` over `IMemoryCache`. +- Avoid N+1 queries — include relations explicitly. +- Implement pagination with `PagedResultDto`. + +### Key Conventions +- Use **Dependency Injection** via ABP’s DI system. +- Apply **repository pattern** or EF Core directly as needed. +- Use **AutoMapper** or ABP object mapping for DTOs. +- Implement **background jobs** with ABP’s job system or `IHostedService`. +- Follow **domain-driven design (DDD)** principles: + - Business rules in Domain layer. + - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc. +- Avoid unnecessary dependencies between layers. + +### Testing +- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing. +- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`). +- Mock dependencies properly and use ABP’s test base classes. + +### Security +- Use **OpenIddict** for authentication & authorization. +- Implement permission checks through ABP’s infrastructure. +- Enforce **HTTPS** and properly configure **CORS**. + +### API Documentation +- Use **Swagger / OpenAPI** (Swashbuckle or NSwag). +- Add XML comments to controllers and DTOs. +- Follow ABP’s documentation conventions for module APIs. + +**Reference Best Practices:** +- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services) +- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories) +- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities) +- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services) +- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects) +- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration) + +--- + +## 🌐 3. Angular / TypeScript Development Rules + +### TypeScript Best Practices +- Enable **strict type checking** in `tsconfig.json`. +- Use **type inference** when the type is obvious. +- Avoid `any`; use `unknown` or generics instead. +- Use interfaces and types for clarity and structure. + +### Angular Best Practices +- Prefer **standalone components** (no `NgModules`). +- Do **NOT** set `standalone: true` manually — it’s default. +- Use **signals** for state management. +- Implement **lazy loading** for feature routes. +- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators. +- Use **`NgOptimizedImage`** for static images (not base64). + +### Components +- Keep components small, focused, and reusable. +- Use `input()` and `output()` functions instead of decorators. +- Use `computed()` for derived state. +- Always set `changeDetection: ChangeDetectionStrategy.OnPush`. +- Use **inline templates** for small components. +- Prefer **Reactive Forms** over template-driven forms. +- Avoid `ngClass` → use `[class]` bindings. +- Avoid `ngStyle` → use `[style]` bindings. + +### State Management +- Manage **local component state** with signals. +- Use **`computed()`** for derived data. +- Keep state transformations **pure and predictable**. +- Avoid `mutate()` on signals — use `update()` or `set()`. + +### Templates +- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives. +- Keep templates minimal and declarative. +- Use the **async pipe** for observable bindings. + +### Services +- Design services for **single responsibility**. +- Provide services using `providedIn: 'root'`. +- Use the **`inject()` function** instead of constructor injection. + +### Component Replacement +ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`: + +**Key Features:** +- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations +- Replace layouts (Application, Account, Empty) +- Replace UI elements (Logo, Routes, NavItems) + +**Basic Usage:** +```typescript +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; + +constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ + component: YourCustomComponent, + key: eIdentityComponents.Roles, + }); +} +``` + +**Important Notes:** +- Component templates must include `` for layouts +- Use the second parameter as `true` for runtime replacement (refreshes route) +- Runtime replacement clears component state and re-runs initialization logic + +**📚 Full Documentation:** +For detailed examples, layout replacement, and advanced scenarios: +[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface) + +--- + +## 🔒 4. Combined Full-Stack Practices +- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**. +- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation). +- Version APIs carefully and handle changes in Angular clients. +- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration. +- Apply **global error handling** and consistent response wrappers in both layers. +- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**. + +--- + +## ✅ Summary +This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring: +- Code is **modular**, **performant**, and **maintainable**. +- Teams follow **consistent conventions** across backend and frontend. +- Every layer (Domain, Application, UI) is **clean, testable, and scalable**. diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/files/junie/.junie/guidelines.md b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/junie/.junie/guidelines.md new file mode 100644 index 0000000000..32dfab0275 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/junie/.junie/guidelines.md @@ -0,0 +1,186 @@ +# 💻 ABP Full-Stack Development Rules +_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_ + +You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**. +You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**. + +--- + +## 🧩 1. General Principles +- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers. +- Follow **modular architecture** — each layer or feature should be independently testable and reusable. +- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**. +- Prioritize **readability, maintainability, and performance**. +- Write **idiomatic** and **self-documenting** code. + +--- + +## ⚙️ 2. ABP / .NET Development Rules + +### Code Style and Structure +- Follow ABP’s standard folder structure: + - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi` +- Write concise, idiomatic C# code using modern language features. +- Apply **modular and layered design** (Domain, Application, Infrastructure, UI). +- Prefer **LINQ** and **lambda expressions** for collection operations. +- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`). + +### Naming Conventions +- **PascalCase** → Classes, Methods, Properties +- **camelCase** → Local variables and private fields +- **UPPER_CASE** → Constants +- Prefix interfaces with **`I`** (e.g., `IUserRepository`). + +### C# and .NET Usage +- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment). +- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging). +- Integrate **Entity Framework Core** with ABP’s repository abstractions. + +### Syntax and Formatting +- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions). +- Use `var` when the type is clear. +- Use `string interpolation` and null-conditional operators. +- Keep code consistent and well-formatted. + +### Error Handling and Validation +- Use exceptions only for exceptional cases. +- Log errors via ABP’s built-in logging or a compatible provider. +- Validate models with **DataAnnotations** or **FluentValidation**. +- Rely on ABP’s global exception middleware for unified responses. +- Return consistent HTTP status codes and error DTOs. + +### API Design +- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**. +- Use **attribute-based routing** and versioning when needed. +- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization). + +### Performance Optimization +- Use `async/await` for I/O operations. +- Use `IDistributedCache` over `IMemoryCache`. +- Avoid N+1 queries — include relations explicitly. +- Implement pagination with `PagedResultDto`. + +### Key Conventions +- Use **Dependency Injection** via ABP’s DI system. +- Apply **repository pattern** or EF Core directly as needed. +- Use **AutoMapper** or ABP object mapping for DTOs. +- Implement **background jobs** with ABP’s job system or `IHostedService`. +- Follow **domain-driven design (DDD)** principles: + - Business rules in Domain layer. + - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc. +- Avoid unnecessary dependencies between layers. + +### Testing +- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing. +- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`). +- Mock dependencies properly and use ABP’s test base classes. + +### Security +- Use **OpenIddict** for authentication & authorization. +- Implement permission checks through ABP’s infrastructure. +- Enforce **HTTPS** and properly configure **CORS**. + +### API Documentation +- Use **Swagger / OpenAPI** (Swashbuckle or NSwag). +- Add XML comments to controllers and DTOs. +- Follow ABP’s documentation conventions for module APIs. + +**Reference Best Practices:** +- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services) +- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories) +- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities) +- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services) +- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects) +- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration) + +--- + +## 🌐 3. Angular / TypeScript Development Rules + +### TypeScript Best Practices +- Enable **strict type checking** in `tsconfig.json`. +- Use **type inference** when the type is obvious. +- Avoid `any`; use `unknown` or generics instead. +- Use interfaces and types for clarity and structure. + +### Angular Best Practices +- Prefer **standalone components** (no `NgModules`). +- Do **NOT** set `standalone: true` manually — it’s default. +- Use **signals** for state management. +- Implement **lazy loading** for feature routes. +- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators. +- Use **`NgOptimizedImage`** for static images (not base64). + +### Components +- Keep components small, focused, and reusable. +- Use `input()` and `output()` functions instead of decorators. +- Use `computed()` for derived state. +- Always set `changeDetection: ChangeDetectionStrategy.OnPush`. +- Use **inline templates** for small components. +- Prefer **Reactive Forms** over template-driven forms. +- Avoid `ngClass` → use `[class]` bindings. +- Avoid `ngStyle` → use `[style]` bindings. + +### State Management +- Manage **local component state** with signals. +- Use **`computed()`** for derived data. +- Keep state transformations **pure and predictable**. +- Avoid `mutate()` on signals — use `update()` or `set()`. + +### Templates +- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives. +- Keep templates minimal and declarative. +- Use the **async pipe** for observable bindings. + +### Services +- Design services for **single responsibility**. +- Provide services using `providedIn: 'root'`. +- Use the **`inject()` function** instead of constructor injection. + +### Component Replacement +ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`: + +**Key Features:** +- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations +- Replace layouts (Application, Account, Empty) +- Replace UI elements (Logo, Routes, NavItems) + +**Basic Usage:** +```typescript +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; + +constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ + component: YourCustomComponent, + key: eIdentityComponents.Roles, + }); +} +``` + +**Important Notes:** +- Component templates must include `` for layouts +- Use the second parameter as `true` for runtime replacement (refreshes route) +- Runtime replacement clears component state and re-runs initialization logic + +**📚 Full Documentation:** +For detailed examples, layout replacement, and advanced scenarios: +[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface) + +--- + +## 🔒 4. Combined Full-Stack Practices +- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**. +- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation). +- Version APIs carefully and handle changes in Angular clients. +- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration. +- Apply **global error handling** and consistent response wrappers in both layers. +- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**. + +--- + +## ✅ Summary +This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring: +- Code is **modular**, **performant**, and **maintainable**. +- Teams follow **consistent conventions** across backend and frontend. +- Every layer (Domain, Application, UI) is **clean, testable, and scalable**. diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md new file mode 100644 index 0000000000..32dfab0275 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md @@ -0,0 +1,186 @@ +# 💻 ABP Full-Stack Development Rules +_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_ + +You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**. +You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**. + +--- + +## 🧩 1. General Principles +- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers. +- Follow **modular architecture** — each layer or feature should be independently testable and reusable. +- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**. +- Prioritize **readability, maintainability, and performance**. +- Write **idiomatic** and **self-documenting** code. + +--- + +## ⚙️ 2. ABP / .NET Development Rules + +### Code Style and Structure +- Follow ABP’s standard folder structure: + - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi` +- Write concise, idiomatic C# code using modern language features. +- Apply **modular and layered design** (Domain, Application, Infrastructure, UI). +- Prefer **LINQ** and **lambda expressions** for collection operations. +- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`). + +### Naming Conventions +- **PascalCase** → Classes, Methods, Properties +- **camelCase** → Local variables and private fields +- **UPPER_CASE** → Constants +- Prefix interfaces with **`I`** (e.g., `IUserRepository`). + +### C# and .NET Usage +- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment). +- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging). +- Integrate **Entity Framework Core** with ABP’s repository abstractions. + +### Syntax and Formatting +- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions). +- Use `var` when the type is clear. +- Use `string interpolation` and null-conditional operators. +- Keep code consistent and well-formatted. + +### Error Handling and Validation +- Use exceptions only for exceptional cases. +- Log errors via ABP’s built-in logging or a compatible provider. +- Validate models with **DataAnnotations** or **FluentValidation**. +- Rely on ABP’s global exception middleware for unified responses. +- Return consistent HTTP status codes and error DTOs. + +### API Design +- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**. +- Use **attribute-based routing** and versioning when needed. +- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization). + +### Performance Optimization +- Use `async/await` for I/O operations. +- Use `IDistributedCache` over `IMemoryCache`. +- Avoid N+1 queries — include relations explicitly. +- Implement pagination with `PagedResultDto`. + +### Key Conventions +- Use **Dependency Injection** via ABP’s DI system. +- Apply **repository pattern** or EF Core directly as needed. +- Use **AutoMapper** or ABP object mapping for DTOs. +- Implement **background jobs** with ABP’s job system or `IHostedService`. +- Follow **domain-driven design (DDD)** principles: + - Business rules in Domain layer. + - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc. +- Avoid unnecessary dependencies between layers. + +### Testing +- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing. +- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`). +- Mock dependencies properly and use ABP’s test base classes. + +### Security +- Use **OpenIddict** for authentication & authorization. +- Implement permission checks through ABP’s infrastructure. +- Enforce **HTTPS** and properly configure **CORS**. + +### API Documentation +- Use **Swagger / OpenAPI** (Swashbuckle or NSwag). +- Add XML comments to controllers and DTOs. +- Follow ABP’s documentation conventions for module APIs. + +**Reference Best Practices:** +- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services) +- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories) +- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities) +- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services) +- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects) +- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration) + +--- + +## 🌐 3. Angular / TypeScript Development Rules + +### TypeScript Best Practices +- Enable **strict type checking** in `tsconfig.json`. +- Use **type inference** when the type is obvious. +- Avoid `any`; use `unknown` or generics instead. +- Use interfaces and types for clarity and structure. + +### Angular Best Practices +- Prefer **standalone components** (no `NgModules`). +- Do **NOT** set `standalone: true` manually — it’s default. +- Use **signals** for state management. +- Implement **lazy loading** for feature routes. +- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators. +- Use **`NgOptimizedImage`** for static images (not base64). + +### Components +- Keep components small, focused, and reusable. +- Use `input()` and `output()` functions instead of decorators. +- Use `computed()` for derived state. +- Always set `changeDetection: ChangeDetectionStrategy.OnPush`. +- Use **inline templates** for small components. +- Prefer **Reactive Forms** over template-driven forms. +- Avoid `ngClass` → use `[class]` bindings. +- Avoid `ngStyle` → use `[style]` bindings. + +### State Management +- Manage **local component state** with signals. +- Use **`computed()`** for derived data. +- Keep state transformations **pure and predictable**. +- Avoid `mutate()` on signals — use `update()` or `set()`. + +### Templates +- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives. +- Keep templates minimal and declarative. +- Use the **async pipe** for observable bindings. + +### Services +- Design services for **single responsibility**. +- Provide services using `providedIn: 'root'`. +- Use the **`inject()` function** instead of constructor injection. + +### Component Replacement +ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`: + +**Key Features:** +- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations +- Replace layouts (Application, Account, Empty) +- Replace UI elements (Logo, Routes, NavItems) + +**Basic Usage:** +```typescript +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; + +constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ + component: YourCustomComponent, + key: eIdentityComponents.Roles, + }); +} +``` + +**Important Notes:** +- Component templates must include `` for layouts +- Use the second parameter as `true` for runtime replacement (refreshes route) +- Runtime replacement clears component state and re-runs initialization logic + +**📚 Full Documentation:** +For detailed examples, layout replacement, and advanced scenarios: +[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface) + +--- + +## 🔒 4. Combined Full-Stack Practices +- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**. +- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation). +- Version APIs carefully and handle changes in Angular clients. +- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration. +- Apply **global error handling** and consistent response wrappers in both layers. +- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**. + +--- + +## ✅ Summary +This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring: +- Code is **modular**, **performant**, and **maintainable**. +- Teams follow **consistent conventions** across backend and frontend. +- Every layer (Domain, Application, UI) is **clean, testable, and scalable**. diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts b/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts new file mode 100644 index 0000000000..2cc2da1165 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts @@ -0,0 +1,118 @@ +import { + Rule, + SchematicsException, + Tree, + apply, + url, + mergeWith, + MergeStrategy, + filter, + chain, +} from '@angular-devkit/schematics'; +import { join, normalize } from '@angular-devkit/core'; +import { AiConfigSchema, AiTool } from './model'; +import { getWorkspace } from '../../utils'; + +export default function (options: AiConfigSchema): Rule { + return async (tree: Tree) => { + if (!options.tool || options.tool.trim() === '') { + console.log('ℹ️ No AI tools selected. Skipping configuration generation.'); + console.log(''); + console.log('💡 Usage examples:'); + console.log(' ng g @abp/ng.schematics:ai-config --tool=claude,cursor'); + console.log(' ng g @abp/ng.schematics:ai-config --tool="claude, cursor"'); + console.log(' ng g @abp/ng.schematics:ai-config --tool=gemini --tool=cursor'); + console.log(' ng g @abp/ng.schematics:ai-config --tool=gemini --target-project=my-app'); + console.log(''); + console.log('Available tools: claude, copilot, cursor, gemini, junie, windsurf'); + return tree; + } + + const tools = options.tool.split(/[\s,]+/).filter(t => t) as AiTool[]; + + const validTools: AiTool[] = ['claude', 'copilot', 'cursor', 'gemini', 'junie', 'windsurf']; + const invalidTools = tools.filter(tool => !validTools.includes(tool)); + if (invalidTools.length > 0) { + throw new SchematicsException( + `Invalid AI tool(s): ${invalidTools.join(', ')}. Valid options are: ${validTools.join(', ')}`, + ); + } + + if (tools.length === 0) { + console.log('ℹ️ No AI tools selected. Skipping configuration generation.'); + return tree; + } + + const workspace = await getWorkspace(tree); + let targetPath = '/'; + + if (options.targetProject) { + const trimmedTargetProject = options.targetProject.trim(); + const project = workspace.projects.get(trimmedTargetProject); + if (!project) { + throw new SchematicsException(`Project "${trimmedTargetProject}" not found in workspace.`); + } + targetPath = normalize(project.root); + } + + console.log('🚀 Generating AI configuration files...'); + console.log(`📁 Target path: ${targetPath}`); + console.log(`🤖 Selected tools: ${tools.join(', ')}`); + + const rules: Rule[] = tools.map(tool => + generateConfigForTool(tool, targetPath, options.overwrite || false), + ); + + return chain([ + ...rules, + (tree: Tree) => { + console.log('✅ AI configuration files generated successfully!'); + console.log('\n📝 Generated files:'); + + tools.forEach(tool => { + const configPath = getConfigPath(tool, targetPath); + console.log(` - ${configPath}`); + }); + + console.log('\n💡 Tip: Restart your IDE or AI tool to apply the new configurations.'); + + return tree; + }, + ]); + }; +} + +function generateConfigForTool(tool: AiTool, targetPath: string, overwrite: boolean): Rule { + return (tree: Tree) => { + const configPath = getConfigPath(tool, targetPath); + + if (tree.exists(configPath) && !overwrite) { + console.log(`⚠️ Configuration file already exists: ${configPath}`); + console.log(` Use --overwrite flag to replace existing files.`); + return tree; + } + + const sourceDir = `./files/${tool}`; + const source = apply(url(sourceDir), [ + filter(path => { + return !path.endsWith('.DS_Store'); + }), + ]); + + return mergeWith(source, overwrite ? MergeStrategy.Overwrite : MergeStrategy.Default); + }; +} + +function getConfigPath(tool: AiTool, basePath: string): string { + const configFiles: Record = { + claude: '.claude/CLAUDE.md', + copilot: '.github/copilot-instructions.md', + cursor: '.cursor/rules/cursor.mdc', + gemini: '.gemini/GEMINI.md', + junie: '.junie/guidelines.md', + windsurf: '.windsurf/rules/guidelines.md', + }; + + const configFile = configFiles[tool]; + return join(normalize(basePath), configFile); +} diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/model.ts b/npm/ng-packs/packages/schematics/src/commands/ai-config/model.ts new file mode 100644 index 0000000000..ab871971c2 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/model.ts @@ -0,0 +1,12 @@ +export type AiTool = 'claude' | 'copilot' | 'cursor' | 'gemini' | 'junie' | 'windsurf'; + +export interface AiConfigSchema { + tool?: string; + targetProject?: string; + overwrite?: boolean; +} + +export interface AiConfigFile { + path: string; + content: string; +} diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/schema.json b/npm/ng-packs/packages/schematics/src/commands/ai-config/schema.json new file mode 100644 index 0000000000..0d5e0117ed --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/schema.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/schema", + "$id": "SchematicsABPAiConfig", + "title": "ABP AI Configuration Generator Schema", + "type": "object", + "properties": { + "tool": { + "description": "Comma-separated list of AI tools (e.g., claude,cursor,gemini)", + "type": "string", + "x-prompt": { + "message": "Which AI tools would you like to generate configuration files for? (comma-separated)", + "type": "input" + } + }, + "targetProject": { + "description": "The target project name to generate AI configuration files for", + "type": "string", + "x-prompt": { + "message": "Which project would you like to generate AI config for?", + "type": "input" + } + }, + "overwrite": { + "description": "Overwrite existing AI configuration files", + "type": "boolean", + "default": false + } + }, + "required": [] +} diff --git a/npm/ng-packs/packages/setting-management/project.json b/npm/ng-packs/packages/setting-management/project.json index 334e58be26..57f72234fb 100644 --- a/npm/ng-packs/packages/setting-management/project.json +++ b/npm/ng-packs/packages/setting-management/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/setting-management/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared", "components"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared", "components"] + } } diff --git a/npm/ng-packs/packages/tenant-management/project.json b/npm/ng-packs/packages/tenant-management/project.json index c2f4c3bc8c..2394793380 100644 --- a/npm/ng-packs/packages/tenant-management/project.json +++ b/npm/ng-packs/packages/tenant-management/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/tenant-management/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared", "feature-management"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared", "feature-management"] + } } diff --git a/npm/ng-packs/packages/theme-basic/project.json b/npm/ng-packs/packages/theme-basic/project.json index 5c2936576f..be0464cc18 100644 --- a/npm/ng-packs/packages/theme-basic/project.json +++ b/npm/ng-packs/packages/theme-basic/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/theme-basic/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "theme-shared", "account-core"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "theme-shared", "account-core"] + } } diff --git a/npm/ng-packs/packages/theme-shared/package.json b/npm/ng-packs/packages/theme-shared/package.json index 6f8b7e9cf8..a8baa892f3 100644 --- a/npm/ng-packs/packages/theme-shared/package.json +++ b/npm/ng-packs/packages/theme-shared/package.json @@ -9,10 +9,10 @@ "dependencies": { "@abp/ng.core": "~10.0.2", "@fortawesome/fontawesome-free": "^6.0.0", - "@ng-bootstrap/ng-bootstrap": "~19.0.0", + "@ng-bootstrap/ng-bootstrap": "~20.0.0", "@ngx-validate/core": "^0.2.0", "@popperjs/core": "~2.11.0", - "@swimlane/ngx-datatable": "^21.0.0", + "@swimlane/ngx-datatable": "~22.0.0", "bootstrap": "^5.0.0", "tslib": "^2.0.0" }, diff --git a/npm/ng-packs/packages/theme-shared/project.json b/npm/ng-packs/packages/theme-shared/project.json index 6ad2a9db6d..a77551187c 100644 --- a/npm/ng-packs/packages/theme-shared/project.json +++ b/npm/ng-packs/packages/theme-shared/project.json @@ -4,6 +4,8 @@ "projectType": "library", "sourceRoot": "packages/theme-shared/src", "prefix": "abp", + "tags": [], + "implicitDependencies": ["core", "oauth"], "targets": { "build": { "executor": "@nx/angular:package", @@ -32,7 +34,5 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] } - }, - "tags": [], - "implicitDependencies": ["core", "oauth"] + } } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts index aca2149f8b..9c884cb937 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts @@ -46,7 +46,7 @@ export class ToastContainerComponent implements OnInit { }); } - @HostListener('window:resize', ['$event']) + @HostListener('window:resize') onWindowResize() { this.setDefaultRight(); } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts index b4c0d419c3..951de1a6f2 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts @@ -8,7 +8,7 @@ import { inject, PLATFORM_ID, } from '@angular/core'; -import { ColumnMode, DatatableComponent, ScrollerComponent } from '@swimlane/ngx-datatable'; +import { ColumnMode, DatatableComponent } from '@swimlane/ngx-datatable'; import { fromEvent, Subscription } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; @@ -41,7 +41,7 @@ export class NgxDatatableDefaultDirective implements AfterViewInit, OnDestroy { this.table.virtualization = false; } - private fixHorizontalGap(scroller: ScrollerComponent) { + private fixHorizontalGap(scroller: any) { const { body, documentElement } = this.document; if (isPlatformBrowser(this.platformId)) { if (documentElement.scrollHeight !== documentElement.clientHeight) { diff --git a/npm/ng-packs/scripts/build-schematics.ts b/npm/ng-packs/scripts/build-schematics.ts index c953a362ca..bdf2e66392 100644 --- a/npm/ng-packs/scripts/build-schematics.ts +++ b/npm/ng-packs/scripts/build-schematics.ts @@ -22,6 +22,8 @@ const PACKAGE_TO_BUILD = 'schematics'; const FILES_TO_COPY_AFTER_BUILD: (FileCopy | string)[] = [ { src: 'src/commands/create-lib/schema.json', dest: 'commands/create-lib/schema.json' }, { src: 'src/commands/change-theme/schema.json', dest: 'commands/change-theme/schema.json' }, + { src: 'src/commands/ai-config/schema.json', dest: 'commands/ai-config/schema.json' }, + { src: 'src/commands/ai-config/files', dest: 'commands/ai-config/files' }, { src: 'src/commands/create-lib/files-package', dest: 'commands/create-lib/files-package' }, { src: 'src/commands/create-lib/files-package-standalone', dest: 'commands/create-lib/files-package-standalone' }, { diff --git a/npm/ng-packs/tsconfig.base.json b/npm/ng-packs/tsconfig.base.json index f863f18520..496d83ca67 100644 --- a/npm/ng-packs/tsconfig.base.json +++ b/npm/ng-packs/tsconfig.base.json @@ -4,12 +4,12 @@ "strict": false, "sourceMap": true, "declaration": false, - "moduleResolution": "node", + "moduleResolution": "bundler", "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, - "target": "es2020", - "module": "esnext", + "target": "ES2020", + "module": "ES2022", "lib": ["es2020", "dom"], "esModuleInterop": true, "baseUrl": "./", @@ -22,6 +22,7 @@ "@abp/ng.components": ["packages/components/src/public-api.ts"], "@abp/ng.components/chart.js": ["packages/components/chart.js/src/public-api.ts"], "@abp/ng.components/extensible": ["packages/components/extensible/src/public-api.ts"], + "@abp/ng.components/lookup": ["packages/components/lookup/src/public-api.ts"], "@abp/ng.components/page": ["packages/components/page/src/public-api.ts"], "@abp/ng.components/tree": ["packages/components/tree/src/public-api.ts"], "@abp/ng.core": ["packages/core/src/public-api.ts"], @@ -47,7 +48,10 @@ "@abp/ng.theme.basic/testing": ["packages/theme-basic/testing/src/public-api.ts"], "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], "@abp/ng.theme.shared/testing": ["packages/theme-shared/testing/src/public-api.ts"], - "@abp/nx.generators": ["packages/generators/src/index.ts"] + "@abp/nx.generators": ["packages/generators/src/index.ts"], + "ng-zorro-antd/core/no-animation": [ + "node_modules/ng-zorro-antd/core/no-animation" + ] } }, "exclude": ["node_modules", "tmp"] diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index 20b08ac2ac..6fbc34e80c 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -148,9 +148,11 @@ $projects = ( "framework/src/Volo.Abp.BackgroundJobs.HangFire", "framework/src/Volo.Abp.BackgroundJobs.RabbitMQ", "framework/src/Volo.Abp.BackgroundJobs.Quartz", + "framework/src/Volo.Abp.BackgroundJobs.TickerQ", "framework/src/Volo.Abp.BackgroundWorkers", "framework/src/Volo.Abp.BackgroundWorkers.Quartz", "framework/src/Volo.Abp.BackgroundWorkers.Hangfire", + "framework/src/Volo.Abp.BackgroundWorkers.TickerQ", "framework/src/Volo.Abp.BlazoriseUI", "framework/src/Volo.Abp.BlobStoring", "framework/src/Volo.Abp.BlobStoring.FileSystem", @@ -201,6 +203,7 @@ $projects = ( "framework/src/Volo.Abp.GlobalFeatures", "framework/src/Volo.Abp.Guids", "framework/src/Volo.Abp.HangFire", + "framework/src/Volo.Abp.TickerQ", "framework/src/Volo.Abp.Http.Abstractions", "framework/src/Volo.Abp.Http.Client", "framework/src/Volo.Abp.Http.Client.Dapr", diff --git a/templates/app-nolayers/angular/package.json b/templates/app-nolayers/angular/package.json index 10b02876dd..6a8c89da4e 100644 --- a/templates/app-nolayers/angular/package.json +++ b/templates/app-nolayers/angular/package.json @@ -12,52 +12,51 @@ }, "private": true, "dependencies": { - "@abp/ng.account": "~10.0.2", - "@abp/ng.components": "~10.0.2", - "@abp/ng.core": "~10.0.2", - "@abp/ng.identity": "~10.0.2", - "@abp/ng.oauth": "~10.0.2", - "@abp/ng.setting-management": "~10.0.2", - "@abp/ng.tenant-management": "~10.0.2", - "@abp/ng.theme.lepton-x": "~5.0.2", - "@abp/ng.theme.shared": "~10.0.2", - "@angular/animations": "~20.0.0", - "@angular/common": "~20.0.0", - "@angular/compiler": "~20.0.0", - "@angular/core": "~20.0.0", - "@angular/forms": "~20.0.0", - "@angular/localize": "~20.0.0", - "@angular/platform-browser": "~20.0.0", - "@angular/platform-browser-dynamic": "~20.0.0", - "@angular/router": "~20.0.0", + "@abp/ng.account": "~10.0.1", + "@abp/ng.components": "~10.0.1", + "@abp/ng.core": "~10.0.1", + "@abp/ng.identity": "~10.0.1", + "@abp/ng.oauth": "~10.0.1", + "@abp/ng.setting-management": "~10.0.1", + "@abp/ng.tenant-management": "~10.0.1", + "@abp/ng.theme.lepton-x": "~5.0.1", + "@abp/ng.theme.shared": "~10.0.1", + "@angular/animations": "~21.0.0", + "@angular/common": "~21.0.0", + "@angular/compiler": "~21.0.0", + "@angular/core": "~21.0.0", + "@angular/forms": "~21.0.0", + "@angular/localize": "~21.0.0", + "@angular/platform-browser": "~21.0.0", + "@angular/platform-browser-dynamic": "~21.0.0", + "@angular/router": "~21.0.0", "bootstrap-icons": "~1.8.0", "rxjs": "~7.8.0", "tslib": "^2.0.0", "zone.js": "~0.15.0" }, "devDependencies": { - "@abp/ng.schematics": "~10.0.2", - "@angular-devkit/build-angular": "~20.0.0", - "@angular-eslint/builder": "~20.0.0", - "@angular-eslint/eslint-plugin": "~20.0.0", - "@angular-eslint/eslint-plugin-template": "~20.0.0", - "@angular-eslint/schematics": "~20.0.0", - "@angular-eslint/template-parser": "~20.0.0", - "@angular/cli": "~20.0.0", - "@angular/compiler-cli": "~20.0.0", - "@angular/language-service": "~20.0.0", - "@angular/build": "~20.0.0", + "@abp/ng.schematics": "~10.0.1", + "@angular-eslint/builder": "~21.0.0", + "@angular-eslint/eslint-plugin": "~21.0.0", + "@angular-eslint/eslint-plugin-template": "~21.0.0", + "@angular-eslint/schematics": "~21.0.0", + "@angular-eslint/template-parser": "~21.0.0", + "@angular/build": "~21.0.0", + "@angular/cli": "~21.0.0", + "@angular/compiler-cli": "~21.0.0", + "@angular/language-service": "~21.0.0", "@types/jasmine": "~3.6.0", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "7.16.0", "@typescript-eslint/parser": "7.16.0", "eslint": "^8.0.0", "jasmine-core": "~4.0.0", - "karma": "~6.3.0", + "karma": "~6.4.4", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.1.0", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.7.0", - "typescript": "~5.8.0" + "typescript": "~5.9.0" } } diff --git a/templates/app-nolayers/angular/src/main.ts b/templates/app-nolayers/angular/src/main.ts index 7180ec1a32..b7ef9f0bc3 100644 --- a/templates/app-nolayers/angular/src/main.ts +++ b/templates/app-nolayers/angular/src/main.ts @@ -1,5 +1,6 @@ +import { provideZoneChangeDetection } from "@angular/core"; import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { AppComponent } from './app/app.component'; -bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); +bootstrapApplication(AppComponent, {...appConfig, providers: [provideZoneChangeDetection(), ...appConfig.providers]}).catch(err => console.error(err)); diff --git a/templates/app-nolayers/angular/tsconfig.json b/templates/app-nolayers/angular/tsconfig.json index 0322d97e4d..9a18adaf46 100644 --- a/templates/app-nolayers/angular/tsconfig.json +++ b/templates/app-nolayers/angular/tsconfig.json @@ -10,13 +10,9 @@ "moduleResolution": "bundler", "importHelpers": true, "target": "ES2022", - "module": "esnext", + "module": "ES2022", "skipLibCheck": true, "esModuleInterop": true, - "lib": [ - "es2020", - "dom" - ], "paths": { "@proxy": [ "src/app/proxy/index.ts" diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs index 86c8803963..151f57de6c 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs @@ -3,7 +3,7 @@ using Blazorise.Icons.FontAwesome; using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.Server.Mongo.Components; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251018030306_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251218020112_Initial.Designer.cs similarity index 92% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251018030306_Initial.Designer.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251218020112_Initial.Designer.cs index 464df99845..decbedad69 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251018030306_Initial.Designer.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251218020112_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20251018030306_Initial")] + [Migration("20251218020112_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -821,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1017,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1485,13 +1529,16 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1508,6 +1555,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1516,8 +1567,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1584,6 +1636,50 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1824,6 +1920,60 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1922,6 +2072,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251018030306_Initial.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251218020112_Initial.cs similarity index 93% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251018030306_Initial.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251218020112_Initial.cs index a12bda8536..15dc0c422b 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251018030306_Initial.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20251218020112_Initial.cs @@ -211,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -658,6 +678,46 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -886,10 +946,18 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -974,6 +1042,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -1069,6 +1142,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -1099,6 +1175,12 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs index fbc22830a6..d6e1ddae45 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1482,13 +1526,16 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1505,6 +1552,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1513,8 +1564,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1581,6 +1633,50 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1821,6 +1917,60 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1919,6 +2069,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs index 762ca3b7b1..8bf5f371fe 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs @@ -3,7 +3,7 @@ using Blazorise.Icons.FontAwesome; using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.Server.Components; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs index 42ad99abd1..4985e565ba 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; using MyCompanyName.MyProjectName.Components; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251018030326_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251218020330_Initial.Designer.cs similarity index 92% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251018030326_Initial.Designer.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251218020330_Initial.Designer.cs index d15b011131..90e5f9a3cd 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251018030326_Initial.Designer.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251218020330_Initial.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.EntityFrameworkCore; +using MyCompanyName.MyProjectName.Data; using Volo.Abp.EntityFrameworkCore; #nullable disable @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20251018030326_Initial")] + [Migration("20251218020330_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -318,70 +318,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges", (string)null); }); - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ApplicationName") - .HasMaxLength(96) - .HasColumnType("nvarchar(96)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime2") - .HasColumnName("CreationTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ExtraProperties"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("nvarchar(max)"); - - b.Property("JobName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("LastTryTime") - .HasColumnType("datetime2"); - - b.Property("NextTryTime") - .HasColumnType("datetime2"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs", (string)null); - }); - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => { b.Property("Id") @@ -507,6 +443,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -559,6 +496,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("SourceTenantId") @@ -585,6 +523,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -670,6 +609,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Action") @@ -746,6 +686,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ClientId") @@ -801,6 +742,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") @@ -879,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -995,6 +940,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("EndTime") @@ -1074,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1121,6 +1108,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Code") @@ -1541,13 +1529,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1564,6 +1555,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1572,8 +1567,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1640,6 +1636,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1725,6 +1765,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -1879,6 +1920,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1977,6 +2072,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251018030326_Initial.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251218020330_Initial.cs similarity index 93% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251018030326_Initial.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251218020330_Initial.cs index 1a80428132..3ba2c09d6f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251018030326_Initial.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251218020330_Initial.cs @@ -60,28 +60,6 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); }); - migrationBuilder.CreateTable( - name: "AbpBackgroundJobs", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), - JobName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), - JobArgs = table.Column(type: "nvarchar(max)", maxLength: 1048576, nullable: false), - TryCount = table.Column(type: "smallint", nullable: false, defaultValue: (short)0), - CreationTime = table.Column(type: "datetime2", nullable: false), - NextTryTime = table.Column(type: "datetime2", nullable: false), - LastTryTime = table.Column(type: "datetime2", nullable: true), - IsAbandoned = table.Column(type: "bit", nullable: false, defaultValue: false), - Priority = table.Column(type: "tinyint", nullable: false, defaultValue: (byte)15), - ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), - ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); - }); - migrationBuilder.CreateTable( name: "AbpClaimTypes", columns: table => new @@ -233,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -248,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -415,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -680,6 +678,46 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -828,11 +866,6 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpAuditLogs", columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - migrationBuilder.CreateIndex( - name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", - table: "AbpBackgroundJobs", - columns: new[] { "IsAbandoned", "NextTryTime" }); - migrationBuilder.CreateIndex( name: "IX_AbpEntityChanges_AuditLogId", table: "AbpEntityChanges", @@ -913,10 +946,18 @@ namespace MyCompanyName.MyProjectName.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -1001,6 +1042,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -1066,9 +1112,6 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpAuditLogExcelFiles"); - migrationBuilder.DropTable( - name: "AbpBackgroundJobs"); - migrationBuilder.DropTable( name: "AbpClaimTypes"); @@ -1099,6 +1142,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -1129,6 +1175,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs index 55578009e4..71ca921e11 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1482,13 +1526,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1505,6 +1552,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1513,8 +1564,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1581,6 +1633,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1821,6 +1917,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1919,6 +2069,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs index f77a4069e1..c4dade54cc 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; using MyCompanyName.MyProjectName.Components; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs index 93a9bd89b6..0da4008f3c 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; using OpenIddict.Validation.AspNetCore; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251018030220_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251218020004_Initial.Designer.cs similarity index 92% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251018030220_Initial.Designer.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251218020004_Initial.Designer.cs index 13d2d8db08..80872149d8 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251018030220_Initial.Designer.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251218020004_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Host.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20251018030220_Initial")] + [Migration("20251218020004_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Host.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -821,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1017,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1485,13 +1529,16 @@ namespace MyCompanyName.MyProjectName.Host.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1508,6 +1555,10 @@ namespace MyCompanyName.MyProjectName.Host.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1516,8 +1567,9 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1584,6 +1636,50 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1824,6 +1920,60 @@ namespace MyCompanyName.MyProjectName.Host.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1922,6 +2072,10 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251018030220_Initial.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251218020004_Initial.cs similarity index 93% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251018030220_Initial.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251218020004_Initial.cs index f99a7def2b..251be66c16 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251018030220_Initial.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20251218020004_Initial.cs @@ -211,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Host.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Host.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Host.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -658,6 +678,46 @@ namespace MyCompanyName.MyProjectName.Host.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -886,10 +946,18 @@ namespace MyCompanyName.MyProjectName.Host.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -974,6 +1042,11 @@ namespace MyCompanyName.MyProjectName.Host.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -1069,6 +1142,9 @@ namespace MyCompanyName.MyProjectName.Host.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -1099,6 +1175,12 @@ namespace MyCompanyName.MyProjectName.Host.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs index 9834feb25b..a5ee954dd9 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Host.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1482,13 +1526,16 @@ namespace MyCompanyName.MyProjectName.Host.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1505,6 +1552,10 @@ namespace MyCompanyName.MyProjectName.Host.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1513,8 +1564,9 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1581,6 +1633,50 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1821,6 +1917,60 @@ namespace MyCompanyName.MyProjectName.Host.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1919,6 +2069,10 @@ namespace MyCompanyName.MyProjectName.Host.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs index d0bc2944dc..7eaaa5261d 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; using OpenIddict.Validation.AspNetCore; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs index b0331d6144..b8f9a7906a 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; using MyCompanyName.MyProjectName.Menus; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251018030239_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251218020034_Initial.Designer.cs similarity index 92% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251018030239_Initial.Designer.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251218020034_Initial.Designer.cs index 4e2899748f..347bf5c1cc 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251018030239_Initial.Designer.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251218020034_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Mvc.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20251018030239_Initial")] + [Migration("20251218020034_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -821,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1017,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1485,13 +1529,16 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1508,6 +1555,10 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1516,8 +1567,9 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1584,6 +1636,50 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1824,6 +1920,60 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1922,6 +2072,10 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251018030239_Initial.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251218020034_Initial.cs similarity index 93% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251018030239_Initial.cs rename to templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251218020034_Initial.cs index 4890e38f15..0c0880730b 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251018030239_Initial.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20251218020034_Initial.cs @@ -211,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -658,6 +678,46 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -886,10 +946,18 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -974,6 +1042,11 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -1069,6 +1142,9 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -1099,6 +1175,12 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs index 93ef905cd2..72bea3e6f5 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1482,13 +1526,16 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1505,6 +1552,10 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1513,8 +1564,9 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1581,6 +1633,50 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1821,6 +1917,60 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1919,6 +2069,10 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs index 4869ab492e..0657ef6803 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Data; using MyCompanyName.MyProjectName.Localization; using MyCompanyName.MyProjectName.Menus; diff --git a/templates/app/angular/package.json b/templates/app/angular/package.json index 3a7c9115a2..57e5e6d457 100644 --- a/templates/app/angular/package.json +++ b/templates/app/angular/package.json @@ -12,52 +12,51 @@ }, "private": true, "dependencies": { - "@abp/ng.account": "~10.0.2", - "@abp/ng.components": "~10.0.2", - "@abp/ng.core": "~10.0.2", - "@abp/ng.identity": "~10.0.2", - "@abp/ng.oauth": "~10.0.2", - "@abp/ng.setting-management": "~10.0.2", - "@abp/ng.tenant-management": "~10.0.2", - "@abp/ng.theme.lepton-x": "~5.0.2", - "@abp/ng.theme.shared": "~10.0.2", - "@angular/animations": "~20.0.0", - "@angular/common": "~20.0.0", - "@angular/compiler": "~20.0.0", - "@angular/core": "~20.0.0", - "@angular/forms": "~20.0.0", - "@angular/localize": "~20.0.0", - "@angular/platform-browser": "~20.0.0", - "@angular/platform-browser-dynamic": "~20.0.0", - "@angular/router": "~20.0.0", + "@abp/ng.account": "~10.0.1", + "@abp/ng.components": "~10.0.1", + "@abp/ng.core": "~10.0.1", + "@abp/ng.identity": "~10.0.1", + "@abp/ng.oauth": "~10.0.1", + "@abp/ng.setting-management": "~10.0.1", + "@abp/ng.tenant-management": "~10.0.1", + "@abp/ng.theme.lepton-x": "~5.0.1", + "@abp/ng.theme.shared": "~10.0.1", + "@angular/animations": "~21.0.0", + "@angular/common": "~21.0.0", + "@angular/compiler": "~21.0.0", + "@angular/core": "~21.0.0", + "@angular/forms": "~21.0.0", + "@angular/localize": "~21.0.0", + "@angular/platform-browser": "~21.0.0", + "@angular/platform-browser-dynamic": "~21.0.0", + "@angular/router": "~21.0.0", "bootstrap-icons": "~1.8.0", "rxjs": "~7.8.0", "tslib": "^2.0.0", "zone.js": "~0.15.0" }, "devDependencies": { - "@abp/ng.schematics": "~10.0.2", - "@angular-devkit/build-angular": "~20.0.0", - "@angular-eslint/builder": "~20.0.0", - "@angular-eslint/eslint-plugin": "~20.0.0", - "@angular-eslint/eslint-plugin-template": "~20.0.0", - "@angular-eslint/schematics": "~20.0.0", - "@angular-eslint/template-parser": "~20.0.0", - "@angular/cli": "~20.0.0", - "@angular/compiler-cli": "~20.0.0", - "@angular/language-service": "~20.0.0", - "@angular/build": "~20.0.0", + "@abp/ng.schematics": "~10.0.1", + "@angular-eslint/builder": "~21.0.0", + "@angular-eslint/eslint-plugin": "~21.0.0", + "@angular-eslint/eslint-plugin-template": "~21.0.0", + "@angular-eslint/schematics": "~21.0.0", + "@angular-eslint/template-parser": "~21.0.0", + "@angular/build": "~21.0.0", + "@angular/cli": "~21.0.0", + "@angular/compiler-cli": "~21.0.0", + "@angular/language-service": "~21.0.0", "@types/jasmine": "~3.6.0", "@types/node": "~20.11.0", "@typescript-eslint/eslint-plugin": "7.16.0", "@typescript-eslint/parser": "7.16.0", "eslint": "^8.0.0", "jasmine-core": "~4.0.0", - "karma": "~6.3.0", + "karma": "~6.4.4", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.1.0", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.7.0", - "typescript": "~5.8.0" + "typescript": "~5.9.3" } } diff --git a/templates/app/angular/src/main.ts b/templates/app/angular/src/main.ts index 7180ec1a32..b7ef9f0bc3 100644 --- a/templates/app/angular/src/main.ts +++ b/templates/app/angular/src/main.ts @@ -1,5 +1,6 @@ +import { provideZoneChangeDetection } from "@angular/core"; import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { AppComponent } from './app/app.component'; -bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); +bootstrapApplication(AppComponent, {...appConfig, providers: [provideZoneChangeDetection(), ...appConfig.providers]}).catch(err => console.error(err)); diff --git a/templates/app/angular/tsconfig.json b/templates/app/angular/tsconfig.json index 0322d97e4d..9a18adaf46 100644 --- a/templates/app/angular/tsconfig.json +++ b/templates/app/angular/tsconfig.json @@ -10,13 +10,9 @@ "moduleResolution": "bundler", "importHelpers": true, "target": "ES2022", - "module": "esnext", + "module": "ES2022", "skipLibCheck": true, "esModuleInterop": true, - "lib": [ - "es2020", - "dom" - ], "paths": { "@proxy": [ "src/app/proxy/index.ts" diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs index 4d94c3bde9..325ee6805b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs @@ -14,7 +14,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Protocols.OpenIdConnect; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.Server.Tiered.Components; using MyCompanyName.MyProjectName.Blazor.Server.Tiered.Menus; using MyCompanyName.MyProjectName.Localization; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs index 5d27bb122f..658d6d80ca 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.Server.Components; using MyCompanyName.MyProjectName.Blazor.Server.Menus; using MyCompanyName.MyProjectName.EntityFrameworkCore; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs index 0849b09d6d..2a31f2a763 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs @@ -14,7 +14,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Protocols.OpenIdConnect; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client; using MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client.Menus; using MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Components; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs index 6a75e85ae0..3a7b435244 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.WebApp.Client; using MyCompanyName.MyProjectName.Blazor.WebApp.Client.Menus; using MyCompanyName.MyProjectName.Blazor.WebApp.Components; diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251018030505_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251218020130_Initial.Designer.cs similarity index 89% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251018030505_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251218020130_Initial.Designer.cs index fa4835edf9..00548f561d 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251018030505_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251218020130_Initial.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.Data; +using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; #nullable disable @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20251018030505_Initial")] + [Migration("20251218020130_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -318,6 +318,70 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges", (string)null); }); + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)"); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs", (string)null); + }); + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => { b.Property("Id") @@ -443,7 +507,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -496,7 +559,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("SourceTenantId") @@ -523,7 +585,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -609,7 +670,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Action") @@ -686,7 +746,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ClientId") @@ -742,7 +801,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") @@ -821,6 +879,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -937,7 +998,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("EndTime") @@ -1017,6 +1077,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1064,7 +1165,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Code") @@ -1485,13 +1585,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1508,6 +1611,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1516,8 +1623,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1584,6 +1692,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1669,7 +1821,6 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -1824,6 +1975,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1922,6 +2127,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251018030505_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251218020130_Initial.cs similarity index 90% rename from templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251018030505_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251218020130_Initial.cs index dbb195e630..2bbe785a0d 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20251018030505_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20251218020130_Initial.cs @@ -60,6 +60,28 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpBackgroundJobs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + JobName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + JobArgs = table.Column(type: "nvarchar(max)", maxLength: 1048576, nullable: false), + TryCount = table.Column(type: "smallint", nullable: false, defaultValue: (short)0), + CreationTime = table.Column(type: "datetime2", nullable: false), + NextTryTime = table.Column(type: "datetime2", nullable: false), + LastTryTime = table.Column(type: "datetime2", nullable: true), + IsAbandoned = table.Column(type: "bit", nullable: false, defaultValue: false), + Priority = table.Column(type: "tinyint", nullable: false, defaultValue: (byte)15), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpClaimTypes", columns: table => new @@ -211,8 +233,10 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +250,23 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +434,7 @@ namespace MyCompanyName.MyProjectName.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -658,6 +700,46 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -806,6 +888,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpAuditLogs", columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + migrationBuilder.CreateIndex( + name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", + table: "AbpBackgroundJobs", + columns: new[] { "IsAbandoned", "NextTryTime" }); + migrationBuilder.CreateIndex( name: "IX_AbpEntityChanges_AuditLogId", table: "AbpEntityChanges", @@ -886,10 +973,18 @@ namespace MyCompanyName.MyProjectName.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -974,6 +1069,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -1039,6 +1139,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpAuditLogExcelFiles"); + migrationBuilder.DropTable( + name: "AbpBackgroundJobs"); + migrationBuilder.DropTable( name: "AbpClaimTypes"); @@ -1069,6 +1172,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -1099,6 +1205,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs index 6e98993158..3c2f984477 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -876,6 +876,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1071,6 +1074,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1538,13 +1582,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1561,6 +1608,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1569,8 +1620,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1637,6 +1689,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1876,6 +1972,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1974,6 +2124,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index 73033bdda1..f8e42b82c6 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -15,7 +15,7 @@ using Microsoft.Extensions.Hosting; using MyCompanyName.MyProjectName.EntityFrameworkCore; using MyCompanyName.MyProjectName.MultiTenancy; using StackExchange.Redis; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Mvc; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs index 9d28180208..66b658f09b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs @@ -12,7 +12,7 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; using MyCompanyName.MyProjectName.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite; using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite.Bundling; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using OpenIddict.Validation.AspNetCore; using Volo.Abp; using Volo.Abp.Account; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs index 152076d235..1c7badcaf1 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs @@ -14,7 +14,7 @@ using MyCompanyName.MyProjectName.Localization; using MyCompanyName.MyProjectName.MultiTenancy; using MyCompanyName.MyProjectName.Web.Menus; using StackExchange.Redis; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.OpenIdConnect; using Volo.Abp.AspNetCore.Mvc.Client; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 27f8f93367..155f08b603 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -10,7 +10,7 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; using MyCompanyName.MyProjectName.Localization; using MyCompanyName.MyProjectName.MultiTenancy; using MyCompanyName.MyProjectName.Web.Menus; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using OpenIddict.Validation.AspNetCore; using Volo.Abp; using Volo.Abp.Account.Web; diff --git a/templates/module/angular/package.json b/templates/module/angular/package.json index c743e848fa..6e66db9a0d 100644 --- a/templates/module/angular/package.json +++ b/templates/module/angular/package.json @@ -13,53 +13,52 @@ }, "private": true, "dependencies": { - "@abp/ng.account": "~10.0.2", - "@abp/ng.components": "~10.0.2", - "@abp/ng.core": "~10.0.2", - "@abp/ng.identity": "~10.0.2", - "@abp/ng.oauth": "~10.0.2", - "@abp/ng.setting-management": "~10.0.2", - "@abp/ng.tenant-management": "~10.0.2", - "@abp/ng.theme.basic": "~10.0.2", - "@abp/ng.theme.shared": "~10.0.2", - "@angular/animations": "~20.0.0", - "@angular/common": "~20.0.0", - "@angular/compiler": "~20.0.0", - "@angular/core": "~20.0.0", - "@angular/forms": "~20.0.0", - "@angular/localize": "~20.0.0", - "@angular/platform-browser": "~20.0.0", - "@angular/platform-browser-dynamic": "~20.0.0", - "@angular/router": "~20.0.0", + "@abp/ng.account": "~10.0.1", + "@abp/ng.components": "~10.0.1", + "@abp/ng.core": "~10.0.1", + "@abp/ng.identity": "~10.0.1", + "@abp/ng.oauth": "~10.0.1", + "@abp/ng.setting-management": "~10.0.1", + "@abp/ng.tenant-management": "~10.0.1", + "@abp/ng.theme.basic": "~10.0.1", + "@abp/ng.theme.shared": "~10.0.1", + "@angular/animations": "~21.0.0", + "@angular/common": "~21.0.0", + "@angular/compiler": "~21.0.0", + "@angular/core": "~21.0.0", + "@angular/forms": "~21.0.0", + "@angular/localize": "~21.0.0", + "@angular/platform-browser": "~21.0.0", + "@angular/platform-browser-dynamic": "~21.0.0", + "@angular/router": "~21.0.0", "rxjs": "~7.8.0", "tslib": "^2.0.0", "zone.js": "~0.15.0" }, "devDependencies": { - "@abp/ng.schematics": "~10.0.2", - "@angular-devkit/build-angular": "~20.0.0", - "@angular-eslint/builder": "~20.0.0", - "@angular-eslint/eslint-plugin": "~20.0.0", - "@angular-eslint/eslint-plugin-template": "~20.0.0", - "@angular-eslint/schematics": "~20.0.0", - "@angular-eslint/template-parser": "~20.0.0", - "@angular/cli": "~20.0.0", - "@angular/compiler-cli": "~20.0.0", - "@angular/language-service": "~20.0.0", - "@angular/build": "~20.0.0", + "@abp/ng.schematics": "~10.0.1", + "@angular-eslint/builder": "~21.0.0", + "@angular-eslint/eslint-plugin": "~21.0.0", + "@angular-eslint/eslint-plugin-template": "~21.0.0", + "@angular-eslint/schematics": "~21.0.0", + "@angular-eslint/template-parser": "~21.0.0", + "@angular/build": "~21.0.0", + "@angular/cli": "~21.0.0", + "@angular/compiler-cli": "~21.0.0", + "@angular/language-service": "~21.0.0", "@types/jasmine": "~3.6.0", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "7.16.0", "@typescript-eslint/parser": "7.16.0", "eslint": "^8.0.0", "jasmine-core": "~4.0.0", - "karma": "~6.3.0", + "karma": "~6.4.4", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.1.0", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.7.0", - "ng-packagr": "~20.0.0", + "ng-packagr": "~21.0.0", "symlink": "^2.0.0", - "typescript": "~5.8.0" + "typescript": "~5.9.0" } } diff --git a/templates/module/angular/projects/dev-app/src/main.ts b/templates/module/angular/projects/dev-app/src/main.ts index 7180ec1a32..b7ef9f0bc3 100644 --- a/templates/module/angular/projects/dev-app/src/main.ts +++ b/templates/module/angular/projects/dev-app/src/main.ts @@ -1,5 +1,6 @@ +import { provideZoneChangeDetection } from "@angular/core"; import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { AppComponent } from './app/app.component'; -bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); +bootstrapApplication(AppComponent, {...appConfig, providers: [provideZoneChangeDetection(), ...appConfig.providers]}).catch(err => console.error(err)); diff --git a/templates/module/angular/projects/my-project-name/tsconfig.lib.json b/templates/module/angular/projects/my-project-name/tsconfig.lib.json index 8246b3f0b1..6fea9ad884 100644 --- a/templates/module/angular/projects/my-project-name/tsconfig.lib.json +++ b/templates/module/angular/projects/my-project-name/tsconfig.lib.json @@ -6,11 +6,7 @@ "declaration": true, "declarationMap": true, "inlineSources": true, - "types": [], - "lib": [ - "dom", - "es2018" - ] + "types": [] }, "exclude": [ "src/test.ts", diff --git a/templates/module/angular/tsconfig.json b/templates/module/angular/tsconfig.json index 0cbe9a9de8..2e5e466bf0 100644 --- a/templates/module/angular/tsconfig.json +++ b/templates/module/angular/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.prod.json", "compilerOptions": { "esModuleInterop": true, + "moduleResolution": "bundler", "skipLibCheck": true, "paths": { "@my-company-name/my-project-name": [ diff --git a/templates/module/angular/tsconfig.prod.json b/templates/module/angular/tsconfig.prod.json index 28b0a75f51..2f4afb8ff7 100644 --- a/templates/module/angular/tsconfig.prod.json +++ b/templates/module/angular/tsconfig.prod.json @@ -7,10 +7,10 @@ "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "importHelpers": true, - "target": "es2020", - "module": "esnext", + "target": "es2022", + "module": "ES2022", "esModuleInterop": true, "lib": [ "es2020", diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251018030413_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251218020219_Initial.Designer.cs similarity index 92% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251018030413_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251218020219_Initial.Designer.cs index 7683184975..cc4aacd2c8 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251018030413_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251218020219_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(AuthServerDbContext))] - [Migration("20251018030413_Initial")] + [Migration("20251218020219_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -821,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1017,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1485,13 +1529,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1508,6 +1555,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1516,8 +1567,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1584,6 +1636,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1824,6 +1920,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1922,6 +2072,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251018030413_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251218020219_Initial.cs similarity index 93% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251018030413_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251218020219_Initial.cs index dbb195e630..3ba2c09d6f 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251018030413_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20251218020219_Initial.cs @@ -211,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -658,6 +678,46 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -886,10 +946,18 @@ namespace MyCompanyName.MyProjectName.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -974,6 +1042,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -1069,6 +1142,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -1099,6 +1175,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs index 210845ea27..b610d4ea04 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1482,13 +1526,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1505,6 +1552,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1513,8 +1564,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1581,6 +1633,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1821,6 +1917,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1919,6 +2069,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs index feb60f2b34..6da496bac6 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; using MyCompanyName.MyProjectName.MultiTenancy; using StackExchange.Redis; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using OpenIddict.Validation.AspNetCore; using Volo.Abp; using Volo.Abp.Account; diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251018030355_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251218020158_Initial.Designer.cs similarity index 91% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251018030355_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251218020158_Initial.Designer.cs index 78b36c2829..5342dd5e01 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251018030355_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251218020158_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20251018030355_Initial")] + [Migration("20251218020158_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -821,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1017,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1183,13 +1227,16 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1206,6 +1253,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1214,8 +1265,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1282,6 +1334,50 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1522,6 +1618,60 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1602,6 +1752,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251018030355_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251218020158_Initial.cs similarity index 91% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251018030355_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251218020158_Initial.cs index 68406126d4..af720e3248 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251018030355_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20251218020158_Initial.cs @@ -211,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -594,6 +614,46 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -763,10 +823,18 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -851,6 +919,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -916,6 +989,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -946,6 +1022,12 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs index 502a7cb2d5..5fa6595a41 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1180,13 +1224,16 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1203,6 +1250,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1211,8 +1262,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1279,6 +1331,50 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1519,6 +1615,60 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1599,6 +1749,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs index b845e23241..452eb58b56 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MyCompanyName.MyProjectName.Blazor.Server.Host.Components; using MyCompanyName.MyProjectName.Blazor.Server.Host.Menus; using MyCompanyName.MyProjectName.EntityFrameworkCore; diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251018030425_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251218020233_Initial.Designer.cs similarity index 89% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251018030425_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251218020233_Initial.Designer.cs index 27316ed042..c3af00901a 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251018030425_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251218020233_Initial.Designer.cs @@ -12,7 +12,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameHttpApiHostMigrationsDbContext))] - [Migration("20251018030425_Initial")] + [Migration("20251218020233_Initial")] partial class Initial { /// @@ -21,7 +21,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251018030425_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251218020233_Initial.cs similarity index 100% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251018030425_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20251218020233_Initial.cs diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs index ca715e35a7..b55edb912d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index 61534b55c8..dad13a4516 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.Hosting; using MyCompanyName.MyProjectName.EntityFrameworkCore; using MyCompanyName.MyProjectName.MultiTenancy; using StackExchange.Redis; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs index 8d912bcad4..35bc9dfaae 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs @@ -2,7 +2,7 @@ using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using System.IO; using System.Reflection; using System.Threading.Tasks; diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251018030439_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251218020255_Initial.Designer.cs similarity index 91% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251018030439_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251218020255_Initial.Designer.cs index 86eeae428f..33e5dc220e 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251018030439_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251218020255_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20251018030439_Initial")] + [Migration("20251218020255_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -821,6 +821,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1017,6 +1020,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1183,13 +1227,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1206,6 +1253,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1214,8 +1265,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1282,6 +1334,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1522,6 +1618,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1602,6 +1752,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251018030439_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251218020255_Initial.cs similarity index 91% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251018030439_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251218020255_Initial.cs index 4b66431160..08fc513bcb 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251018030439_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20251218020255_Initial.cs @@ -211,8 +211,10 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ManagementPermissionName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), @@ -226,6 +228,23 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpPermissions", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpResourcePermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ResourceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ResourceKey = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -393,6 +412,7 @@ namespace MyCompanyName.MyProjectName.Migrations ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false), EntityVersion = table.Column(type: "int", nullable: false), LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true), + LastSignInTime = table.Column(type: "datetimeoffset", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), @@ -594,6 +614,46 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpUserPasskeys", + columns: table => new + { + CredentialId = table.Column(type: "varbinary(1024)", maxLength: 1024, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasskeys", x => x.CredentialId); + table.ForeignKey( + name: "FK_AbpUserPasskeys_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserPasswordHistories", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Password = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserPasswordHistories", x => new { x.UserId, x.Password }); + table.ForeignKey( + name: "FK_AbpUserPasswordHistories_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserRoles", columns: table => new @@ -763,10 +823,18 @@ namespace MyCompanyName.MyProjectName.Migrations column: "GroupName"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissions_Name", + name: "IX_AbpPermissions_ResourceName_Name", table: "AbpPermissions", - column: "Name", - unique: true); + columns: new[] { "ResourceName", "Name" }, + unique: true, + filter: "[ResourceName] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpResourcePermissionGrants_TenantId_Name_ResourceName_ResourceKey_ProviderName_ProviderKey", + table: "AbpResourcePermissionGrants", + columns: new[] { "TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -851,6 +919,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUserOrganizationUnits", columns: new[] { "UserId", "OrganizationUnitId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpUserPasskeys_UserId", + table: "AbpUserPasskeys", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_AbpUserRoles_RoleId_UserId", table: "AbpUserRoles", @@ -916,6 +989,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpPermissions"); + migrationBuilder.DropTable( + name: "AbpResourcePermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); @@ -946,6 +1022,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpUserOrganizationUnits"); + migrationBuilder.DropTable( + name: "AbpUserPasskeys"); + + migrationBuilder.DropTable( + name: "AbpUserPasswordHistories"); + migrationBuilder.DropTable( name: "AbpUserRoles"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index f40d34b2ac..6e6fce7596 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "10.0.0-rc.2.25502.107") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -818,6 +818,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("LastPasswordChangeTime") .HasColumnType("datetimeoffset"); + b.Property("LastSignInTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -1014,6 +1017,47 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpUserOrganizationUnits", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.Property("CredentialId") + .HasMaxLength(1024) + .HasColumnType("varbinary(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CredentialId"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserPasskeys", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Password") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "Password"); + + b.ToTable("AbpUserPasswordHistories", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.Property("UserId") @@ -1180,13 +1224,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties"); b.Property("GroupName") - .IsRequired() .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property("IsEnabled") .HasColumnType("bit"); + b.Property("ManagementPermissionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("MultiTenancySide") .HasColumnType("tinyint"); @@ -1203,6 +1250,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ResourceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("StateCheckers") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); @@ -1211,8 +1262,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("GroupName"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("ResourceName", "Name") + .IsUnique() + .HasFilter("[ResourceName] IS NOT NULL"); b.ToTable("AbpPermissions", (string)null); }); @@ -1279,6 +1331,50 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpPermissionGroups", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.ResourcePermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ResourceName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ResourceName", "ResourceKey", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpResourcePermissionGrants", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1519,6 +1615,60 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasskey", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Passkeys") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Volo.Abp.Identity.IdentityPasskeyData", "Data", b1 => + { + b1.Property("IdentityUserPasskeyCredentialId"); + + b1.Property("AttestationObject"); + + b1.Property("ClientDataJson"); + + b1.Property("CreatedAt"); + + b1.Property("IsBackedUp"); + + b1.Property("IsBackupEligible"); + + b1.Property("IsUserVerified"); + + b1.Property("Name"); + + b1.Property("PublicKey"); + + b1.Property("SignCount"); + + b1.PrimitiveCollection("Transports"); + + b1.HasKey("IdentityUserPasskeyCredentialId"); + + b1.ToTable("AbpUserPasskeys"); + + b1.ToJson("Data"); + + b1.WithOwner() + .HasForeignKey("IdentityUserPasskeyCredentialId"); + }); + + b.Navigation("Data"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserPasswordHistory", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("PasswordHistories") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) @@ -1599,6 +1749,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Navigation("OrganizationUnits"); + b.Navigation("Passkeys"); + + b.Navigation("PasswordHistories"); + b.Navigation("Roles"); b.Navigation("Tokens"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs index 5bca5679e1..1612d7b95a 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs @@ -8,7 +8,7 @@ using Microsoft.Extensions.Hosting; using MyCompanyName.MyProjectName.EntityFrameworkCore; using MyCompanyName.MyProjectName.MultiTenancy; using MyCompanyName.MyProjectName.Web; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.Account;