Self Service URL Formats for Categories?

cornwella
New Contributor III

Hello!

We're starting to use the new Self Service URL format for staff communication.
Policies take the following URL format:
jamfselfservice://content?entity=policy&id=792&action=view

Due to Google Mail's stripping of application-specific hyperlinks, we have to create a PHP redirect that identifies the requested entity, id and action, then constructs the Self Service query. This works great! Now we'd like to create URLs that open Self Service and point to Library categories instead of specific Policies; is anyone aware of the format these links would use? I'd assume it's something along the lines of:
jamfselfservice://content?entity=category&id=1

... but obviously it's not that, and I couldn't find any documentation referencing the possible entity names. Thank you!

7 REPLIES 7

mallej
New Contributor III

Hi @cornwella ,

how are these PHP redirects created? We are in the same situation with Gmail and no working hyperlinks to policies.

thanks

cornwella
New Contributor III

Hi @jensm ,

below is the code we use. We called our file self.php. You can adjust it to your needs!

<?php

// Self Service Redirect

// This script takes URL parameters for Jamf's Self Service module
// and creates a redirect, in order to work around Google Mail's link
// stripping of app-specific URLs (e.g. non-HTTP/HTTPS/FTP links).

// Example:
// jamfselfservice://content?entity=policy&id=792&action=view
// ... can be linked as ...
// http://(your server)/self.php?entity=policy&id=792&action=view

if ((!isset($_GET['entity'])) || (!isset($_GET['id'])) || (!isset($_GET['action']))) {
        header("Location: jamfselfservice://content");
} else {
    $entity = stripslashes($_GET['entity']);
    $id = (int)$_GET['id'];
    $action = stripslashes($_GET['action']);

    // Add possible value options here to prevent generation of arbitrary links.
    // There may be more, but these are the only ones I've found so far.
    if (($entity == "policy") && (($action == "view") || ($action == "execute"))) {

        header("Location: jamfselfservice://content?entity=" . $entity . "&id=" . $id ."&action=". $action); 

    } else {

        echo "Invalid URL parameters.";
        echo "<p><b>entity:</b> policy<br> <b>action:</b> view, execute </p>";
    }

}
exit();
?>

QCM
New Contributor

I see this is an older thread by was wondering if you made any improvements to this script especially now that Jamf has published Self Service URL Scheme documentation here:

https://learn.jamf.com/bundle/jamf-pro-documentation-current/page/Jamf_Self_Service_for_macOS_URL_Sc...

Particularly to add support for Search links, as well as Categories.

mallej
New Contributor III

thanks @cornwella ,

where do i have to put self.php in?

cornwella
New Contributor III

You can host it on any PHP-enabled web server that is accessible to the recipients of your email.

If you don't already have one, here's a good guide on how to get started (you can skip MySQL, though it does come in handy).

mallej
New Contributor III

thanks @cornwella , now i get it.

B_Hanson
New Contributor III
New Contributor III