BadgeSecurity
public final class BadgeSecurity
Usher Badges can have security restrictions configured by the administrator.
The BadgeSecurity
class provides the APIs to retrieve the active unsatisfied security restriction
on a Badge
object and also provides API to trigger the worflow to process the security restrictions.
This class is used extensively by the UsherSDK to make sure that a badge associated with any workflow
complies with all the restriction set for it.
-
Get a list of current unsatisfied security restrictions for the badge.
Declaration
Swift
public class func restrictionsForBadge(_ badge: Badge) -> [BadgeSecurityRestriction]
-
Same behavior as
processRestrictionsForBadge(badge:completion:)
but can process only a subset of badge security restriction.Remark
Low-Level API Use theprocessRestrictionsForBadge(badge:completion:)
whenever possible.Declaration
Swift
public class func processRestrictions(_ restrictions: [BadgeSecurityRestriction], forBadge badge: Badge, completion: @escaping (_ complies: Bool) -> Void)
-
This API triggers the workflow to attempt to satisfy / comply with badge security restrictions. If the workflow requires user action it will invoke the UI handlers registered with the UsherSDK using
UsherSDK.registerXXXClass(_)
APIs. If a handler is not registered then the workflow will fail. For a Badge to be considered having satisfied security restriction the entire workflow must complete successfully.Declaration
Swift
public class func processRestrictionsForBadge(_ badge: Badge, completion: @escaping (_ complies: Bool) -> Void)