Hi @ryancyq
In going back to get the stack trace, something has changed and in the debug console it now shows a 401 Unauthorised being returned, instead of the 500 it was before.
Something I still note is that when the 401 is thrown due to failed feature check (on tenant) this is displayed to the user:
and the blockUI crashes as well, requiring a page refresh to carry on. The above message is not self-explanitory, but no other information can be gathered, as the audit log doesn't show any error to have occured.
If one manually throws an AbpAuthorizationException, then it can come up like so:
Can the same be done when errors are thrown by the feature checker?
Hi @ryancyq
It happens when logged in as a host user, which is explained by the thread in the link you shared, but unfortunately, it's happening for tenant users as well, which is why I raised this question.
Hi @Maliming
We're running .Net Core v6.3.0
@hikalkan thank you for your response.
Something like IgnoreFeatureCheckForHostUsers
would be amazing to have, so that we have the option of allowing host users through feature checks.
As for permissions, if I am understanding you correctly, we've had no issues with AbpAuthorize/AbpMvcAuthorize
attributes on classes/methods as host users, as the host users have roles and permissions assigned and can access authorised areas without issue.
Having both a permission check and a feature check on a given class/method shouldn't be an issue for a host user so long as the feature check can be bypassed and they have the right permission assigned?
Thank you @Alper
Hi @ryancyq
I added an interface for the folder manager (and converted the manager to implement the interface).
using Syntaq.Falcon.AccessControlList;
using Syntaq.Falcon.Folders.Dtos;
using System.Threading.Tasks;
namespace Syntaq.Falcon.Folders
{
public interface IFolderManager
{
Task CreateOrEditFolder(ACL ACL, Folder Folder);
Task CreateAndOrFetchFolder(ACL ACL, Folder Folder);
Task Move(MoveFolderDto moveFolderDto);
}
}
And then I'm resolving the interface at the top of the unit test.
public class FolderManager_Tests : AppTestBase
{
private readonly IFolderManager _folderManager;
public FolderManager_Tests()
{
_folderManager = Resolve<IFolderManager>();
}
And here is the stack trace
[27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] System.ObjectDisposedException : Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] Object name: 'FalconDbContext'. [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] Stack Trace: [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] at Microsoft.EntityFrameworkCore.DbContext.CheckDisposed() [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] at Microsoft.EntityFrameworkCore.DbContext.get_Model() [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] at Microsoft.EntityFrameworkCore.Internal.InternalDbSet'1.get_EntityType()
\[27/12/2018 11:14:34 AM Informational\] \[xUnit\.net 00:00:22\.43\] at Microsoft\.EntityFrameworkCore\.Internal\.InternalDbSet'1.get_EntityQueryable() [27/12/2018 11:14:34 AM Informational] [xUnit.net 00:00:22.43] at Microsoft.EntityFrameworkCore.Internal.InternalDbSet'1.System.Linq.IQueryable.get_Provider()
\[27/12/2018 11:14:34 AM Informational\] \[xUnit\.net 00:00:22\.43\] at System\.Linq\.Queryable\.Any\[TSource\]\(IQueryable'1 source, Expression'1 predicate)
\[27/12/2018 11:14:34 AM Informational\] \[xUnit\.net 00:00:22\.43\] D:\Source\Syntaq\.Falcon\src\Syntaq\.Falcon\.Core\Folders\FolderManager\.cs\(92\,0\): at Syntaq\.Falcon\.Folders\.FolderManager\.CreateAndOrFetchFolder\(ACL ACL\, Folder Folder\)
\[27/12/2018 11:14:34 AM Informational\] \[xUnit\.net 00:00:22\.43\] D:\Source\Syntaq\.Falcon\test\Syntaq\.Falcon\.Tests\Folders\FolderManager\_Tests\.cs\(29\,0\): at Syntaq\.Falcon\.Tests\.Folders\.FolderManager\_Tests\.Should\_Fetch\_Folder\(\)
\[27/12/2018 11:14:34 AM Informational\] \[xUnit\.net 00:00:22\.43\] \-\-\- End of stack trace from previous location where exception was thrown \-\-\-\
@ryancyq & @hikalkan thank you both for your responses and your discussion on the pull request.
The idea behind our use-case is that as the host, we define the application editions and specify the features each edition has. Tenants then being assigned different editions thus get access to various features as defined by the assigned edition. As the host, having access to all of the platforms features is beneficial because we can test functionality, check that it's working after updates, etc. myself as a developer of our app, I use a host user account, and our automated functional testing also uses a host user account, and both of these are done this way because they have access to all features and functions of the app. This is however majorly disrupted if blocked by the feature checkers.
Another point for consideration is that features restricted by the features system, may not be, and in our application, certainly aren't, exclusively designed to work only for tenant users. A host user using a given feature doesn't change the operation or outcome of the feature, even though it has a null tenant id.
However, if the status quo remains, and feature checking is left as a tenant only scope, one thing that would be very beneficial to future devs, would be explicit exception messages. Currently, a feature checker on an MVC controller returns a 500 error, and on an application service, also returns a 500 error but is caught by error handling and thus displays the generic "An internal error occurred during your request!"
Thanks, David
Hi Mitch,
I realise this post is 10 months old but in case you're still stuck with SendGrid or for other readers, I've got a working SendGrid configuration in .Net Zero and my solution is also hosted in Azure and SendGrid works from Production as well as in Dev.
On the Email(SMTP) tab under admin -> settings, I have it configured as follows:
Hope this helps :)
Hi Maliming,
Thank you for your response and help.
As noted by Hikalkan in the Git Link:
Only default values are not saved (because they are default and hard-coded in your code) and when you get a feature's value, this default value is returned.
It would be good if this was stated in the documention for features: Feature Management
Hi Maliming
Here is the data in my AbpFeatures table:
Id CreationTime CreatorUserId Discriminator Name Value EditionId TenantId
1 2018-03-16 14:38:16.4764368 NULL EditionFeatureSetting App.ChatFeature true 1 NULL
2 2018-03-16 14:38:16.5210188 NULL EditionFeatureSetting App.ChatFeature.TenantToTenant true 1 NULL
3 2018-03-16 14:38:16.5225230 NULL EditionFeatureSetting App.ChatFeature.TenantToHost true 1 NULL
4 2018-10-10 12:14:40.9736974 1 EditionFeatureSetting App.ChatFeature true 2 NULL
5 2018-10-10 12:14:40.9881633 1 EditionFeatureSetting App.ChatFeature.TenantToHost true 2 NULL
6 2018-10-10 12:14:40.9917917 1 EditionFeatureSetting App.ChatFeature.TenantToTenant true 2 NULL
7 2018-10-10 12:14:40.9993621 1 EditionFeatureSetting App.TestCheckFeature2 false 2 NULL
9 2018-10-10 13:03:44.7374498 1 EditionFeatureSetting App.SubmissionLimitAmount 500 2 NULL
The new custom feature, SubmissionLimitAmount, only shows up for Edition 2, but not for Edition 1, even though they both now have that feature. Edition 2 has a non-default value set for its SubmissionLimitAmount, while Edition 1 has the default value, and this would be why one shows up and the other doesn't?