Committing an object fails due to security reasons

4
I have written a microflow that changes the System.User.Active to "false" - when I try to execute this microflow I get the following message: "Committing object System.User.Active failed for security reasons". How should I change my security setting to avoid getting this message?
asked
4 answers
5

Generally speaking this means that the User you are currently logged in as (and under whose Roles you are executing this Microflow) does not have permission to alter System.User objects.

You have two choices,

  • Open your project in the Modeler, go to Security and allow one of the Roles this User has to alter the Active attribute of System.User.

  • If you are just testing or experimenting, log into the application via the web interface and give this user the Administrator Role (which is, I should note, generally not recommended for production systems).

answered
5

As of version 2.4.3, the security settings in the System module (that contains the User object) have been revised. New projects will automatically get these settings, while for existing projects a button 'Apply default settings' has been added to the object access dialog of the System module.

These newer settings include the fact that no user role except for MxAdministrator has access to the 'Active' attribute of System.User. Allowing access to this attribute for user roles other than MxAdministrator would allow users with these roles to (de)activate other users' accounts. It is therefore strongly discouraged to give access to this attribute to any role other than MxAdministrator.

If you really must change the 'Active' attribute in (for example) a microflow started by a "normal" user (as opposed to an administrator), please use a Java action to apply this change using the system session (which has administrative rights).

answered
2

It turned out that I tried to commit the current user object rather that the selected object from the grid. Changing the setting to take the selected object as an input for the change action solved the issue.

answered
0

Please advise:

I used a java action to set the active value to true or false. But on the commit in java the proces is stopped (hanged). I use mendix 2.4.6.1 with a postgres database

See java code: Core.getLogNode("Customer.ActivateUser").info("Activate user"); IContext sudoContext = Core.getSystemSession().getContext(); IMendixObject mxobjCustomer = Core.retrieveId(sudoContext, currentCustomer.getMendixObject().getId());

    Core.getLogNode("Customer.ActivateUser").info("After getting the system context");
    mxobjCustomer.setValue("Active", true); 
    Core.getLogNode("Customer.ActivateUser").info("After set the user to active = true");
    Core.getLogNode("Customer.ActivateUser").info("Try commit the user object");
    Core.commit(sudoContext, mxobjCustomer);
    Core.getLogNode("Customer.ActivateUser").info("After commintting");

2010-05-14 15:23:01.250 INFO - Customer.ActivateUser: Activate user 2010-05-14 15:23:01.250 INFO - Customer.ActivateUser: After getting the system c ontext 2010-05-14 15:23:01.250 INFO - Customer.ActivateUser: After set the user to acti ve = true 2010-05-14 15:23:01.250 INFO - Customer.ActivateUser: Try commit the user object

<nothing happens!="">

answered