getPendingAuthRequests(...)

Sepasoft MES Module Suite

getPendingAuthRequests(...)

Returns pending MES signature authorization requests. Use this to list queued authentication challenges, optionally filtered to the current user, selected roles, security rules, request description text, incomplete requests, or hidden/internal signature templates.

Syntax

Python
system.mes.signature.authorization.getPendingAuthRequests()
system.mes.signature.authorization.getPendingAuthRequests(filter)

Parameters

Parameter

Type

Required

Description

filter

AuthenticationChallengeFilter

Optional

Limits which pending requests are returned. Create with system.mes.object.signature.filter.create() and configure it before calling this function.

Optional Filter Methods

Method

Type

Default

Description

addRole(requiredRole)

String

No role filter

Includes requests for a matching role predicate. Call multiple times to allow multiple roles.

addRoles(roles)

Iterable[String]

No role filter

Includes requests for any non-blank role in the iterable.

addSecurityRule(requiredRule)
String
No security rule filter
Includes requests for a matching {securityRule:...} predicate. The path must match the predicate exactly, including case. Call multiple times to allow multiple rules. MES 3.81.13 SP3 and MES 4.83.3 SP3.
addSecurityRules(rules)
Iterable[String]
No security rule filter
Includes requests for any non-blank security rule in the iterable. A None iterable is ignored. Blank values are skipped.

setRequiredUser(requiredUser)

String

No user filter

Includes requests for a matching username predicate. Username matching is case-insensitive.

setDescriptionContains(descriptionContains)

String

No description filter

Includes requests whose display text contains the supplied text. The display text is the request name, or request name plus description.

setExcludeCompleted(exclude)

Boolean

False

When True, excludes request slots that already have an authorization result.

setIncludeHidden(include)

Boolean

False

When True, includes requests from hidden/internal signature templates. Hidden requests are excluded by default.

Return Value

Type

Description

Map[UUID, PendingAuthenticationChallengeInfo]

A map where each key is a pending request UUID and each value describes that request slot.

Returned Request Info

Each PendingAuthenticationChallengeInfo value exposes these getters.


Getter

Type

Description

getUUID()

UUID

UUID for this individual pending request slot. This is the UUID passed to triggerAuthRequest.

getGroupUUID()

UUID

UUID shared by the grouped authorization request created from the same signature template.

getGroupName()

String

Request name supplied when the authorization request was queued.

getGroupDescription()

String

Request description supplied when the authorization request was queued.

getSignatureTemplate()

MESSignatureTemplate

Signature template used to create the request.

getUserOrRole()

String

Required username, role, or security-rule path for this request slot. Prefer getPredicateType() and getPredicateValue() when the template uses a security rule.

getPredicateType()
PredicateType
Predicate for this slot: role, securityRule, or userName.
getPredicateValue()
String
Role name, username, or security-rule path required for this slot.
getPredicateKey()
String
Lowercase type:value, such as securityrule:authenticated/roles/operator. None when the predicate value is blank.

getTextualDescription()

String

Display text for the request. If a description exists, this is requestName + ", " + description; otherwise it is the request name.

isAuthorized()

Boolean or None

Authorization result for this request slot. None means pending; True means approved; False means rejected if a rejected result is still present.

Scope / Availability

Context

Availability

Gateway / Perspective scripts

Available when the Production module registers system.mes.signature.authorization. Perspective scripts commonly use it to populate authorization request lists.

Designer / Vision Client

Not available as a direct client-side script function. Use a gateway or Perspective workflow to query pending authorization requests.

Filtering Behavior

When no filter is supplied, the function returns all pending requests for non-hidden signature templates. Hidden requests are returned only when setIncludeHidden(True) is used.

Role filters match {role:...} predicates. Security-rule filters match {securityRule:...} predicates. User filters match {userName:...} predicates, and username matching ignores case. Each request slot is matched by its own predicate type. If roles, a username, and security rules are all configured, a slot is included when it matches any one of those filters. Description filtering is applied after that match.

Excluded / Edge Cases

  • Hidden requests: Requests from hidden/internal signature templates are excluded unless filter.setIncludeHidden(True) is used.

  • Completed request slots: Partially completed multi-user authorizations can still appear in the returned map. Use filter.setExcludeCompleted(True) to return only slots whose isAuthorized() value is None.

  • Description matching: setDescriptionContains uses substring matching against the request display text. It is not a wildcard or regular expression filter.

  • Empty filters: A filter with no user, role, security rule, description, completed, or hidden settings behaves like an unfiltered call for non-hidden requests.

Example Usage

Minimal Example

Python
pending = system.mes.signature.authorization.getPendingAuthRequests()

for uuid in pending:
	info = pending.get(uuid)
	system.util.getLogger("MES Authorization").info(
		"%s requires %s" % (uuid, info.getUserOrRole())
	)

Complex Example

Python
logger = system.util.getLogger("MES Authorization")

authFilter = system.mes.object.signature.filter.create()
authFilter.setRequiredUser("Admin")
authFilter.addRole("Operator")
authFilter.setDescriptionContains("Line release")
authFilter.setExcludeCompleted(True)

pending = system.mes.signature.authorization.getPendingAuthRequests(authFilter)

for uuid in pending:
	info = pending.get(uuid)
	logger.info(
		"Request %s: %s, required signer: %s, status: %s" %
		(uuid, info.getTextualDescription(), info.getUserOrRole(), info.isAuthorized())
	)

	# In a Perspective component script, trigger the selected pending approval.
	if info.isAuthorized() is None:
		system.mes.signature.authorization.triggerAuthRequest(
			str(uuid),
			self.session,
			self.page,
			True
		)
		break

Python
authFilter = system.mes.object.signature.filter.create()
authFilter.addSecurityRule('Authenticated/Roles/Operator')
authFilter.setExcludeCompleted(True)

pending = system.mes.signature.authorization.getPendingAuthRequests(authFilter)

for uuid in pending:
	info = pending.get(uuid)
	print info.getPredicateType(), info.getPredicateValue()


Related Functions

Sepasoft MES Module Suite