Introduction

The purpose of this task is to send download links to users with unregistered mobileID tokens.

The task can be found by navigating to "Administration | Tasks", then scrolling down to the task "Push unregistered mobileID download links";

Task Parameters

The task parameters are used by the task script to determine which tokens are to be deleted and are edited by left clicking on the context menu of the task and selecting "Parameters";

A new window titled "Task Parameters" will now open that lists the parameters making them available for editing, and the default parameters for this task are as follows;







If provided, this property will specify the Domain for which users within this domain will receive download links.




If provided, this property will specify the Group for which users within this domain will receive download links.





The parameters may then be editing by selecting one of the parameters, then clicking on the button.

Editing and Scheduling the Task

Viewing and Editing the task

The task can be edited by left clicking on the context menu of the task and selecting "Edit";

A new window will not open titled "Task - Edit";







Enter the name to be assigned to the task within the management console.





Enter a description of what the task will do.





The version number of the task.





This field is used to specify when the task is scheduled to execute.





This field will determine if the task schedule is enabled (if enabled the task will execute at the scheduled time).





Specifies how many times the task should be repeated after the task is executed.






import com.deepnet.das.util.Util
import com.deepnet.das.domain.Domain
import com.deepnet.das.exception.DomainNotFoundException
import com.deepnet.das.exception.GroupNotFoundException
import com.deepnet.das.identitysource.IdentitySourceType
import com.deepnet.das.message.SendingOption
import com.deepnet.das.user.User
import com.deepnet.das.usergroup.Group
import com.deepnet.das.usergroup.LdapGroup
import com.deepnet.das.services.MessageSendingService

def sendDownloadUrl(String domainName, String groupName) {
Domain givenDomain = Domain.findByName(domainName)
if (!givenDomain) {
throw new DomainNotFoundException(domainName)
}

Group givenGroup
if(groupName) {
givenGroup = findGroupFromDomain(givenDomain, groupName)
if (!givenGroup) {
throw new GroupNotFoundException()
}
givenGroup.eachUser { user -> sendLinksByUser(user) }
} else
givenDomain.eachUser { user -> sendLinksByUser(user)}
}

void sendLinksByUser(User user) {
def tokenAssignments = user.tokenAssignments.findAll { it.token.product.name == "MobileID" };
if (tokenAssignments) {
//find all unregistered mobileID tokens
tokenAssignments = tokenAssignments.findAll { !it.token.oobDeviceType || !it.token.oobMsgRegId }
def messageSendingService = Util.getBean("messageSendingService", MessageSendingService.class)
tokenAssignments?.each { ta ->
messageSendingService.asyncSendTokenDownloadUrl(ta, new SendingOption([:]),null)
}
}
}

Group findGroupFromDomain(Domain domain, String groupName) {
if (domain.identitySource.type == IdentitySourceType.SQL) {
return Group.findByDomainAndName(domain, groupName)
} else if (domain.identitySource.type == IdentitySourceType.LDAP) {
def list = LdapGroup.searchInLdap(domain, [["name", "=", groupName]])
if (!list || !list.rows)
return null
return list.rows.get(0)
}
}

sendDownloadUrl(domainName, groupName)





Scheduling the Task

Select the "Enable Schedule" checkbox to ensure the task schedule is activated, then use the pencil icon ("")  to specify the time and frequency settings for automated task execution.

Manual Task Execution

The task can be run manually from the management console by left click on the context menu of the task, then selecting "Run";

A new window will open titled "Run Task" will then open (the window will be populated with the default task property values);







Provide a brief description that will be used to describe the purpose of the task in the audit logs that should be retained in the database after the purge has been performed.





This property will specify the Domain for which users within this domain will receive download links.





This property will specify the Group for which users within this domain will receive download links.




To execute the task click  the  button.