Attribute Rule [Constraint]: Combining GetUser + third action. Action not recognised

180
1
10-26-2021 06:06 AM
Manniej
New Contributor II

Hello World, 

I could use 'some extra eyes' on the following issue. I'm trying to combine the "GetUser" option with another action within a constraint Attibute Rule in a Enterprise 10.9.0 enviroment. Unfortunately I can't get it to work. 
 
It doesn't seem to recognize the getUser by using it as an Attribute Rule (constraint).  It will however recognize me (user & groups)  when I run the piece of code  1 on 1 within a popup-expression. 
 
Am I on the wrong track? Am I doing something wrong?

 

//Variables----------------------------------------------------------------
//If the edit is on DEFAULT we need to check the user groups
var p = Portal("https://xxxxxxxxxxxx/portal");
//Get the user full object
var u = getUser(p);
//Get the user groups
var groups = u.groups;
//Check if the user is in the correct group
var insuperusergroup = (Find("<NameOfTheGroup>",groups) > 0 );
// If value of Checkfield = Yes. Disable that this object can be edited, 
var Akkoord = ($originalFeature.Checkfield == 'Ja');
//Action------------------------------------------------------------------

// If user is in: insuperusergroup: This Attribute Rule should do nothing. 
if (insuperusergroup) {
   return true        }

// this attribute rule should check what the value of Checkfield is. no? the user must be able to modify the object. Yes? The user may no longer be able to change anything to this object, and will receive an error.
else {
   if (!Akkoord) {
      return true }
   else { 
      return {"ErrorMessage":" Sorry!  You cannot edited this object"}
        }
     }

 

0 Kudos
1 Reply
Manniej
New Contributor II

The code is correct, but unfortunately it turns out to be a BUG.

When Person 'A' is logged in and triggers the AR, the system recognizes Person 'A' with associated rights. Unfortunately, it seems that person 'B' & 'C', (both logging in from their own IP / User account) can edit with the rights of person 'A'.

In other words, the trigger reacts once upon recognizing a profile and keeps it for others users to the same product. Only after resetting the service does the situation seem to have reset.

Bug has been reported to Esri. No solution is know yet (02-12-2021).

 

0 Kudos