iframe-footer.php
1 year ago
iframe-header.php
1 year ago
main-iframe.php
5 months ago
policy-metabox.php
1 year ago
policy-parent-metabox.php
1 year ago
policy-principal-metabox.php
1 year ago
post-iframe.php
1 year ago
post-metabox.php
1 year ago
principal-iframe.php
1 year ago
user-iframe.php
1 year ago
user-metabox.php
1 year ago
principal-iframe.php
140 lines
| 1 | <?php /** @version 7.0.0 **/ ?> |
| 2 | |
| 3 | <?php |
| 4 | if (defined('AAM_KEY')) { |
| 5 | wp_enqueue_style('aam-vendor', AAM_MEDIA . '/css/vendor.min.css', [], AAM_VERSION); |
| 6 | wp_enqueue_style('aam', AAM_MEDIA . '/css/aam.css', array('aam-vendor'), AAM_VERSION); |
| 7 | wp_enqueue_script('aam-iframe', AAM_MEDIA . '/js/iframe-content.js', [], AAM_VERSION); |
| 8 | } |
| 9 | ?> |
| 10 | |
| 11 | <?php if (defined('AAM_KEY')) { ?> |
| 12 | <?php echo static::loadTemplate(__DIR__ . '/iframe-header.php', $params); ?> |
| 13 | |
| 14 | <div class="metabox-holder main-metabox"> |
| 15 | <div class="postbox" style="border: none !important"> |
| 16 | <h3 class="hndle"> |
| 17 | <span><?php echo __('Users & Roles', 'advanced-access-manager'); ?></span> |
| 18 | </h3> |
| 19 | <div class="inside" style="padding: 0 0 12px 0" id="policy_principle_selector"> |
| 20 | <div class="aam-postbox-inside"> |
| 21 | <ul class="nav nav-tabs" role="tablist"> |
| 22 | <?php $active = 0; ?> |
| 23 | <?php if (current_user_can('aam_manage_roles')) { ?> |
| 24 | <li role="presentation" class="<?php echo (!$active++ ? 'active ' : ''); ?>text-center"><a href="#roles" aria-controls="roles" role="tab" data-toggle="tab"><i class="icon-users"></i><span class="aam-subject-title"><?php echo __('Roles', 'advanced-access-manager'); ?></span></a></li> |
| 25 | <?php } ?> |
| 26 | <?php if (current_user_can('aam_manage_users')) { ?> |
| 27 | <li role="presentation" class="<?php echo (!$active++ ? 'active ' : ''); ?>text-center"><a href="#users" aria-controls="users" role="tab" data-toggle="tab"><i class="icon-user"></i><span class="aam-subject-title"><?php echo __('Users', 'advanced-access-manager'); ?></span></a></li> |
| 28 | <?php } ?> |
| 29 | <?php if (current_user_can('aam_manage_visitors')) { ?> |
| 30 | <li role="presentation" class="<?php echo (!$active++ ? 'active ' : ''); ?>text-center"><a href="#visitor" aria-controls="visitor" role="tab" data-toggle="tab"><i class="icon-user-secret"></i><span class="aam-subject-title"><?php echo __('Visitor', 'advanced-access-manager'); ?></span></a></li> |
| 31 | <?php } ?> |
| 32 | <?php if (current_user_can('aam_manage_default')) { ?> |
| 33 | <li role="presentation" class="<?php echo (!$active++ ? 'active ' : ''); ?>text-center"><a href="#default" aria-controls="default" role="tab" data-toggle="tab" class="text-danger"><i class="icon-asterisk"></i><span class="aam-subject-title"><?php echo __('Default', 'advanced-access-manager'); ?></span></a></li> |
| 34 | <?php } ?> |
| 35 | <?php if ($active === 0) { ?> |
| 36 | <li role="presentation" class="active text-center"><a href="#none" aria-controls="none" role="tab" data-toggle="tab" class="text-muted"><i class="icon-asterisk"></i><span class="aam-subject-title"><?php echo __('None', 'advanced-access-manager'); ?></span></a></li> |
| 37 | <?php } ?> |
| 38 | </ul> |
| 39 | <div class="tab-content"> |
| 40 | <?php $active = 0; ?> |
| 41 | <?php if (current_user_can('aam_manage_roles')) { ?> |
| 42 | <div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="roles"> |
| 43 | <table id="policy_principle_role_list" class="table table-striped table-bordered"> |
| 44 | <thead> |
| 45 | <tr> |
| 46 | <th>ID</th> |
| 47 | <th width="80%"><?php echo __('Role', 'advanced-access-manager'); ?></th> |
| 48 | <th><?php echo __('Apply', 'advanced-access-manager'); ?></th> |
| 49 | <th>Data</th> |
| 50 | </tr> |
| 51 | </thead> |
| 52 | <tbody></tbody> |
| 53 | </table> |
| 54 | </div> |
| 55 | <?php } ?> |
| 56 | <?php if (current_user_can('aam_manage_users')) { ?> |
| 57 | <div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="users"> |
| 58 | <table id="policy_principle_user_list" class="table table-striped table-bordered"> |
| 59 | <thead> |
| 60 | <tr> |
| 61 | <th>ID</th> |
| 62 | <th width="80%"><?php echo __('Username', 'advanced-access-manager'); ?></th> |
| 63 | <th><?php echo __('Apply', 'advanced-access-manager'); ?></th> |
| 64 | <th>Data</th> |
| 65 | </tr> |
| 66 | </thead> |
| 67 | <tbody></tbody> |
| 68 | </table> |
| 69 | </div> |
| 70 | <?php } ?> |
| 71 | <?php if (current_user_can('aam_manage_visitors')) { ?> |
| 72 | <div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="visitor"> |
| 73 | <div class="visitor-message"> |
| 74 | <span class="aam-bordered"><?php echo __('Attach current policy to visitors (any user that is not authenticated).', 'advanced-access-manager'); ?></span> |
| 75 | <?php |
| 76 | $is_attached = AAM::api()->policies('visitor')->is_attached($params->policyId); |
| 77 | $btn_status = $is_attached === true ? 'detach' : 'attach'; |
| 78 | ?> |
| 79 | |
| 80 | <?php if ($is_attached) { ?> |
| 81 | <button |
| 82 | class="btn btn-primary btn-block" |
| 83 | id="toggle_visitor_policy" |
| 84 | data-has="1" |
| 85 | <?php echo ($btn_status ? '' : ' disabled'); ?> |
| 86 | ><?php echo __('Detach Policy From Visitors', 'advanced-access-manager'); ?></button> |
| 87 | <?php } else { ?> |
| 88 | <button |
| 89 | class="btn btn-primary btn-block" |
| 90 | id="toggle_visitor_policy" |
| 91 | data-has="0" |
| 92 | <?php echo ($btn_status ? '' : ' disabled'); ?> |
| 93 | ><?php echo __('Attach Policy To Visitors', 'advanced-access-manager'); ?></button> |
| 94 | <?php } ?> |
| 95 | </div> |
| 96 | </div> |
| 97 | <?php } ?> |
| 98 | <?php if (current_user_can('aam_manage_default')) { ?> |
| 99 | <div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="default"> |
| 100 | <div class="visitor-message"> |
| 101 | <span class="aam-bordered"><?php echo __('Attach current policy to all users, roles and visitors.', 'advanced-access-manager'); ?></span> |
| 102 | <?php |
| 103 | $is_attached = AAM::api()->policies('default')->is_attached($params->policyId); |
| 104 | $btn_status = $is_attached === true ? 'detach' : 'attach'; |
| 105 | ?> |
| 106 | |
| 107 | <?php if ($is_attached) { ?> |
| 108 | <button |
| 109 | class="btn btn-primary btn-block" |
| 110 | id="attach-policy-default" |
| 111 | data-has="1" |
| 112 | <?php echo ($btn_status ? '' : ' disabled'); ?> |
| 113 | ><?php echo __('Detach Policy From Everyone', 'advanced-access-manager'); ?></button> |
| 114 | <?php } else { ?> |
| 115 | <button |
| 116 | class="btn btn-primary btn-block" |
| 117 | id="attach-policy-default" |
| 118 | data-has="0" |
| 119 | <?php echo ($btn_status ? '' : ' disabled'); ?> |
| 120 | ><?php echo __('Attach Policy To Everyone', 'advanced-access-manager'); ?></button> |
| 121 | <?php } ?> |
| 122 | </div> |
| 123 | </div> |
| 124 | <?php } ?> |
| 125 | <?php if ($active === 0) { ?> |
| 126 | <div role="tabpanel" class="tab-pane active" id="none"> |
| 127 | <p class="alert alert-warning"><?php echo __('You are not allowed to manage any of the existing users, roles, visitors or default access settings.', 'advanced-access-manager'); ?></p> |
| 128 | </div> |
| 129 | <?php } ?> |
| 130 | </div> |
| 131 | </div> |
| 132 | </div> |
| 133 | </div> |
| 134 | </div> |
| 135 | |
| 136 | <!-- Additional attributes --> |
| 137 | <input type="hidden" id="aam-policy-id" value="<?php echo intval($params->policyId); ?>" /> |
| 138 | |
| 139 | <?php echo static::loadTemplate(__DIR__ . '/iframe-footer.php', $params); ?> |
| 140 | <?php } |