Skip to content

feat: add missing 13 and 14 parameter constructors for CasbinAuthorizeAttribute#73

Merged
hsluoyz merged 2 commits intomasterfrom
copilot/fix-nuget-package-version
Jan 3, 2026
Merged

feat: add missing 13 and 14 parameter constructors for CasbinAuthorizeAttribute#73
hsluoyz merged 2 commits intomasterfrom
copilot/fix-nuget-package-version

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

PR #69 updated Casbin.NET from 2.5.3 to 2.19.1, which extended StringRequestValues to support 14 parameters. However, CasbinAuthorizeAttribute constructors were incomplete—only supporting up to 12 parameters. This caused the published NuGet package to contain incorrect IL code.

Changes

  • CasbinAuthorizeAttribute.cs: Added constructors for 13 and 14 string parameters
  • CasbinAuthorizeAttribute.Generic.cs: Added generic attribute classes for 13 and 14 type parameters

Both follow the existing constructor chaining pattern established in parameters 5-12.

// Now supported:
[CasbinAuthorize("val1", "val2", "val3", "val4", "val5", "val6", 
                 "val7", "val8", "val9", "val10", "val11", "val12", "val13")]

[CasbinAuthorize("val1", "val2", "val3", "val4", "val5", "val6", 
                 "val7", "val8", "val9", "val10", "val11", "val12", "val13", "val14")]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.myget.org
    • Triggering command: /usr/bin/dotnet dotnet restore (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build src/Casbin.AspNetCore/Casbin.AspNetCore.csproj -c Release (dns block)
    • Triggering command: /usr/bin/dotnet dotnet test test/Casbin.AspNetCore.Tests/Casbin.AspNetCore.Tests.csproj -c Release --verbosity normal (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Wrong version of package pushed to nuget for merge of PR #69</issue_title>
<issue_description>The build artifacts for the PR #69, seems to not have made it into the nuget package.

The published nuget package contains the wrong IL code for CasbinAuthorizeAttribute constructors.

e.g:

Build artifact (from CI):
_values = new StringRequestValues(value1, "", "", "", "", "", "", "", "", "", "", "", "", "");
// 14 parameters (value1 + 13 empty strings)
Official NuGet package:
_values = new StringRequestValues(value1, "", "", "", "", "", "", "", "", "", "", "");
// 12 parameters (value1 + 11 empty strings)

I suspect it has to do with these warnings in the log:

Image

I'm not sure if I can contribute a PR to fix this, as it would involve triggering the release workflow? </issue_description>

Comments on the Issue (you are @copilot in this section)

@hsluoyz @sagilio @sociometry @AsakusaRinne

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Jan 3, 2026
@hsluoyz
Copy link
Member

hsluoyz commented Jan 3, 2026

@sagilio please review

@hsluoyz hsluoyz requested a review from sagilio January 3, 2026 01:46
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@hsluoyz hsluoyz marked this pull request as ready for review January 3, 2026 01:46
- Added CasbinAuthorizeAttribute constructor with 13 parameters
- Added CasbinAuthorizeAttribute constructor with 14 parameters
- Added generic CasbinAuthorizeAttribute<T1...T13> class
- Added generic CasbinAuthorizeAttribute<T1...T14> class

This fixes the issue where the Casbin.NET 2.19.1 upgrade added support for 14 parameters in StringRequestValues but the attribute constructors only supported up to 12 parameters.

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix wrong version of package pushed to NuGet for PR #69 Add missing 13 and 14 parameter constructors for CasbinAuthorizeAttribute Jan 3, 2026
Copilot AI requested a review from hsluoyz January 3, 2026 01:59
@hsluoyz hsluoyz changed the title Add missing 13 and 14 parameter constructors for CasbinAuthorizeAttribute feat: add missing 13 and 14 parameter constructors for CasbinAuthorizeAttribute Jan 3, 2026
@hsluoyz hsluoyz merged commit 3a1929a into master Jan 3, 2026
12 of 15 checks passed
hsluoyz added a commit that referenced this pull request Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong version of package pushed to nuget for merge of PR #69

3 participants