SAPcpmsUserRoles

open class SAPcpmsUserRoles

Loads information (name, id, roles) about the current user from SAP Mobile Services.

This sample code demonstrates how to create an SAPcpmsUserRoles instance:

var urlSession = SAPURLSession()
let settingsParameters = SAPcpmsSettingsParameters(backendURL: <#URL only with domain#>, applicationID: <#appid#>)
let userRoles = SAPcpmsUserRoles(sapURLSession: urlSession, settingsParameters: settingsParameters)
  • This struct contains user information such as id, username or roles.

    See more

    Declaration

    Swift

    public struct SAPcpmsUserInfo
  • Initializer for using SAPURLSession and the service url as an input

    Declaration

    Swift

    public init(sapURLSession: SAPURLSession, roleServiceUrl: URL)

    Parameters

    sapURLSession

    an SAPURLSession implementation that can be used to communicate with the SAP Mobile Services

    roleServiceUrl

    the full URL of the role service

  • Initializer for using SAPURLSession and SAPcpmsSettingsParameters as an input

    Declaration

    Swift

    public convenience init(sapURLSession: SAPURLSession, settingsParameters: SAPcpmsSettingsParameters)

    Parameters

    sapURLSession

    an SAPURLSession implementation that can be used to communicate with the SAP Mobile Services

    settingsParameters

    SAPcpms settings metadata to be able to concatenate the SAPcpms service URL

  • Loads information about the current user from mobile services.

    Declaration

    Swift

    open func load(completionHandler: @escaping (SAPcpmsUserInfo?, Error?) -> Void)

    Parameters

    completionHandler

    called when the result received from the server on background queue. In a successful case the error parameter is nil.