Logical expression in security action

Certified Associate Developer

or(
and(
rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{8435c94d-c75d-4250-b60c-267fa8e9fe8c}locked']=false,
a!isNullOrEmpty(rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{6586c1e5-e5c7-4f5b-8a42-04f5c067aab3}utenteLocked']),
a!isUserMemberOfGroup(username: loggedInUser(),groups: cons!SLC_GRP_VERIFICATORE_INFRATEL),
contains(cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[3],rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}idFase'])
)
),
or(
and(
rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{8435c94d-c75d-4250-b60c-267fa8e9fe8c}locked']=false,
a!isNullOrEmpty(rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{6586c1e5-e5c7-4f5b-8a42-04f5c067aab3}utenteLocked']),
a!isUserMemberOfGroup(username: loggedInUser(),groups: cons!SLC_GRP_RUP_INFRATEL),
contains(cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[4],rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}idFase'])
)
),
or(
and(
a!isUserMemberOfGroup(username: loggedInUser(),groups: cons!SLC_GRP_PMS_INFRATEL),
contains(cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[3],rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}idFase']),
contains(cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[4],rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}SLC Progetto Di Connessione.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}idFase'])
)
)

im using this code to display button for this 3 groups of users but its only appears only on the first expression groups which is:SLC_GRP_VERIFICATORE_INFRATEL,

is the logical expression of OR / AND is written bad?

  Discussion posts and replies are publicly visible

  • The way this is written it is essentially a list of 3 different expressions, 1 for each of your or() statements which only contain one clause within (and()).  Assuming you want this to resolve true if any of the and() conditions are met, try:

    or(
      and(
        rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{8435c94d-c75d-4250-b60c-267fa8e9fe8c}'] = false,
        a!isNullOrEmpty(
          rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{6586c1e5-e5c7-4f5b-8a42-04f5c067aab3}']
        ),
        a!isUserMemberOfGroup(
          username: loggedInUser(),
          groups: cons!SLC_GRP_VERIFICATORE_INFRATEL
        ),
        contains(
          cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[3],
          rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}']
        )
      ),
      and(
        rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{8435c94d-c75d-4250-b60c-267fa8e9fe8c}'] = false,
        a!isNullOrEmpty(
          rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{6586c1e5-e5c7-4f5b-8a42-04f5c067aab3}']
        ),
        a!isUserMemberOfGroup(
          username: loggedInUser(),
          groups: cons!SLC_GRP_RUP_INFRATEL
        ),
        contains(
          cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[4],
          rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}']
        )
      ),
      and(
        a!isUserMemberOfGroup(
          username: loggedInUser(),
          groups: cons!SLC_GRP_PMS_INFRATEL
        ),
        contains(
          cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[3],
          rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}']
        ),
        contains(
          cons!SLC_INTS_ID_FASI_PROGETTO_DI_CONNESSIONE[4],
          rv!record['recordType!{6456804e-1013-4209-bb05-6edb57f49898}.fields.{12f3ca11-6e56-437c-a111-0188f3e80076}']
        )
      )
    )

  • 0
    Certified Lead Developer

    Not sure what that logic should express. That or() only wraps a single condition, the and(). In the and, you define many conditions. Which is OK, but hard to validate. Especially without knowing any details.

    I suggest to first implement a more simplified version, and then add more complexity once that works.