-
ABP Framework version: v6.0.1
-
UI Type: MVC
-
Database System: EF Core (PostgreSQL)
-
Tiered (for MVC) or Auth Server Separated (for Angular): Tired
-
Exception message and full stack trace:
-
Steps to reproduce the issue:
Hi,
I'm trying to configure a new feature with FeatureDefinitionProvider like this:
public class WebAppFeatureDefinitionProvider : FeatureDefinitionProvider
{
public override void Define(IFeatureDefinitionContext context)
{
var myGroup = context.AddGroup("WebApp");
myGroup.AddFeature(
WebAppFeatures.LoginEnabled,
defaultValue: "true",
displayName: L("LoginEnabled"),
valueType: new ToggleStringValueType()
);
myGroup.AddFeature(
WebAppFeatures.BackgroundJobEnabled,
defaultValue: "true",
displayName: L("BackgroundJobEnabled"),
valueType: new ToggleStringValueType()
);
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<WebAppResource>(name);
}
}
These two features are enabled to allow changes to the value from the web frontend. I can change the value, and it is also updated in the database.
But when I try to get the value, like this:
var backgroundJobEnabled = await _featureChecker.GetOrNullAsync(WebAppFeatures.BackgroundJobEnabled);
var loginEnabled = await _featureChecker.GetOrNullAsync(WebAppFeatures.LoginEnabled);
The value always is true
Can someone helps me?
Thanks
5 Answer(s)
-
0
Hello,
I tried to reproduce the problem but I could not. BackgroundJobEnabled should be false, but this value may also be coming from the cache. In order to determine this situation, can you confirm whether you see the value in the database when you close and open your Redis server or restart the application?
-
0
Hi,
After restarting the application, the problem persists
-
0
Hi,
I created a project with 6.0.1 and tried it with the codes you mentioned, but I could not reproduce your problem.
In the picture below you can see where I set this value:
In your case, in which project is WebAppFeatureDefinitionProvider defined and where did you set this value? Also, in which project is SyncActiveFarmsWorker defined?
-
0
Yes, you are right.
Sorry, I had changed the value in the wrong place on the web, in the Standard Editions Features. Now, I have changed the value in "Manager Host Features" and that's correct.
Please, cloud you tell me how I can block the login, using the feature loginEnabled and if role is not admin?
Thanks
-
0
Yes, you are right.
Sorry, I had changed the value in the wrong place on the web, in the Standard Editions Features. Now, I have changed the value in "Manager Host Features" and that's correct.
I am glad it is working.
Please, cloud you tell me how I can block the login, using the feature loginEnabled and if role is not admin?
Normally, you should to open a separate ticket for this, but if I need to give brief information, you can override the OnPost method of the Login page model and add the logic you want before calling base.OnPost.
Here are the related contents:
-
https://abp.io/docs/latest/framework/ui/mvc-razor-pages/customization-user-interface
-
https://abp.io/support/questions/8849/PagesAccountLogin-OnPostAsyncstring-action-override
Closing the issue. Feel free to create a new issue if you have further questions.
-