generated from jric11/baseProject
77 lines
3.8 KiB
XML
77 lines
3.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
|
<xsl:output method="html" encoding="utf-8" indent="yes"/>
|
|
<xsl:param name="CSRF_TOKEN"/>
|
|
<xsl:template match="/">
|
|
<div class="py-4">
|
|
<h1 class="h3">Application access</h1>
|
|
<p class="text-muted">Choose a user, then select the applications they may open.</p>
|
|
<xsl:choose>
|
|
<xsl:when test="access/@setup_required = 'true'">
|
|
<div class="alert alert-info">Set up the application directory to start assigning access.</div>
|
|
<form action="main.php" method="post">
|
|
<input type="hidden" name="action" value="Applications.setup"/>
|
|
<input type="hidden" name="csrf_token" value="{$CSRF_TOKEN}"/>
|
|
<button type="submit" class="btn btn-primary">Set up application directory</button>
|
|
</form>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:if test="not(access/account_links)">
|
|
<div class="alert alert-info">Enable existing account links to prepare users for shared sign-in.</div>
|
|
<form action="main.php" method="post" class="mb-3">
|
|
<input type="hidden" name="action" value="Applications.setup"/>
|
|
<input type="hidden" name="csrf_token" value="{$CSRF_TOKEN}"/>
|
|
<button type="submit" class="btn btn-outline-primary">Enable account links</button>
|
|
</form>
|
|
</xsl:if>
|
|
<xsl:if test="access/@saved = 'true'"><div class="alert alert-success" role="status">Application access saved.</div></xsl:if>
|
|
<form action="main.php" method="get" class="mb-4">
|
|
<input type="hidden" name="Xaction" value="Applications.manageAccess"/>
|
|
<label for="access_user" class="form-label">User</label>
|
|
<div class="d-flex gap-2">
|
|
<select class="form-select" id="access_user" name="user_serial" required="required">
|
|
<option value="">Choose a user</option>
|
|
<xsl:for-each select="access/users/record">
|
|
<option value="{user_serial}">
|
|
<xsl:if test="user_serial = /access/@selected_user"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
|
|
<xsl:value-of select="user_name"/><xsl:if test="user_status != 'active'"> (inactive)</xsl:if>
|
|
</option>
|
|
</xsl:for-each>
|
|
</select>
|
|
<button type="submit" class="btn btn-outline-primary">Load</button>
|
|
</div>
|
|
</form>
|
|
<xsl:if test="access/users/record[user_serial = /access/@selected_user]">
|
|
<form action="main.php" method="post">
|
|
<input type="hidden" name="action" value="Applications.saveAccess"/>
|
|
<input type="hidden" name="csrf_token" value="{$CSRF_TOKEN}"/>
|
|
<input type="hidden" name="user_serial" value="{access/@selected_user}"/>
|
|
<fieldset class="mb-3"><legend class="h5">Assigned applications</legend>
|
|
<xsl:for-each select="access/applications/record">
|
|
<div class="form-check mb-2">
|
|
<input class="form-check-input" type="checkbox" name="applications[]" id="application_{application_serial}" value="{application_serial}">
|
|
<xsl:if test="assigned = '1'"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
|
|
</input>
|
|
<label class="form-check-label" for="application_{application_serial}">
|
|
<xsl:value-of select="application_name"/><xsl:if test="application_active != '1'"> (application disabled)</xsl:if>
|
|
</label>
|
|
<xsl:if test="/access/account_links">
|
|
<xsl:variable name="application" select="application_serial"/>
|
|
<div class="mt-2 mb-3">
|
|
<label class="form-label" for="local_user_{application_serial}">Existing <xsl:value-of select="application_name"/> user ID</label>
|
|
<input class="form-control" type="number" min="1" step="1" id="local_user_{application_serial}" name="local_users[{application_serial}]" value="{/access/account_links/record[application_serial = $application]/local_user_serial}"/>
|
|
<div class="form-text">Use the existing account's user_serial from this application's Users table. Clearing this field removes the account link when you save.</div>
|
|
</div>
|
|
</xsl:if>
|
|
</div>
|
|
</xsl:for-each>
|
|
</fieldset>
|
|
<button type="submit" class="btn btn-primary">Save access</button>
|
|
</form>
|
|
</xsl:if>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</div>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|