Version Description
- Added a huge innovation to the access control management - Access & Security Policy
- Fixed the bug with updating extension versions
Download this release
Release Info
Developer | vasyl_m |
Plugin | Advanced Access Manager |
Version | 5.7 |
Comparing to | |
See all releases |
Code changes from version 5.6.1.1 to 5.7
- Application/Backend/Feature/Main/Policy.php +49 -39
- Application/Backend/Feature/Subject/Role.php +29 -19
- Application/Backend/Feature/Subject/User.php +26 -18
- Application/Backend/Manager.php +87 -8
- Application/Backend/View.php +29 -1
- Application/Backend/phtml/main/policy.phtml +1 -49
- Application/Backend/phtml/metabox/metabox-content.phtml +43 -7
- Application/Backend/phtml/metabox/policy-metabox.phtml +82 -10
- Application/Backend/phtml/metabox/policy-principal-metabox.phtml +3 -0
- Application/Backend/phtml/metabox/post-metabox.phtml +1 -1
- Application/Backend/phtml/metabox/term-metabox.phtml +1 -1
- Application/Core/Object/Policy.php +24 -15
- Application/Extension/Repository.php +16 -5
- Application/Shared/Manager.php +12 -28
- aam.php +1 -1
- media/css/datatables.min.css +10 -1
- media/js/{aam.js → aam-5.7.js} +278 -249
- readme.txt +5 -1
Application/Backend/Feature/Main/Policy.php
CHANGED
@@ -23,29 +23,6 @@ class AAM_Backend_Feature_Main_Policy extends AAM_Backend_Feature_Abstract {
|
|
23 |
return wp_json_encode($this->retrievePolicies());
|
24 |
}
|
25 |
|
26 |
-
/**
|
27 |
-
*
|
28 |
-
* @return type
|
29 |
-
*/
|
30 |
-
public function savePolicy() {
|
31 |
-
$id = filter_input(INPUT_POST, 'id');
|
32 |
-
$policy = filter_input(INPUT_POST, 'policy');
|
33 |
-
|
34 |
-
$policies = AAM_Core_API::getOption('aam-policy-list', array(), 'site');
|
35 |
-
|
36 |
-
if (empty($id)) {
|
37 |
-
$id = uniqid();
|
38 |
-
}
|
39 |
-
|
40 |
-
$policies[$id] = $policy;
|
41 |
-
|
42 |
-
AAM_Core_API::updateOption('aam-policy-list', $policies, 'site');
|
43 |
-
|
44 |
-
AAM_Core_API::clearCache();
|
45 |
-
|
46 |
-
return wp_json_encode(array('status' => 'success'));
|
47 |
-
}
|
48 |
-
|
49 |
/**
|
50 |
*
|
51 |
* @return type
|
@@ -117,7 +94,14 @@ class AAM_Backend_Feature_Main_Policy extends AAM_Backend_Feature_Abstract {
|
|
117 |
* @return type
|
118 |
*/
|
119 |
protected function retrievePolicies() {
|
120 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
$response = array(
|
123 |
'recordsTotal' => count($list),
|
@@ -126,25 +110,51 @@ class AAM_Backend_Feature_Main_Policy extends AAM_Backend_Feature_Abstract {
|
|
126 |
'data' => array(),
|
127 |
);
|
128 |
|
129 |
-
foreach($list as $
|
130 |
-
$policy = json_decode($
|
131 |
-
|
132 |
-
|
133 |
-
$
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
return $response;
|
140 |
}
|
141 |
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
$title .= '<br/>';
|
145 |
|
146 |
-
if (isset($
|
147 |
-
$title .= '<small>' . esc_js($
|
148 |
}
|
149 |
|
150 |
return $title;
|
@@ -152,16 +162,16 @@ class AAM_Backend_Feature_Main_Policy extends AAM_Backend_Feature_Abstract {
|
|
152 |
|
153 |
/**
|
154 |
*
|
155 |
-
* @param type $
|
156 |
* @return type
|
157 |
*/
|
158 |
-
protected function buildActionList($
|
159 |
//'assign,edit,clone,delete'
|
160 |
$subject = AAM_Backend_Subject::getInstance();
|
161 |
$object = $subject->getObject('policy');
|
162 |
$actions = array();
|
163 |
|
164 |
-
$actions[] = $object->has($
|
165 |
$actions[] = 'edit';
|
166 |
$actions[] = 'delete';
|
167 |
|
23 |
return wp_json_encode($this->retrievePolicies());
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
/**
|
27 |
*
|
28 |
* @return type
|
94 |
* @return type
|
95 |
*/
|
96 |
protected function retrievePolicies() {
|
97 |
+
$search = trim(AAM_Core_Request::request('search.value'));
|
98 |
+
|
99 |
+
$list = get_posts(array(
|
100 |
+
'post_type' => 'aam_policy',
|
101 |
+
'numberposts' => AAM_Core_Request::request('length'),
|
102 |
+
'offset' => AAM_Core_Request::request('start'),
|
103 |
+
's' => ($search ? $search . '*' : ''),
|
104 |
+
));
|
105 |
|
106 |
$response = array(
|
107 |
'recordsTotal' => count($list),
|
110 |
'data' => array(),
|
111 |
);
|
112 |
|
113 |
+
foreach($list as $record) {
|
114 |
+
$policy = json_decode($record->post_content);
|
115 |
+
|
116 |
+
if ($policy) {
|
117 |
+
$response['data'][] = array(
|
118 |
+
$record->ID,
|
119 |
+
$this->buildTitle($record),
|
120 |
+
$this->buildActionList($record),
|
121 |
+
get_edit_post_link($record->ID, 'link')
|
122 |
+
);
|
123 |
+
}
|
124 |
}
|
125 |
|
126 |
return $response;
|
127 |
}
|
128 |
|
129 |
+
/**
|
130 |
+
*
|
131 |
+
* @global type $wpdb
|
132 |
+
* @param type $type
|
133 |
+
* @param type $search
|
134 |
+
* @return type
|
135 |
+
*/
|
136 |
+
protected function getPolicyCount($type, $search) {
|
137 |
+
global $wpdb;
|
138 |
+
|
139 |
+
$query = "SELECT COUNT(*) AS total FROM {$wpdb->posts} ";
|
140 |
+
$query .= "WHERE (post_type = %s) AND (post_title LIKE %s) AND (post_status = %s)";
|
141 |
+
|
142 |
+
$args = array($type, "{$search}%", 'publish');
|
143 |
+
|
144 |
+
return $wpdb->get_var($wpdb->prepare($query, $args));
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
*
|
149 |
+
* @param type $record
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
protected function buildTitle($record) {
|
153 |
+
$title = (!empty($record->post_title) ? $record->post_title : __('(no title)'));
|
154 |
$title .= '<br/>';
|
155 |
|
156 |
+
if (isset($record->post_excerpt)) {
|
157 |
+
$title .= '<small>' . esc_js($record->post_excerpt) . '</small>';
|
158 |
}
|
159 |
|
160 |
return $title;
|
162 |
|
163 |
/**
|
164 |
*
|
165 |
+
* @param type $record
|
166 |
* @return type
|
167 |
*/
|
168 |
+
protected function buildActionList($record) {
|
169 |
//'assign,edit,clone,delete'
|
170 |
$subject = AAM_Backend_Subject::getInstance();
|
171 |
$object = $subject->getObject('policy');
|
172 |
$actions = array();
|
173 |
|
174 |
+
$actions[] = $object->has($record->ID) ? 'unassign' : 'assign';
|
175 |
$actions[] = 'edit';
|
176 |
$actions[] = 'delete';
|
177 |
|
Application/Backend/Feature/Subject/Role.php
CHANGED
@@ -42,15 +42,15 @@ class AAM_Backend_Feature_Subject_Role {
|
|
42 |
|
43 |
foreach ($filtered as $id => $data) {
|
44 |
$uc = (isset($stats[$id]) ? $stats[$id] : 0);
|
45 |
-
|
46 |
$response['data'][] = array(
|
47 |
$id,
|
48 |
$uc,
|
49 |
translate_user_role($data['name']),
|
50 |
apply_filters(
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
),
|
55 |
AAM_Core_API::maxLevel($data['capabilities']),
|
56 |
AAM_Core_API::getOption("aam-role-{$id}-expiration", '')
|
@@ -73,23 +73,33 @@ class AAM_Backend_Feature_Subject_Role {
|
|
73 |
* @param type $count
|
74 |
* @return string
|
75 |
*/
|
76 |
-
protected function prepareRowActions($count) {
|
77 |
-
$
|
|
|
78 |
|
79 |
-
if (
|
80 |
-
$
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
if (current_user_can('aam_create_roles')) {
|
85 |
-
$actions[] = 'clone';
|
86 |
-
} else {
|
87 |
-
$actions[] = 'no-clone';
|
88 |
-
}
|
89 |
-
if (current_user_can('aam_delete_roles') && !$count) {
|
90 |
-
$actions[] = 'delete';
|
91 |
} else {
|
92 |
-
$actions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
return $actions;
|
42 |
|
43 |
foreach ($filtered as $id => $data) {
|
44 |
$uc = (isset($stats[$id]) ? $stats[$id] : 0);
|
45 |
+
|
46 |
$response['data'][] = array(
|
47 |
$id,
|
48 |
$uc,
|
49 |
translate_user_role($data['name']),
|
50 |
apply_filters(
|
51 |
+
'aam-role-row-actions-filter',
|
52 |
+
implode(',', $this->prepareRowActions($uc, $id)),
|
53 |
+
$data
|
54 |
),
|
55 |
AAM_Core_API::maxLevel($data['capabilities']),
|
56 |
AAM_Core_API::getOption("aam-role-{$id}-expiration", '')
|
73 |
* @param type $count
|
74 |
* @return string
|
75 |
*/
|
76 |
+
protected function prepareRowActions($count, $roleId) {
|
77 |
+
$ui = AAM_Core_Request::post('ui', 'main');
|
78 |
+
$id = AAM_Core_Request::post('id');
|
79 |
|
80 |
+
if ($ui === 'principal') {
|
81 |
+
$subject = new AAM_Core_Subject_Role($roleId);
|
82 |
+
$object = $subject->getObject('policy');
|
83 |
+
|
84 |
+
$actions = array(($object->has($id) ? 'detach' : 'attach'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
} else {
|
86 |
+
$actions = array('manage');
|
87 |
+
|
88 |
+
if (current_user_can('aam_edit_roles')) {
|
89 |
+
$actions[] = 'edit';
|
90 |
+
} else {
|
91 |
+
$actions[] = 'no-edit';
|
92 |
+
}
|
93 |
+
if (current_user_can('aam_create_roles')) {
|
94 |
+
$actions[] = 'clone';
|
95 |
+
} else {
|
96 |
+
$actions[] = 'no-clone';
|
97 |
+
}
|
98 |
+
if (current_user_can('aam_delete_roles') && !$count) {
|
99 |
+
$actions[] = 'delete';
|
100 |
+
} else {
|
101 |
+
$actions[] = 'no-delete';
|
102 |
+
}
|
103 |
}
|
104 |
|
105 |
return $actions;
|
Application/Backend/Feature/Subject/User.php
CHANGED
@@ -211,25 +211,33 @@ class AAM_Backend_Feature_Subject_User {
|
|
211 |
*/
|
212 |
protected function prepareRowActions(AAM_Core_Subject_User $user) {
|
213 |
if ($this->isAllowed($user) || ($user->ID == get_current_user_id())) {
|
214 |
-
$
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
$
|
219 |
-
|
220 |
-
|
221 |
-
if (current_user_can('edit_users')) {
|
222 |
-
$actions[] = 'edit';
|
223 |
-
$actions[] = 'ttl';
|
224 |
-
} else {
|
225 |
-
$actions[] = 'no-edit';
|
226 |
-
$actions[] = 'no-ttl';
|
227 |
-
}
|
228 |
-
|
229 |
-
if (current_user_can('aam_switch_users')) {
|
230 |
-
$actions[] = 'switch';
|
231 |
} else {
|
232 |
-
$actions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
234 |
} else {
|
235 |
$actions = array();
|
211 |
*/
|
212 |
protected function prepareRowActions(AAM_Core_Subject_User $user) {
|
213 |
if ($this->isAllowed($user) || ($user->ID == get_current_user_id())) {
|
214 |
+
$ui = AAM_Core_Request::post('ui', 'main');
|
215 |
+
$id = AAM_Core_Request::post('id');
|
216 |
+
|
217 |
+
if ($ui === 'principal') {
|
218 |
+
$object = $user->getObject('policy');
|
219 |
+
$actions = array(($object->has($id) ? 'detach' : 'attach'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
} else {
|
221 |
+
$actions = array('manage');
|
222 |
+
|
223 |
+
if (AAM_Core_Config::get('core.settings.secureLogin', true)
|
224 |
+
&& current_user_can('aam_toggle_users')) {
|
225 |
+
$actions[] = ($user->user_status ? 'unlock' : 'lock');
|
226 |
+
}
|
227 |
+
|
228 |
+
if (current_user_can('edit_users')) {
|
229 |
+
$actions[] = 'edit';
|
230 |
+
$actions[] = 'ttl';
|
231 |
+
} else {
|
232 |
+
$actions[] = 'no-edit';
|
233 |
+
$actions[] = 'no-ttl';
|
234 |
+
}
|
235 |
+
|
236 |
+
if (current_user_can('aam_switch_users')) {
|
237 |
+
$actions[] = 'switch';
|
238 |
+
} else {
|
239 |
+
$actions[] = 'no-switch';
|
240 |
+
}
|
241 |
}
|
242 |
} else {
|
243 |
$actions = array();
|
Application/Backend/Manager.php
CHANGED
@@ -58,6 +58,9 @@ class AAM_Backend_Manager {
|
|
58 |
//permalink manager
|
59 |
add_filter('get_sample_permalink_html', array($this, 'getPermalinkHtml'), 10, 5);
|
60 |
|
|
|
|
|
|
|
61 |
//screen options & contextual help hooks
|
62 |
add_filter('screen_options_show_screen', array($this, 'screenOptions'));
|
63 |
add_filter('contextual_help', array($this, 'helpOptions'), 10, 3);
|
@@ -80,6 +83,9 @@ class AAM_Backend_Manager {
|
|
80 |
add_action('add_meta_boxes', array($this, 'metabox'));
|
81 |
}
|
82 |
|
|
|
|
|
|
|
83 |
//manager AAM Ajax Requests
|
84 |
add_action('wp_ajax_aam', array($this, 'ajax'));
|
85 |
//manager AAM Features Content rendering
|
@@ -133,6 +139,36 @@ class AAM_Backend_Manager {
|
|
133 |
}
|
134 |
}
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
/**
|
137 |
*
|
138 |
*/
|
@@ -471,6 +507,52 @@ class AAM_Backend_Manager {
|
|
471 |
}
|
472 |
}
|
473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
/**
|
475 |
*
|
476 |
* @global type $wp_admin_bar
|
@@ -654,7 +736,7 @@ class AAM_Backend_Manager {
|
|
654 |
public function printJavascript() {
|
655 |
if (AAM::isAAM()) {
|
656 |
wp_enqueue_script('aam-vendor', AAM_MEDIA . '/js/vendor.js');
|
657 |
-
wp_enqueue_script('aam-main', AAM_MEDIA . '/js/aam.js');
|
658 |
|
659 |
//add plugin localization
|
660 |
$this->printLocalization('aam-main');
|
@@ -697,6 +779,7 @@ class AAM_Backend_Manager {
|
|
697 |
$locals = array(
|
698 |
'nonce' => wp_create_nonce('aam_ajax'),
|
699 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
|
|
700 |
'url' => array(
|
701 |
'site' => admin_url('index.php'),
|
702 |
'editUser' => admin_url('user-edit.php'),
|
@@ -717,10 +800,6 @@ class AAM_Backend_Manager {
|
|
717 |
)
|
718 |
);
|
719 |
|
720 |
-
if (AAM_Core_Request::get('aamframe')) {
|
721 |
-
$locals['ui'] = 'post';
|
722 |
-
}
|
723 |
-
|
724 |
wp_localize_script($localKey, 'aamLocal', $locals);
|
725 |
}
|
726 |
|
@@ -766,13 +845,13 @@ class AAM_Backend_Manager {
|
|
766 |
);
|
767 |
|
768 |
// Access policy page
|
769 |
-
|
770 |
'aam',
|
771 |
'Access Policies',
|
772 |
'Access Policies',
|
773 |
-
AAM_Core_Config::get('policy.capability', '
|
774 |
'edit.php?post_type=aam_policy'
|
775 |
-
)
|
776 |
}
|
777 |
|
778 |
/**
|
58 |
//permalink manager
|
59 |
add_filter('get_sample_permalink_html', array($this, 'getPermalinkHtml'), 10, 5);
|
60 |
|
61 |
+
//access policy save
|
62 |
+
add_filter('wp_insert_post_data', array($this, 'filterPostData'), 10, 2);
|
63 |
+
|
64 |
//screen options & contextual help hooks
|
65 |
add_filter('screen_options_show_screen', array($this, 'screenOptions'));
|
66 |
add_filter('contextual_help', array($this, 'helpOptions'), 10, 3);
|
83 |
add_action('add_meta_boxes', array($this, 'metabox'));
|
84 |
}
|
85 |
|
86 |
+
//register custom access control metabox
|
87 |
+
add_action('add_meta_boxes', array($this, 'registerPolicyDocMetabox'));
|
88 |
+
|
89 |
//manager AAM Ajax Requests
|
90 |
add_action('wp_ajax_aam', array($this, 'ajax'));
|
91 |
//manager AAM Features Content rendering
|
139 |
}
|
140 |
}
|
141 |
|
142 |
+
/**
|
143 |
+
*
|
144 |
+
* @param type $data
|
145 |
+
* @return type
|
146 |
+
*/
|
147 |
+
public function filterPostData($data) {
|
148 |
+
if (isset($data['post_type']) && ($data['post_type'] === 'aam_policy')) {
|
149 |
+
$data['post_content'] = trim(filter_input(INPUT_POST, 'aam-policy'));
|
150 |
+
|
151 |
+
if (empty($data['post_content'])) {
|
152 |
+
$data['post_content'] = <<<EOT
|
153 |
+
{
|
154 |
+
"Version": "1.0.0",
|
155 |
+
"Statement": [
|
156 |
+
{
|
157 |
+
"Effect": "deny",
|
158 |
+
"Resource": [],
|
159 |
+
"Action": []
|
160 |
+
}
|
161 |
+
]
|
162 |
+
}
|
163 |
+
EOT;
|
164 |
+
}
|
165 |
+
|
166 |
+
AAM_Core_API::clearCache();
|
167 |
+
}
|
168 |
+
|
169 |
+
return $data;
|
170 |
+
}
|
171 |
+
|
172 |
/**
|
173 |
*
|
174 |
*/
|
507 |
}
|
508 |
}
|
509 |
|
510 |
+
/**
|
511 |
+
*
|
512 |
+
* @global WP_Post $post
|
513 |
+
*/
|
514 |
+
public function registerPolicyDocMetabox() {
|
515 |
+
global $post;
|
516 |
+
|
517 |
+
if (is_a($post, 'WP_Post') && ($post->post_type === 'aam_policy')) {
|
518 |
+
add_meta_box(
|
519 |
+
'aam-policy',
|
520 |
+
__('Policy Document', AAM_KEY),
|
521 |
+
array($this, 'renderPolicyMetabox'),
|
522 |
+
null,
|
523 |
+
'normal',
|
524 |
+
'high'
|
525 |
+
);
|
526 |
+
add_meta_box(
|
527 |
+
'aam-policy-attached',
|
528 |
+
__('Policy Principals', AAM_KEY),
|
529 |
+
array($this, 'renderPolicyPrincipalMetabox'),
|
530 |
+
null,
|
531 |
+
'side'
|
532 |
+
);
|
533 |
+
}
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
*
|
538 |
+
* @global WP_Post $post
|
539 |
+
*/
|
540 |
+
public function renderPolicyMetabox() {
|
541 |
+
global $post;
|
542 |
+
|
543 |
+
if (is_a($post, 'WP_Post')) {
|
544 |
+
echo AAM_Backend_View::getInstance()->renderPolicyMetabox($post);
|
545 |
+
}
|
546 |
+
}
|
547 |
+
|
548 |
+
public function renderPolicyPrincipalMetabox() {
|
549 |
+
global $post;
|
550 |
+
|
551 |
+
if (is_a($post, 'WP_Post')) {
|
552 |
+
echo AAM_Backend_View::getInstance()->renderPolicyPrincipalMetabox($post);
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
/**
|
557 |
*
|
558 |
* @global type $wp_admin_bar
|
736 |
public function printJavascript() {
|
737 |
if (AAM::isAAM()) {
|
738 |
wp_enqueue_script('aam-vendor', AAM_MEDIA . '/js/vendor.js');
|
739 |
+
wp_enqueue_script('aam-main', AAM_MEDIA . '/js/aam-5.7.js');
|
740 |
|
741 |
//add plugin localization
|
742 |
$this->printLocalization('aam-main');
|
779 |
$locals = array(
|
780 |
'nonce' => wp_create_nonce('aam_ajax'),
|
781 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
782 |
+
'ui' => AAM_Core_Request::get('aamframe', 'main'),
|
783 |
'url' => array(
|
784 |
'site' => admin_url('index.php'),
|
785 |
'editUser' => admin_url('user-edit.php'),
|
800 |
)
|
801 |
);
|
802 |
|
|
|
|
|
|
|
|
|
803 |
wp_localize_script($localKey, 'aamLocal', $locals);
|
804 |
}
|
805 |
|
845 |
);
|
846 |
|
847 |
// Access policy page
|
848 |
+
add_submenu_page(
|
849 |
'aam',
|
850 |
'Access Policies',
|
851 |
'Access Policies',
|
852 |
+
AAM_Core_Config::get('policy.capability', 'aam_manage_policy'),
|
853 |
'edit.php?post_type=aam_policy'
|
854 |
+
);
|
855 |
}
|
856 |
|
857 |
/**
|
Application/Backend/View.php
CHANGED
@@ -34,7 +34,7 @@ class AAM_Backend_View {
|
|
34 |
protected function __construct() {
|
35 |
//register default features
|
36 |
AAM_Backend_Feature_Main_GetStarted::register();
|
37 |
-
|
38 |
AAM_Backend_Feature_Main_Menu::register();
|
39 |
AAM_Backend_Feature_Main_Toolbar::register();
|
40 |
AAM_Backend_Feature_Main_Metabox::register();
|
@@ -127,6 +127,34 @@ class AAM_Backend_View {
|
|
127 |
return $content;
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
/**
|
131 |
*
|
132 |
* @param type $term
|
34 |
protected function __construct() {
|
35 |
//register default features
|
36 |
AAM_Backend_Feature_Main_GetStarted::register();
|
37 |
+
AAM_Backend_Feature_Main_Policy::register();
|
38 |
AAM_Backend_Feature_Main_Menu::register();
|
39 |
AAM_Backend_Feature_Main_Toolbar::register();
|
40 |
AAM_Backend_Feature_Main_Metabox::register();
|
127 |
return $content;
|
128 |
}
|
129 |
|
130 |
+
/**
|
131 |
+
*
|
132 |
+
* @param type $post
|
133 |
+
* @return type
|
134 |
+
*/
|
135 |
+
public function renderPolicyMetabox($post) {
|
136 |
+
ob_start();
|
137 |
+
require_once dirname(__FILE__) . '/phtml/metabox/policy-metabox.phtml';
|
138 |
+
$content = ob_get_contents();
|
139 |
+
ob_end_clean();
|
140 |
+
|
141 |
+
return $content;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
*
|
146 |
+
* @param type $post
|
147 |
+
* @return type
|
148 |
+
*/
|
149 |
+
public function renderPolicyPrincipalMetabox($post) {
|
150 |
+
ob_start();
|
151 |
+
require_once dirname(__FILE__) . '/phtml/metabox/policy-principal-metabox.phtml';
|
152 |
+
$content = ob_get_contents();
|
153 |
+
ob_end_clean();
|
154 |
+
|
155 |
+
return $content;
|
156 |
+
}
|
157 |
+
|
158 |
/**
|
159 |
*
|
160 |
* @param type $term
|
Application/Backend/phtml/main/policy.phtml
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php if (defined('AAM_KEY')) { ?>
|
2 |
<div class="aam-feature" id="policy-content">
|
3 |
-
<?php $subject = AAM_Backend_Subject::getInstance(); ?>
|
4 |
-
|
5 |
<div class="row">
|
6 |
<div class="col-xs-12">
|
7 |
<p class="aam-info">
|
@@ -26,59 +24,13 @@
|
|
26 |
<tr>
|
27 |
<th>ID</th>
|
28 |
<th width="80%"><?php echo __('Policy', AAM_KEY); ?></th>
|
29 |
-
<th>JSON</th>
|
30 |
<th><?php echo __('Actions', AAM_KEY); ?></th>
|
|
|
31 |
</tr>
|
32 |
</thead>
|
33 |
<tbody></tbody>
|
34 |
</table>
|
35 |
</div>
|
36 |
</div>
|
37 |
-
|
38 |
-
<div class="modal fade" id="policy-model" tabindex="-1" role="dialog">
|
39 |
-
<div class="modal-dialog modal-lg" role="document">
|
40 |
-
<div class="modal-content">
|
41 |
-
<div class="modal-header">
|
42 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">×</span></button>
|
43 |
-
<h4 class="modal-title"><?php echo __('Manage Policy', AAM_KEY); ?></h4>
|
44 |
-
</div>
|
45 |
-
<div class="modal-body">
|
46 |
-
<div class="form-group">
|
47 |
-
<label><?php echo AAM_Backend_View_Helper::preparePhrase('Policy Document', 'small'); ?></label>
|
48 |
-
<div class="alert alert-danger hidden" id="policy-parsing-error"></div>
|
49 |
-
<div class="aam-outer-top-xxs">
|
50 |
-
<textarea id="policy-editor" class="policy-editor" rows="10"></textarea>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
</div>
|
54 |
-
<div class="modal-footer">
|
55 |
-
<button type="button" class="btn btn-success" id="policy-save-btn"><?php echo __('Save', AAM_KEY); ?></button>
|
56 |
-
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
|
57 |
-
</div>
|
58 |
-
</div>
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
|
62 |
-
<div class="modal fade" id="policy-delete-model" tabindex="-1" role="dialog">
|
63 |
-
<div class="modal-dialog modal-sm" role="document">
|
64 |
-
<div class="modal-content">
|
65 |
-
<div class="modal-header">
|
66 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', AAM_KEY); ?>"><span aria-hidden="true">×</span></button>
|
67 |
-
<h4 class="modal-title"><?php echo __('Delete Policy', AAM_KEY); ?></h4>
|
68 |
-
</div>
|
69 |
-
<div class="modal-body">
|
70 |
-
<div class="form-group">
|
71 |
-
<p class="aam-notification">
|
72 |
-
You are about to delete the access policy. Please confirm!
|
73 |
-
</p>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
<div class="modal-footer">
|
77 |
-
<button type="button" class="btn btn-danger" id="policy-delete-btn"><?php echo __('Delete', AAM_KEY); ?></button>
|
78 |
-
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', AAM_KEY); ?></button>
|
79 |
-
</div>
|
80 |
-
</div>
|
81 |
-
</div>
|
82 |
-
</div>
|
83 |
</div>
|
84 |
<?php }
|
1 |
<?php if (defined('AAM_KEY')) { ?>
|
2 |
<div class="aam-feature" id="policy-content">
|
|
|
|
|
3 |
<div class="row">
|
4 |
<div class="col-xs-12">
|
5 |
<p class="aam-info">
|
24 |
<tr>
|
25 |
<th>ID</th>
|
26 |
<th width="80%"><?php echo __('Policy', AAM_KEY); ?></th>
|
|
|
27 |
<th><?php echo __('Actions', AAM_KEY); ?></th>
|
28 |
+
<th>Edit Link</th>
|
29 |
</tr>
|
30 |
</thead>
|
31 |
<tbody></tbody>
|
32 |
</table>
|
33 |
</div>
|
34 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
</div>
|
36 |
<?php }
|
Application/Backend/phtml/metabox/metabox-content.phtml
CHANGED
@@ -73,21 +73,50 @@
|
|
73 |
<?php if (current_user_can('aam_manage_visitors')) { ?>
|
74 |
<div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="visitor">
|
75 |
<div class="visitor-message">
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
</div>
|
79 |
</div>
|
80 |
<?php } ?>
|
81 |
<?php if (current_user_can('aam_manage_default')) { ?>
|
82 |
<div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="default">
|
83 |
<div class="visitor-message">
|
84 |
-
|
|
|
|
|
|
|
|
|
85 |
<?php if (defined('AAM_PLUS_PACKAGE')) { ?>
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
<?php } else { ?>
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
<?php } ?>
|
92 |
</div>
|
93 |
</div>
|
@@ -97,6 +126,7 @@
|
|
97 |
</div>
|
98 |
</div>
|
99 |
|
|
|
100 |
<div class="col-sm-8" id="post-content">
|
101 |
<div class="aam-overwrite hidden" id="post-overwritten">
|
102 |
<span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
|
@@ -122,10 +152,16 @@
|
|
122 |
|
123 |
<?php require AAM_BASEDIR . '/Application/Backend/phtml/partial/post-advanced-settings.phtml'; ?>
|
124 |
</div>
|
|
|
125 |
</div>
|
126 |
|
|
|
127 |
<p style="margin: 5px; text-align: left; font-size: 0.9em;">
|
128 |
<b>Please help us</b> and submit your review <a href="https://wordpress.org/support/plugin/advanced-access-manager/reviews/" target="_blank"><i class="icon-star"></i><i class="icon-star"></i><i class="icon-star"></i><i class="icon-star"></i><i class="icon-star"></i></a>
|
129 |
</p>
|
|
|
|
|
|
|
|
|
130 |
</body>
|
131 |
</html>
|
73 |
<?php if (current_user_can('aam_manage_visitors')) { ?>
|
74 |
<div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="visitor">
|
75 |
<div class="visitor-message">
|
76 |
+
<?php if (AAM_Core_Request::get('aamframe') !== 'principal') { ?>
|
77 |
+
<span class="aam-bordered"><?php echo sprintf(__('Manage access to %s for visitors (any user that is not authenticated)', AAM_KEY), '<b>' . ($object->type == 'post' ? $object->post->post_title : $object->term->name) . '</b>'); ?>.</span>
|
78 |
+
<button class="btn btn-primary btn-block" id="manage-visitor"><i class="icon-cog"></i> <?php echo __('Manage Visitors', AAM_KEY); ?></button>
|
79 |
+
<?php } else { ?>
|
80 |
+
<span class="aam-bordered"><?php echo __('Attach current access & security policy to visitors (any user that is not authenticated)', AAM_KEY); ?>.</span>
|
81 |
+
<?php
|
82 |
+
$visitor = new AAM_Core_Subject_Visitor();
|
83 |
+
$hasPolicy = $visitor->getObject('policy')->has($object->id);
|
84 |
+
?>
|
85 |
+
<?php if ($hasPolicy) { ?>
|
86 |
+
<button class="btn btn-primary btn-block" id="attach-policy-visitor" data-has="1"><?php echo __('Detach Policy From Visitors', AAM_KEY); ?></button>
|
87 |
+
<?php } else { ?>
|
88 |
+
<button class="btn btn-primary btn-block" id="attach-policy-visitor" data-has="0"><?php echo __('Attach Policy To Visitors', AAM_KEY); ?></button>
|
89 |
+
<?php } ?>
|
90 |
+
<?php } ?>
|
91 |
</div>
|
92 |
</div>
|
93 |
<?php } ?>
|
94 |
<?php if (current_user_can('aam_manage_default')) { ?>
|
95 |
<div role="tabpanel" class="tab-pane<?php echo (!$active++ ? ' active' : ''); ?>" id="default">
|
96 |
<div class="visitor-message">
|
97 |
+
<?php if (AAM_Core_Request::get('aamframe') !== 'principal') { ?>
|
98 |
+
<span class="aam-bordered"><?php echo sprintf(__('Manage default access to %s for all users, roles and visitor. This includes Administrator role and yourself', AAM_KEY), '<b>' . ($object->type == 'post' ? $object->post->post_title : $object->term->name) . '</b>'); ?>.</span>
|
99 |
+
<?php } else { ?>
|
100 |
+
<span class="aam-bordered"><?php echo __('Attach current access & security policy to all users, roles and visitors. This includes Administrator role and yourself', AAM_KEY); ?>.</span>
|
101 |
+
<?php } ?>
|
102 |
<?php if (defined('AAM_PLUS_PACKAGE')) { ?>
|
103 |
+
<?php if (AAM_Core_Request::get('aamframe') !== 'principal') { ?>
|
104 |
+
<button class="btn btn-danger btn-block" id="manage-default"><i class="icon-cog"></i> <?php echo __('Manage Default Access', AAM_KEY); ?></button>
|
105 |
+
<?php } else { ?>
|
106 |
+
<?php
|
107 |
+
$default = new AAM_Core_Subject_Default();
|
108 |
+
$hasPolicy = $default->getObject('policy')->has($object->id);
|
109 |
+
?>
|
110 |
+
<?php if ($hasPolicy) { ?>
|
111 |
+
<button class="btn btn-danger btn-block" id="attach-policy-default" data-has="1"><?php echo __('Detach Policy From Everybody', AAM_KEY); ?></button>
|
112 |
+
<?php } else { ?>
|
113 |
+
<button class="btn btn-danger btn-block" id="attach-policy-default" data-has="0"><?php echo __('Attach Policy To Everybody', AAM_KEY); ?></button>
|
114 |
+
<?php } ?>
|
115 |
+
<?php } ?>
|
116 |
<?php } else { ?>
|
117 |
+
<p class="aam-notification">
|
118 |
+
<?php echo AAM_Backend_View_Helper::preparePhrase('This feature is allowed only with [AAM Plus Package] extension.', 'b'); ?>
|
119 |
+
</p>
|
120 |
<?php } ?>
|
121 |
</div>
|
122 |
</div>
|
126 |
</div>
|
127 |
</div>
|
128 |
|
129 |
+
<?php if (AAM_Core_Request::get('aamframe') !== 'principal') { ?>
|
130 |
<div class="col-sm-8" id="post-content">
|
131 |
<div class="aam-overwrite hidden" id="post-overwritten">
|
132 |
<span><i class="icon-check"></i> <?php echo __('Settings are customized', AAM_KEY); ?></span>
|
152 |
|
153 |
<?php require AAM_BASEDIR . '/Application/Backend/phtml/partial/post-advanced-settings.phtml'; ?>
|
154 |
</div>
|
155 |
+
<?php } ?>
|
156 |
</div>
|
157 |
|
158 |
+
<?php if (AAM_Core_Request::get('aamframe') !== 'principal') { ?>
|
159 |
<p style="margin: 5px; text-align: left; font-size: 0.9em;">
|
160 |
<b>Please help us</b> and submit your review <a href="https://wordpress.org/support/plugin/advanced-access-manager/reviews/" target="_blank"><i class="icon-star"></i><i class="icon-star"></i><i class="icon-star"></i><i class="icon-star"></i><i class="icon-star"></i></a>
|
161 |
</p>
|
162 |
+
<?php } ?>
|
163 |
+
|
164 |
+
<input type="hidden" id="object-id" value="<?php echo $object->id; ?>" />
|
165 |
+
|
166 |
</body>
|
167 |
</html>
|
Application/Backend/phtml/metabox/policy-metabox.phtml
CHANGED
@@ -350,19 +350,91 @@
|
|
350 |
|
351 |
/* Help users use markselection to safely style text background */
|
352 |
span.CodeMirror-selectedtext { background: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
</style>
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
<script type='text/javascript' src="<?php echo AAM_MEDIA . '/js/vendor.js'; ?>"></script>
|
358 |
|
359 |
<script type='text/javascript'>
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
</script>
|
368 |
</div>
|
350 |
|
351 |
/* Help users use markselection to safely style text background */
|
352 |
span.CodeMirror-selectedtext { background: none; }
|
353 |
+
|
354 |
+
.aam-alert-danger{
|
355 |
+
border-radius: 0;
|
356 |
+
margin: 10px 0;
|
357 |
+
color: #a94442;
|
358 |
+
background-color: #f2dede;
|
359 |
+
border-color: #ebccd1;
|
360 |
+
padding: 15px;
|
361 |
+
border: 1px solid transparent;
|
362 |
+
}
|
363 |
+
.aam-infobox {
|
364 |
+
border-left: 5px solid #257fad;
|
365 |
+
padding: 20px;
|
366 |
+
background-color: #d9edf7;
|
367 |
+
margin-bottom: 0;
|
368 |
+
}
|
369 |
</style>
|
370 |
+
|
371 |
+
<?php
|
372 |
+
if (!empty($post->post_content)) {
|
373 |
+
$decoded = json_decode(htmlspecialchars_decode($post->post_content));
|
374 |
+
|
375 |
+
if (json_last_error() !== JSON_ERROR_NONE) {
|
376 |
+
$error = AAM_Backend_View_Helper::preparePhrase(
|
377 |
+
esc_js('[' . json_last_error_msg() . ']: ' . __('Access & Security Policy is invalid and is ignored by AAM.', AAM_KEY)),
|
378 |
+
'b'
|
379 |
+
);
|
380 |
+
}
|
381 |
+
} else {
|
382 |
+
$post->post_content = <<<EOT
|
383 |
+
{
|
384 |
+
"Version": "1.0.0",
|
385 |
+
"Statement": [
|
386 |
+
{
|
387 |
+
"Effect": "deny",
|
388 |
+
"Resource": [],
|
389 |
+
"Action": []
|
390 |
+
}
|
391 |
+
]
|
392 |
+
}
|
393 |
+
EOT;
|
394 |
+
}
|
395 |
+
?>
|
396 |
+
|
397 |
+
<div class="aam-alert-danger<?php echo (empty($error) ? ' hidden' : ''); ?>" id="policy-parsing-error">
|
398 |
+
<?php echo (!empty($error) ? $error : ''); ?>
|
399 |
+
</div>
|
400 |
+
|
401 |
+
<textarea id="aam-policy-editor" name="aam-policy" class="policy-editor" rows="10"><?php echo $post->post_content; ?></textarea>
|
402 |
+
|
403 |
+
<p class="aam-infobox">
|
404 |
+
<?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('To learn more about Access & Security policy document, please check [%sAccess & Security Policy%s] page.', 'b'), '<a href="https://aamplugin.com/access-and-security-policy" target="_blank">', '</a>'); ?>
|
405 |
+
</p>
|
406 |
+
|
407 |
<script type='text/javascript' src="<?php echo AAM_MEDIA . '/js/vendor.js'; ?>"></script>
|
408 |
|
409 |
<script type='text/javascript'>
|
410 |
+
(function($){
|
411 |
+
var editor = CodeMirror.fromTextArea(
|
412 |
+
document.getElementById("aam-policy-editor"),
|
413 |
+
{
|
414 |
+
mode: "application/json",
|
415 |
+
lineNumbers: true
|
416 |
+
}
|
417 |
+
);
|
418 |
+
|
419 |
+
$(document).ready(function () {
|
420 |
+
$('form[name="post"]').bind('submit', function(event) {
|
421 |
+
var json = editor.getValue();
|
422 |
+
|
423 |
+
$('#policy-parsing-error').addClass('hidden');
|
424 |
+
|
425 |
+
try {
|
426 |
+
JSON.parse(json);
|
427 |
+
|
428 |
+
$('#aam-policy-editor').val(json);
|
429 |
+
} catch (e) {
|
430 |
+
event.preventDefault();
|
431 |
+
|
432 |
+
$('#policy-parsing-error').removeClass('hidden').html(
|
433 |
+
'<b><?php echo __('Syntax Error', AAM_KEY); ?></b>: ' + e.message.replace('JSON.parse:', '')
|
434 |
+
);
|
435 |
+
}
|
436 |
+
});
|
437 |
+
});
|
438 |
+
}(jQuery));
|
439 |
</script>
|
440 |
</div>
|
Application/Backend/phtml/metabox/policy-principal-metabox.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php if (defined('AAM_KEY')) { ?>
|
2 |
+
<iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=principal&oid=' . $post->ID . '&otype=post'); ?>" width="100%" height="450" style="border: 0; margin-top:0;" id="policy-principal"></iframe>
|
3 |
+
<?php }
|
Application/Backend/phtml/metabox/post-metabox.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<?php if (defined('AAM_KEY')) { ?>
|
2 |
-
<iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=
|
3 |
<?php }
|
1 |
<?php if (defined('AAM_KEY')) { ?>
|
2 |
+
<iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=post&oid=' . $post->ID . '&otype=post'); ?>" width="100%" height="450" style="border-bottom: 1px solid #e5e5e5; margin-top:10px;"></iframe>
|
3 |
<?php }
|
Application/Backend/phtml/metabox/term-metabox.phtml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<td>
|
5 |
<?php if (defined('AAM_PLUS_PACKAGE')) { ?>
|
6 |
<div style="padding: 0px 10px; box-sizing: border-box; background-color: #FFFFFF; width: 95%;">
|
7 |
-
<iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=
|
8 |
</div>
|
9 |
<?php } else { ?>
|
10 |
<div style="border-left: 4px solid #ffb900; background-color: #FFF1CC; padding: 10px; font-size: 1em; margin: 10px 0px;">
|
4 |
<td>
|
5 |
<?php if (defined('AAM_PLUS_PACKAGE')) { ?>
|
6 |
<div style="padding: 0px 10px; box-sizing: border-box; background-color: #FFFFFF; width: 95%;">
|
7 |
+
<iframe src="<?php echo admin_url('admin.php?page=aam&aamframe=post&oid=' . $term->term_id . '|' . $term->taxonomy . '&otype=term'); ?>" width="100%" height="450" style="border-bottom: 1px solid #e5e5e5; margin-top:10px;"></iframe>
|
8 |
</div>
|
9 |
<?php } else { ?>
|
10 |
<div style="border-left: 4px solid #ffb900; background-color: #FFF1CC; padding: 10px; font-size: 1em; margin: 10px 0px;">
|
Application/Core/Object/Policy.php
CHANGED
@@ -45,26 +45,35 @@ class AAM_Core_Object_Policy extends AAM_Core_Object {
|
|
45 |
$this->setOverwritten(true);
|
46 |
}
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
*
|
53 |
*/
|
54 |
public function load() {
|
55 |
-
|
56 |
|
57 |
if (is_null($resources)) {
|
58 |
-
$policies = AAM_Core_API::getOption('aam-policy-list', array(), 'site');
|
59 |
$statements = array();
|
60 |
-
|
61 |
// Step #1. Extract all statements
|
62 |
foreach($this->getOption() as $id => $effect) {
|
63 |
-
if (
|
64 |
-
$policy =
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
}
|
70 |
|
@@ -73,8 +82,8 @@ class AAM_Core_Object_Policy extends AAM_Core_Object {
|
|
73 |
|
74 |
foreach($statements as $statement) {
|
75 |
if (isset($statement['Resource'])) {
|
76 |
-
$actions = (array)(
|
77 |
-
|
78 |
foreach((array) $statement['Resource'] as $resource) {
|
79 |
foreach($actions as $action) {
|
80 |
$id = strtolower(
|
@@ -142,7 +151,7 @@ class AAM_Core_Object_Policy extends AAM_Core_Object {
|
|
142 |
unset($right['Resource']);
|
143 |
}
|
144 |
|
145 |
-
$merged =
|
146 |
|
147 |
if (!isset($merged['Effect'])) {
|
148 |
$merged['Effect'] = 'deny';
|
@@ -158,9 +167,9 @@ class AAM_Core_Object_Policy extends AAM_Core_Object {
|
|
158 |
*
|
159 |
* @access public
|
160 |
*/
|
161 |
-
public function save($
|
162 |
-
$option
|
163 |
-
$option[$
|
164 |
|
165 |
$this->setOption($option);
|
166 |
|
45 |
$this->setOverwritten(true);
|
46 |
}
|
47 |
|
48 |
+
foreach($option as $key => $value) {
|
49 |
+
$parent[$key] = $value; //override
|
50 |
+
}
|
51 |
+
|
52 |
+
$this->setOption($parent);
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
*
|
57 |
*/
|
58 |
public function load() {
|
59 |
+
$resources = AAM::api()->getUser()->getObject('cache')->get('policy', 0, null);
|
60 |
|
61 |
if (is_null($resources)) {
|
|
|
62 |
$statements = array();
|
63 |
+
|
64 |
// Step #1. Extract all statements
|
65 |
foreach($this->getOption() as $id => $effect) {
|
66 |
+
if ($effect) {
|
67 |
+
$policy = get_post($id);
|
68 |
+
|
69 |
+
if (is_a($policy, 'WP_Post')) {
|
70 |
+
$obj = json_decode($policy->post_content, true);
|
71 |
+
if (json_last_error() === JSON_ERROR_NONE) {
|
72 |
+
$statements = array_merge(
|
73 |
+
$statements, $this->extractStatements($obj)
|
74 |
+
);
|
75 |
+
}
|
76 |
+
}
|
77 |
}
|
78 |
}
|
79 |
|
82 |
|
83 |
foreach($statements as $statement) {
|
84 |
if (isset($statement['Resource'])) {
|
85 |
+
$actions = (array)(!empty($statement['Action']) ? $statement['Action'] : '');
|
86 |
+
|
87 |
foreach((array) $statement['Resource'] as $resource) {
|
88 |
foreach($actions as $action) {
|
89 |
$id = strtolower(
|
151 |
unset($right['Resource']);
|
152 |
}
|
153 |
|
154 |
+
$merged = array_merge($left, $right);
|
155 |
|
156 |
if (!isset($merged['Effect'])) {
|
157 |
$merged['Effect'] = 'deny';
|
167 |
*
|
168 |
* @access public
|
169 |
*/
|
170 |
+
public function save($id, $effect) {
|
171 |
+
$option = $this->getOption();
|
172 |
+
$option[$id] = intval($effect);
|
173 |
|
174 |
$this->setOption($option);
|
175 |
|
Application/Extension/Repository.php
CHANGED
@@ -54,6 +54,15 @@ class AAM_Extension_Repository {
|
|
54 |
*/
|
55 |
private static $_instance = null;
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
/**
|
58 |
* Extension list
|
59 |
*
|
@@ -123,6 +132,8 @@ class AAM_Extension_Repository {
|
|
123 |
if (file_exists($config)) {
|
124 |
$conf = require $config;
|
125 |
|
|
|
|
|
126 |
// determin if extension needs to be loaded based on the status
|
127 |
$status = empty($cache[$conf['id']]['status']) || ($cache[$conf['id']]['status'] !== self::STATUS_INACTIVE);
|
128 |
|
@@ -260,7 +271,7 @@ class AAM_Extension_Repository {
|
|
260 |
* @access public
|
261 |
*/
|
262 |
public function getVersion($id) {
|
263 |
-
return (
|
264 |
}
|
265 |
|
266 |
/**
|
@@ -310,10 +321,10 @@ class AAM_Extension_Repository {
|
|
310 |
if (is_null($status)) {
|
311 |
$status = AAM_Extension_Repository::STATUS_DOWNLOAD;
|
312 |
|
313 |
-
if (
|
314 |
$status = AAM_Extension_Repository::STATUS_INSTALLED;
|
315 |
|
316 |
-
if ($this->isOutdatedVersion($item, $retrieved,
|
317 |
$status = AAM_Extension_Repository::STATUS_UPDATE;
|
318 |
AAM_Core_Console::add(
|
319 |
AAM_Backend_View_Helper::preparePhrase(sprintf(
|
@@ -324,9 +335,9 @@ class AAM_Extension_Repository {
|
|
324 |
}
|
325 |
}
|
326 |
} elseif ($status === AAM_Extension_Repository::STATUS_INSTALLED) {
|
327 |
-
if (!
|
328 |
$status = AAM_Extension_Repository::STATUS_DOWNLOAD;
|
329 |
-
} elseif ($this->isOutdatedVersion($item, $retrieved,
|
330 |
$status = AAM_Extension_Repository::STATUS_UPDATE;
|
331 |
}
|
332 |
}
|
54 |
*/
|
55 |
private static $_instance = null;
|
56 |
|
57 |
+
/**
|
58 |
+
* List of detected extensions during the boot
|
59 |
+
*
|
60 |
+
* @var array
|
61 |
+
*
|
62 |
+
* @access protected
|
63 |
+
*/
|
64 |
+
protected $depectedExtensions = array();
|
65 |
+
|
66 |
/**
|
67 |
* Extension list
|
68 |
*
|
132 |
if (file_exists($config)) {
|
133 |
$conf = require $config;
|
134 |
|
135 |
+
$this->depectedExtensions[$conf['id']] = $conf['version'];
|
136 |
+
|
137 |
// determin if extension needs to be loaded based on the status
|
138 |
$status = empty($cache[$conf['id']]['status']) || ($cache[$conf['id']]['status'] !== self::STATUS_INACTIVE);
|
139 |
|
271 |
* @access public
|
272 |
*/
|
273 |
public function getVersion($id) {
|
274 |
+
return (isset($this->depectedExtensions[$id]) ? $this->depectedExtensions[$id] : null);
|
275 |
}
|
276 |
|
277 |
/**
|
321 |
if (is_null($status)) {
|
322 |
$status = AAM_Extension_Repository::STATUS_DOWNLOAD;
|
323 |
|
324 |
+
if (isset($this->depectedExtensions[$id])) {
|
325 |
$status = AAM_Extension_Repository::STATUS_INSTALLED;
|
326 |
|
327 |
+
if ($this->isOutdatedVersion($item, $retrieved, $this->depectedExtensions[$id])) {
|
328 |
$status = AAM_Extension_Repository::STATUS_UPDATE;
|
329 |
AAM_Core_Console::add(
|
330 |
AAM_Backend_View_Helper::preparePhrase(sprintf(
|
335 |
}
|
336 |
}
|
337 |
} elseif ($status === AAM_Extension_Repository::STATUS_INSTALLED) {
|
338 |
+
if (!isset($this->depectedExtensions[$id])) {
|
339 |
$status = AAM_Extension_Repository::STATUS_DOWNLOAD;
|
340 |
+
} elseif ($this->isOutdatedVersion($item, $retrieved, $this->depectedExtensions[$id])) {
|
341 |
$status = AAM_Extension_Repository::STATUS_UPDATE;
|
342 |
}
|
343 |
}
|
Application/Shared/Manager.php
CHANGED
@@ -96,7 +96,7 @@ class AAM_Shared_Manager {
|
|
96 |
|
97 |
// Security. Make sure that we escaping all translation strings
|
98 |
add_filter(
|
99 |
-
|
100 |
);
|
101 |
|
102 |
// Role Manager. Tracking user role changes and if there is expiration
|
@@ -120,7 +120,7 @@ class AAM_Shared_Manager {
|
|
120 |
'label' => __('Access Policy', AAM_KEY),
|
121 |
'labels' => array(
|
122 |
'name' => __('Access Policies', AAM_KEY),
|
123 |
-
'edit_item' => __('Edit
|
124 |
'add_new_item' => __('Add New Policy', AAM_KEY),
|
125 |
'new_item' => __('New Policy', AAM_KEY)
|
126 |
),
|
@@ -131,36 +131,20 @@ class AAM_Shared_Manager {
|
|
131 |
'exclude_from_search' => true,
|
132 |
'publicly_queryable' => false,
|
133 |
'hierarchical' => false,
|
134 |
-
'supports' => array('title', 'revisions'),
|
135 |
'delete_with_user' => false,
|
136 |
'capabilities' => array(
|
137 |
-
'edit_post'
|
138 |
-
'read_post'
|
139 |
-
'delete_post'
|
140 |
-
'
|
141 |
-
'
|
142 |
-
'
|
143 |
-
|
144 |
-
|
145 |
));
|
146 |
}
|
147 |
|
148 |
-
public function registerPolicyMetabox() {
|
149 |
-
add_meta_box(
|
150 |
-
'aam-policy',
|
151 |
-
__('Policy Document', AAM_KEY),
|
152 |
-
array($this, 'renderPolicyMetabox'),
|
153 |
-
null,
|
154 |
-
'normal'
|
155 |
-
);
|
156 |
-
}
|
157 |
-
|
158 |
-
public function renderPolicyMetabox() {
|
159 |
-
global $post;
|
160 |
-
|
161 |
-
require dirname(__DIR__) . '/Backend/phtml/metabox/policy-metabox.phtml';
|
162 |
-
}
|
163 |
-
|
164 |
/**
|
165 |
*
|
166 |
*/
|
@@ -456,7 +440,7 @@ class AAM_Shared_Manager {
|
|
456 |
|
457 |
// Apply policy first
|
458 |
if (AAM::api()->isAllowed("Capability:{$capability}") === true) {
|
459 |
-
$caps
|
460 |
}
|
461 |
|
462 |
switch($capability) {
|
96 |
|
97 |
// Security. Make sure that we escaping all translation strings
|
98 |
add_filter(
|
99 |
+
'gettext', array(self::$_instance, 'escapeTranslation'), 999, 3
|
100 |
);
|
101 |
|
102 |
// Role Manager. Tracking user role changes and if there is expiration
|
120 |
'label' => __('Access Policy', AAM_KEY),
|
121 |
'labels' => array(
|
122 |
'name' => __('Access Policies', AAM_KEY),
|
123 |
+
'edit_item' => __('Edit Policy', AAM_KEY),
|
124 |
'add_new_item' => __('Add New Policy', AAM_KEY),
|
125 |
'new_item' => __('New Policy', AAM_KEY)
|
126 |
),
|
131 |
'exclude_from_search' => true,
|
132 |
'publicly_queryable' => false,
|
133 |
'hierarchical' => false,
|
134 |
+
'supports' => array('title', 'excerpt', 'revisions'),
|
135 |
'delete_with_user' => false,
|
136 |
'capabilities' => array(
|
137 |
+
'edit_post' => 'aam_manage_policy',
|
138 |
+
'read_post' => 'aam_manage_policy',
|
139 |
+
'delete_post' => 'aam_manage_policy',
|
140 |
+
'delete_posts' => 'aam_manage_policy',
|
141 |
+
'edit_posts' => 'aam_manage_policy',
|
142 |
+
'edit_others_posts' => 'aam_manage_policy',
|
143 |
+
'publish_posts' => 'aam_manage_policy',
|
144 |
+
)
|
145 |
));
|
146 |
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
/**
|
149 |
*
|
150 |
*/
|
440 |
|
441 |
// Apply policy first
|
442 |
if (AAM::api()->isAllowed("Capability:{$capability}") === true) {
|
443 |
+
$caps = $this->updateCapabilities($caps, $meta, true);
|
444 |
}
|
445 |
|
446 |
switch($capability) {
|
aam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
Plugin Name: Advanced Access Manager
|
5 |
Description: All you need to manage access to your WordPress website
|
6 |
-
Version: 5.
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://vasyltech.com
|
9 |
|
3 |
/**
|
4 |
Plugin Name: Advanced Access Manager
|
5 |
Description: All you need to manage access to your WordPress website
|
6 |
+
Version: 5.7
|
7 |
Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
Author URI: https://vasyltech.com
|
9 |
|
media/css/datatables.min.css
CHANGED
@@ -113,9 +113,18 @@ div.dataTables_scrollFoot table {
|
|
113 |
border-top: none;
|
114 |
margin-top: 0 !important;
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
@media screen and (max-width: 767px) {
|
117 |
div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate {
|
118 |
-
text-align:
|
119 |
}
|
120 |
}
|
121 |
table.dataTable.table-condensed>thead>tr>th {
|
113 |
border-top: none;
|
114 |
margin-top: 0 !important;
|
115 |
}
|
116 |
+
.table > tbody > tr > td small,
|
117 |
+
.table > tbody > tr > th small,
|
118 |
+
.table > tfoot > tr > td small,
|
119 |
+
.table > tfoot > tr > th small,
|
120 |
+
.table > thead > tr > td small,
|
121 |
+
.table > thead > tr > th small{
|
122 |
+
line-height: 1.2em;
|
123 |
+
display: block;
|
124 |
+
}
|
125 |
@media screen and (max-width: 767px) {
|
126 |
div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate {
|
127 |
+
text-align: right;
|
128 |
}
|
129 |
}
|
130 |
table.dataTable.table-condensed>thead>tr>th {
|
media/js/{aam.js → aam-5.7.js}
RENAMED
@@ -54,6 +54,63 @@
|
|
54 |
});
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
/**
|
58 |
*
|
59 |
* @returns {undefined}
|
@@ -151,7 +208,11 @@
|
|
151 |
data: {
|
152 |
action: 'aam',
|
153 |
sub_action: 'Subject_Role.getTable',
|
154 |
-
_ajax_nonce: getLocal().nonce
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
},
|
157 |
columnDefs: [
|
@@ -165,7 +226,7 @@
|
|
165 |
infoFiltered: ''
|
166 |
},
|
167 |
initComplete: function () {
|
168 |
-
if (
|
169 |
var create = $('<a/>', {
|
170 |
'href': '#',
|
171 |
'class': 'btn btn-primary'
|
@@ -225,7 +286,7 @@
|
|
225 |
$('i.icon-cog', container).attr(
|
226 |
'class', 'aam-row-action icon-cog text-muted'
|
227 |
);
|
228 |
-
if (
|
229 |
$('i.icon-cog', container).attr(
|
230 |
'class', 'aam-row-action icon-spin4 animate-spin'
|
231 |
);
|
@@ -251,7 +312,7 @@
|
|
251 |
break;
|
252 |
|
253 |
case 'edit':
|
254 |
-
if (
|
255 |
$(container).append($('<i/>', {
|
256 |
'class': 'aam-row-action icon-pencil text-warning'
|
257 |
}).bind('click', function () {
|
@@ -274,7 +335,7 @@
|
|
274 |
break;
|
275 |
|
276 |
case 'no-edit':
|
277 |
-
if (
|
278 |
$(container).append($('<i/>', {
|
279 |
'class': 'aam-row-action icon-pencil text-muted'
|
280 |
}));
|
@@ -282,7 +343,7 @@
|
|
282 |
break;
|
283 |
|
284 |
case 'clone':
|
285 |
-
if (
|
286 |
$(container).append($('<i/>', {
|
287 |
'class': 'aam-row-action icon-clone text-success'
|
288 |
}).bind('click', function () {
|
@@ -298,7 +359,7 @@
|
|
298 |
break;
|
299 |
|
300 |
case 'no-clone':
|
301 |
-
if (
|
302 |
$(container).append($('<i/>', {
|
303 |
'class': 'aam-row-action icon-clone text-muted'
|
304 |
}));
|
@@ -306,7 +367,7 @@
|
|
306 |
break;
|
307 |
|
308 |
case 'delete':
|
309 |
-
if (
|
310 |
$(container).append($('<i/>', {
|
311 |
'class': 'aam-row-action icon-trash-empty text-danger'
|
312 |
}).bind('click', {role: data}, function (event) {
|
@@ -327,15 +388,51 @@
|
|
327 |
break;
|
328 |
|
329 |
case 'no-delete':
|
330 |
-
if (
|
331 |
$(container).append($('<i/>', {
|
332 |
'class': 'aam-row-action icon-trash-empty text-muted'
|
333 |
}));
|
334 |
}
|
335 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
default:
|
338 |
-
if (
|
339 |
getAAM().triggerHook('role-action', {
|
340 |
container: container,
|
341 |
action : action,
|
@@ -664,6 +761,10 @@
|
|
664 |
params.sub_action = 'Subject_User.getTable';
|
665 |
params._ajax_nonce = getLocal().nonce;
|
666 |
params.role = $('#user-list-filter').val();
|
|
|
|
|
|
|
|
|
667 |
|
668 |
return params;
|
669 |
}
|
@@ -679,7 +780,7 @@
|
|
679 |
infoFiltered: ''
|
680 |
},
|
681 |
initComplete: function () {
|
682 |
-
if (
|
683 |
var create = $('<a/>', {
|
684 |
'href': '#',
|
685 |
'class': 'btn btn-primary'
|
@@ -759,7 +860,7 @@
|
|
759 |
);
|
760 |
$('i.icon-cog', container).attr('class', 'aam-row-action icon-cog text-muted');
|
761 |
|
762 |
-
if (
|
763 |
$('i.icon-cog', container).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
764 |
getAAM().fetchContent('main');
|
765 |
$('i.icon-spin4', container).attr('class', 'aam-row-action icon-cog text-muted');
|
@@ -781,7 +882,7 @@
|
|
781 |
break;
|
782 |
|
783 |
case 'ttl':
|
784 |
-
if (
|
785 |
$(container).append($('<i/>', {
|
786 |
'class': 'aam-row-action icon-clock text-' + (data[5] ? 'danger' : 'warning')
|
787 |
}).bind('click', function () {
|
@@ -816,7 +917,7 @@
|
|
816 |
break;
|
817 |
|
818 |
case 'no-ttl':
|
819 |
-
if (
|
820 |
$(container).append($('<i/>', {
|
821 |
'class': 'aam-row-action icon-clock text-muted'
|
822 |
}));
|
@@ -824,13 +925,13 @@
|
|
824 |
break;
|
825 |
|
826 |
case 'edit':
|
827 |
-
if (
|
828 |
$(container).append($('<i/>', {
|
829 |
'class': 'aam-row-action icon-pencil text-info'
|
830 |
}).bind('click', function () {
|
831 |
window.open(
|
832 |
-
|
833 |
-
|
834 |
}).attr({
|
835 |
'data-toggle': "tooltip",
|
836 |
'title': getAAM().__('Edit User')
|
@@ -839,7 +940,7 @@
|
|
839 |
break;
|
840 |
|
841 |
case 'no-edit':
|
842 |
-
if (
|
843 |
$(container).append($('<i/>', {
|
844 |
'class': 'aam-row-action icon-pencil text-muted'
|
845 |
}));
|
@@ -847,7 +948,7 @@
|
|
847 |
break;
|
848 |
|
849 |
case 'lock':
|
850 |
-
if (
|
851 |
$(container).append($('<i/>', {
|
852 |
'class': 'aam-row-action icon-lock-open-alt text-warning'
|
853 |
}).bind('click', function () {
|
@@ -860,7 +961,7 @@
|
|
860 |
break;
|
861 |
|
862 |
case 'unlock':
|
863 |
-
if (
|
864 |
$(container).append($('<i/>', {
|
865 |
'class': 'aam-row-action icon-lock text-danger'
|
866 |
}).bind('click', function () {
|
@@ -873,7 +974,7 @@
|
|
873 |
break;
|
874 |
|
875 |
case 'switch':
|
876 |
-
if (
|
877 |
$(container).append($('<i/>', {
|
878 |
'class': 'aam-row-action icon-exchange text-success'
|
879 |
}).bind('click', function () {
|
@@ -886,12 +987,48 @@
|
|
886 |
break;
|
887 |
|
888 |
case 'no-switch':
|
889 |
-
if (
|
890 |
$(container).append($('<i/>', {
|
891 |
'class': 'aam-row-action icon-exchange text-muted'
|
892 |
}));
|
893 |
}
|
894 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
|
896 |
default:
|
897 |
break;
|
@@ -1055,7 +1192,7 @@
|
|
1055 |
getAAM().setSubject('visitor', null, getAAM().__('Anonymous'), 0);
|
1056 |
$('i.icon-cog', $(this)).attr('class', 'icon-spin4 animate-spin');
|
1057 |
|
1058 |
-
if (
|
1059 |
getAAM().fetchContent('main');
|
1060 |
$('i.icon-spin4', $(this)).attr('class', 'icon-cog');
|
1061 |
} else {
|
@@ -1072,6 +1209,42 @@
|
|
1072 |
});
|
1073 |
}
|
1074 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1075 |
});
|
1076 |
|
1077 |
})(jQuery);
|
@@ -1091,7 +1264,7 @@
|
|
1091 |
|
1092 |
getAAM().setSubject('default', null, getAAM().__('All Users, Roles and Visitor'), 0);
|
1093 |
$('i.icon-cog', $(this)).attr('class', 'icon-spin4 animate-spin');
|
1094 |
-
if (
|
1095 |
getAAM().fetchContent('main');
|
1096 |
$('i.icon-spin4', $(this)).attr('class', 'icon-cog');
|
1097 |
} else {
|
@@ -1108,73 +1281,54 @@
|
|
1108 |
});
|
1109 |
}
|
1110 |
});
|
1111 |
-
});
|
1112 |
-
|
1113 |
-
})(jQuery);
|
1114 |
-
|
1115 |
-
/**
|
1116 |
-
* Policy Interface
|
1117 |
-
*
|
1118 |
-
* @param {jQuery} $
|
1119 |
-
*
|
1120 |
-
* @returns {void}
|
1121 |
-
*/
|
1122 |
-
(function ($) {
|
1123 |
-
var editor = null;
|
1124 |
-
|
1125 |
-
/**
|
1126 |
-
*
|
1127 |
-
* @param {type} id
|
1128 |
-
* @param {type} effect
|
1129 |
-
* @returns {undefined}
|
1130 |
-
*/
|
1131 |
-
function assign(id, btn) {
|
1132 |
-
var effect = $(btn).hasClass('icon-check-empty') ? 1 : 0;
|
1133 |
-
|
1134 |
-
//show indicator
|
1135 |
-
$(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
1136 |
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
id: id,
|
1148 |
-
effect: effect
|
1149 |
},
|
1150 |
-
|
|
|
|
|
1151 |
if (response.status === 'success') {
|
1152 |
if (effect) {
|
1153 |
-
|
1154 |
} else {
|
1155 |
-
|
1156 |
}
|
|
|
1157 |
} else {
|
|
|
|
|
|
|
|
|
1158 |
if (effect) {
|
1159 |
-
getAAM().
|
1160 |
-
'danger',
|
1161 |
-
getAAM().__('Failed to apply policy changes')
|
1162 |
-
);
|
1163 |
-
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
1164 |
} else {
|
1165 |
-
|
1166 |
}
|
1167 |
}
|
1168 |
-
},
|
1169 |
-
error: function () {
|
1170 |
-
getAAM().notification(
|
1171 |
-
'danger', getAAM().__('Application Error')
|
1172 |
-
);
|
1173 |
}
|
1174 |
-
|
1175 |
});
|
1176 |
-
}
|
1177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1178 |
function initialize() {
|
1179 |
var container = '#policy-content';
|
1180 |
|
@@ -1184,104 +1338,6 @@
|
|
1184 |
getAAM().reset('policy', $(this));
|
1185 |
});
|
1186 |
|
1187 |
-
editor = CodeMirror.fromTextArea(
|
1188 |
-
document.getElementById("policy-editor"),
|
1189 |
-
{
|
1190 |
-
mode: "application/json",
|
1191 |
-
lineNumbers: true
|
1192 |
-
}
|
1193 |
-
);
|
1194 |
-
|
1195 |
-
$('#policy-save-btn').bind('click', function() {
|
1196 |
-
var json = editor.getValue();
|
1197 |
-
|
1198 |
-
$('#policy-parsing-error').addClass('hidden');
|
1199 |
-
try {
|
1200 |
-
JSON.parse(json);
|
1201 |
-
|
1202 |
-
getAAM().queueRequest(function() {
|
1203 |
-
$.ajax(getLocal().ajaxurl, {
|
1204 |
-
type: 'POST',
|
1205 |
-
dataType: 'json',
|
1206 |
-
data: {
|
1207 |
-
action: 'aam',
|
1208 |
-
sub_action: 'Main_Policy.savePolicy',
|
1209 |
-
subject: getAAM().getSubject().type,
|
1210 |
-
subjectId: getAAM().getSubject().id,
|
1211 |
-
_ajax_nonce: getLocal().nonce,
|
1212 |
-
policy: json,
|
1213 |
-
id: $('#policy-save-btn').attr('data-id')
|
1214 |
-
},
|
1215 |
-
beforeSend: function () {
|
1216 |
-
$('#policy-save-btn').text(getAAM().__('Saving...')).attr('disabled', true);
|
1217 |
-
},
|
1218 |
-
success: function(response) {
|
1219 |
-
if (response.status === 'success') {
|
1220 |
-
$('#policy-list').DataTable().ajax.reload();
|
1221 |
-
$('#policy-model').modal('hide');
|
1222 |
-
} else {
|
1223 |
-
aam.notification(
|
1224 |
-
'danger', aam.__('Failed to save policy')
|
1225 |
-
);
|
1226 |
-
}
|
1227 |
-
},
|
1228 |
-
error: function () {
|
1229 |
-
getAAM().notification(
|
1230 |
-
'danger', getAAM().__('Application Error')
|
1231 |
-
);
|
1232 |
-
},
|
1233 |
-
complete: function () {
|
1234 |
-
$('#policy-save-btn').text(getAAM().__('Save')).attr('disabled', false);
|
1235 |
-
}
|
1236 |
-
});
|
1237 |
-
});
|
1238 |
-
} catch (e) {
|
1239 |
-
$('#policy-parsing-error').removeClass('hidden').html(
|
1240 |
-
'<b>' + getAAM().__('Syntax Error') + '</b>: ' + e.message.replace('JSON.parse:', '')
|
1241 |
-
);
|
1242 |
-
}
|
1243 |
-
});
|
1244 |
-
|
1245 |
-
$('#policy-delete-btn').bind('click', function (event) {
|
1246 |
-
event.preventDefault();
|
1247 |
-
|
1248 |
-
$.ajax(aamLocal.ajaxurl, {
|
1249 |
-
type: 'POST',
|
1250 |
-
dataType: 'json',
|
1251 |
-
data: {
|
1252 |
-
action: 'aam',
|
1253 |
-
sub_action: 'Main_Policy.deletePolicy',
|
1254 |
-
_ajax_nonce: aamLocal.nonce,
|
1255 |
-
subject: getAAM().getSubject().type,
|
1256 |
-
subjectId: getAAM().getSubject().id,
|
1257 |
-
id: $('#policy-delete-btn').data('id')
|
1258 |
-
},
|
1259 |
-
beforeSend: function () {
|
1260 |
-
$('#policy-delete-btn').text(aam.__('Deleting...')).attr('disabled', true);
|
1261 |
-
},
|
1262 |
-
success: function (response) {
|
1263 |
-
if (response.status === 'success') {
|
1264 |
-
$('#policy-list').DataTable().ajax.reload();
|
1265 |
-
} else {
|
1266 |
-
getAAM().notification(
|
1267 |
-
'danger',
|
1268 |
-
getAAM().__('Failed to delete policy')
|
1269 |
-
);
|
1270 |
-
}
|
1271 |
-
},
|
1272 |
-
error: function () {
|
1273 |
-
getAAM().notification(
|
1274 |
-
'danger',
|
1275 |
-
getAAM().__('Application error')
|
1276 |
-
);
|
1277 |
-
},
|
1278 |
-
complete: function () {
|
1279 |
-
$('#policy-delete-model').modal('hide');
|
1280 |
-
$('#policy-delete-btn').text(getAAM().__('Delete')).attr('disabled', false);
|
1281 |
-
}
|
1282 |
-
});
|
1283 |
-
});
|
1284 |
-
|
1285 |
$('#policy-list').DataTable({
|
1286 |
autoWidth: false,
|
1287 |
ordering: false,
|
@@ -1291,13 +1347,13 @@
|
|
1291 |
stateSave: true,
|
1292 |
serverSide: false,
|
1293 |
ajax: {
|
1294 |
-
url:
|
1295 |
type: 'POST',
|
1296 |
dataType: 'json',
|
1297 |
data: {
|
1298 |
action: 'aam',
|
1299 |
sub_action: 'Main_Policy.getTable',
|
1300 |
-
_ajax_nonce:
|
1301 |
subject: getAAM().getSubject().type,
|
1302 |
subjectId: getAAM().getSubject().id
|
1303 |
}
|
@@ -1309,28 +1365,10 @@
|
|
1309 |
infoFiltered: ''
|
1310 |
},
|
1311 |
columnDefs: [
|
1312 |
-
{visible: false, targets: [0,
|
1313 |
],
|
1314 |
-
initComplete: function () {
|
1315 |
-
var create = $('<a/>', {
|
1316 |
-
'href': '#',
|
1317 |
-
'class': 'btn btn-success'
|
1318 |
-
}).html('<i class="icon-plus"></i> ' + getAAM().__('Create'))
|
1319 |
-
.bind('click', function () {
|
1320 |
-
$('#policy-parsing-error').addClass('hidden');
|
1321 |
-
$('#policy-save-btn').removeAttr('data-id');
|
1322 |
-
|
1323 |
-
$('#policy-model').modal('show');
|
1324 |
-
setTimeout(function() {
|
1325 |
-
editor.setValue('');
|
1326 |
-
editor.focus();
|
1327 |
-
}, 500);
|
1328 |
-
});
|
1329 |
-
|
1330 |
-
$('.dataTables_filter', '#policy-list_wrapper').append(create);
|
1331 |
-
},
|
1332 |
createdRow: function (row, data) {
|
1333 |
-
var actions = data[
|
1334 |
|
1335 |
var container = $('<div/>', {'class': 'aam-row-actions'});
|
1336 |
$.each(actions, function (i, action) {
|
@@ -1339,7 +1377,10 @@
|
|
1339 |
$(container).append($('<i/>', {
|
1340 |
'class': 'aam-row-action text-muted icon-check-empty'
|
1341 |
}).bind('click', function () {
|
1342 |
-
|
|
|
|
|
|
|
1343 |
}).attr({
|
1344 |
'data-toggle': "tooltip",
|
1345 |
'title': getAAM().__('Apply Policy')
|
@@ -1350,7 +1391,10 @@
|
|
1350 |
$(container).append($('<i/>', {
|
1351 |
'class': 'aam-row-action text-success icon-check'
|
1352 |
}).bind('click', function () {
|
1353 |
-
|
|
|
|
|
|
|
1354 |
}).attr({
|
1355 |
'data-toggle': "tooltip",
|
1356 |
'title': getAAM().__('Revoke Policy')
|
@@ -1361,30 +1405,13 @@
|
|
1361 |
$(container).append($('<i/>', {
|
1362 |
'class': 'aam-row-action icon-pencil text-warning'
|
1363 |
}).bind('click', function () {
|
1364 |
-
|
1365 |
-
$('#policy-model').modal('show');
|
1366 |
-
setTimeout(function() {
|
1367 |
-
editor.setValue(data[2]);
|
1368 |
-
editor.focus();
|
1369 |
-
}, 500);
|
1370 |
}).attr({
|
1371 |
'data-toggle': "tooltip",
|
1372 |
'title': getAAM().__('Edit Policy')
|
1373 |
}));
|
1374 |
break;
|
1375 |
|
1376 |
-
case 'delete':
|
1377 |
-
$(container).append($('<i/>', {
|
1378 |
-
'class': 'aam-row-action icon-trash-empty text-danger'
|
1379 |
-
}).bind('click', function () {
|
1380 |
-
$('#policy-delete-btn').attr('data-id', data[0]);
|
1381 |
-
$('#policy-delete-model').modal('show');
|
1382 |
-
}).attr({
|
1383 |
-
'data-toggle': "tooltip",
|
1384 |
-
'title': getAAM().__('Delete Policy')
|
1385 |
-
}));
|
1386 |
-
break;
|
1387 |
-
|
1388 |
default:
|
1389 |
break;
|
1390 |
}
|
@@ -3025,7 +3052,6 @@
|
|
3025 |
* @param {type} type
|
3026 |
* @param {type} route
|
3027 |
* @param {type} method
|
3028 |
-
* @param {type} value
|
3029 |
* @param {type} btn
|
3030 |
* @returns {undefined}
|
3031 |
*/
|
@@ -3194,7 +3220,7 @@
|
|
3194 |
|
3195 |
//reset button
|
3196 |
$('#uri-reset').bind('click', function () {
|
3197 |
-
|
3198 |
});
|
3199 |
|
3200 |
$('#uri-save-btn').bind('click', function(event) {
|
@@ -3205,38 +3231,40 @@
|
|
3205 |
var val = $('#uri-access-deny-' + type + '-value').val();
|
3206 |
|
3207 |
if (uri && type) {
|
3208 |
-
$.ajax(
|
3209 |
type: 'POST',
|
3210 |
dataType: 'json',
|
3211 |
data: {
|
3212 |
action: 'aam',
|
3213 |
sub_action: 'Main_Uri.save',
|
3214 |
-
_ajax_nonce:
|
3215 |
-
subject:
|
3216 |
-
subjectId:
|
3217 |
uri: uri,
|
3218 |
type: type,
|
3219 |
value: val,
|
3220 |
id: $('#uri-save-btn').attr('data-id')
|
3221 |
},
|
3222 |
beforeSend: function () {
|
3223 |
-
$('#uri-save-btn').text(
|
3224 |
},
|
3225 |
success: function (response) {
|
3226 |
if (response.status === 'success') {
|
3227 |
$('#uri-list').DataTable().ajax.reload();
|
3228 |
} else {
|
3229 |
-
|
3230 |
-
'danger',
|
3231 |
);
|
3232 |
}
|
3233 |
},
|
3234 |
error: function () {
|
3235 |
-
|
|
|
|
|
3236 |
},
|
3237 |
complete: function () {
|
3238 |
$('#uri-model').modal('hide');
|
3239 |
-
$('#uri-save-btn').text(
|
3240 |
}
|
3241 |
});
|
3242 |
}
|
@@ -3245,33 +3273,33 @@
|
|
3245 |
$('#uri-delete-btn').bind('click', function (event) {
|
3246 |
event.preventDefault();
|
3247 |
|
3248 |
-
$.ajax(
|
3249 |
type: 'POST',
|
3250 |
dataType: 'json',
|
3251 |
data: {
|
3252 |
action: 'aam',
|
3253 |
sub_action: 'Main_Uri.delete',
|
3254 |
-
_ajax_nonce:
|
3255 |
-
subject:
|
3256 |
-
subjectId:
|
3257 |
id: $('#uri-delete-btn').data('id')
|
3258 |
},
|
3259 |
beforeSend: function () {
|
3260 |
-
$('#uri-delete-btn').text(
|
3261 |
},
|
3262 |
success: function (response) {
|
3263 |
if (response.status === 'success') {
|
3264 |
$('#uri-list').DataTable().ajax.reload();
|
3265 |
} else {
|
3266 |
-
|
3267 |
}
|
3268 |
},
|
3269 |
error: function () {
|
3270 |
-
|
3271 |
},
|
3272 |
complete: function () {
|
3273 |
$('#uri-delete-model').modal('hide');
|
3274 |
-
$('#uri-delete-btn').text(
|
3275 |
}
|
3276 |
});
|
3277 |
});
|
@@ -3285,21 +3313,21 @@
|
|
3285 |
stateSave: true,
|
3286 |
serverSide: false,
|
3287 |
ajax: {
|
3288 |
-
url:
|
3289 |
type: 'POST',
|
3290 |
dataType: 'json',
|
3291 |
data: {
|
3292 |
action: 'aam',
|
3293 |
sub_action: 'Main_Uri.getTable',
|
3294 |
-
_ajax_nonce:
|
3295 |
-
subject:
|
3296 |
-
subjectId:
|
3297 |
}
|
3298 |
},
|
3299 |
language: {
|
3300 |
search: '_INPUT_',
|
3301 |
-
searchPlaceholder:
|
3302 |
-
info:
|
3303 |
infoFiltered: ''
|
3304 |
},
|
3305 |
columnDefs: [
|
@@ -3309,7 +3337,7 @@
|
|
3309 |
var create = $('<a/>', {
|
3310 |
'href': '#',
|
3311 |
'class': 'btn btn-primary'
|
3312 |
-
}).html('<i class="icon-plus"></i> ' +
|
3313 |
.bind('click', function () {
|
3314 |
$('.form-clearable', '#uri-model').val('');
|
3315 |
$('.aam-uri-access-action').hide();
|
@@ -3339,7 +3367,7 @@
|
|
3339 |
$('#uri-model').modal('show');
|
3340 |
}).attr({
|
3341 |
'data-toggle': "tooltip",
|
3342 |
-
'title':
|
3343 |
}));
|
3344 |
break;
|
3345 |
|
@@ -3351,7 +3379,7 @@
|
|
3351 |
$('#uri-delete-model').modal('show');
|
3352 |
}).attr({
|
3353 |
'data-toggle': "tooltip",
|
3354 |
-
'title':
|
3355 |
}));
|
3356 |
break;
|
3357 |
|
@@ -3934,7 +3962,7 @@
|
|
3934 |
otype: type ? type[1] : null
|
3935 |
};
|
3936 |
|
3937 |
-
|
3938 |
data.menu = aamEnvData.menu;
|
3939 |
data.submenu = aamEnvData.submenu;
|
3940 |
data.toolbar = aamEnvData.toolbar;
|
@@ -4303,10 +4331,11 @@
|
|
4303 |
|
4304 |
/**
|
4305 |
*
|
|
|
4306 |
* @returns {Boolean}
|
4307 |
*/
|
4308 |
-
AAM.prototype.isUI = function() {
|
4309 |
-
return (
|
4310 |
};
|
4311 |
|
4312 |
/**
|
54 |
});
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
*
|
59 |
+
* @param {type} id
|
60 |
+
* @param {type} btn
|
61 |
+
* @returns {undefined}
|
62 |
+
*/
|
63 |
+
function applyPolicy(subject, policyId, effect, btn) {
|
64 |
+
//show indicator
|
65 |
+
if (typeof btn !== 'function') {
|
66 |
+
$(btn).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
67 |
+
}
|
68 |
+
|
69 |
+
getAAM().queueRequest(function () {
|
70 |
+
$.ajax(getLocal().ajaxurl, {
|
71 |
+
type: 'POST',
|
72 |
+
dataType: 'json',
|
73 |
+
data: {
|
74 |
+
action: 'aam',
|
75 |
+
sub_action: 'Main_Policy.save',
|
76 |
+
subject: subject.type,
|
77 |
+
subjectId: subject.id,
|
78 |
+
_ajax_nonce: getLocal().nonce,
|
79 |
+
id: policyId,
|
80 |
+
effect: effect
|
81 |
+
},
|
82 |
+
success: function (response) {
|
83 |
+
if (typeof btn === 'function') {
|
84 |
+
btn(response);
|
85 |
+
} else {
|
86 |
+
if (response.status === 'success') {
|
87 |
+
if (effect) {
|
88 |
+
$(btn).attr('class', 'aam-row-action text-success icon-check');
|
89 |
+
} else {
|
90 |
+
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
91 |
+
}
|
92 |
+
} else {
|
93 |
+
if (effect) {
|
94 |
+
getAAM().notification(
|
95 |
+
'danger',
|
96 |
+
getAAM().__('Failed to apply policy changes')
|
97 |
+
);
|
98 |
+
$(btn).attr('class', 'aam-row-action text-muted icon-check-empty');
|
99 |
+
} else {
|
100 |
+
$(btn).attr('class', 'aam-row-action text-success icon-check');
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
},
|
105 |
+
error: function () {
|
106 |
+
getAAM().notification(
|
107 |
+
'danger', getAAM().__('Application Error')
|
108 |
+
);
|
109 |
+
}
|
110 |
+
});
|
111 |
+
});
|
112 |
+
}
|
113 |
+
|
114 |
/**
|
115 |
*
|
116 |
* @returns {undefined}
|
208 |
data: {
|
209 |
action: 'aam',
|
210 |
sub_action: 'Subject_Role.getTable',
|
211 |
+
_ajax_nonce: getLocal().nonce,
|
212 |
+
subject: getAAM().getSubject().type,
|
213 |
+
subjectId: getAAM().getSubject().id,
|
214 |
+
ui: getLocal().ui,
|
215 |
+
id: $('#object-id').val()
|
216 |
}
|
217 |
},
|
218 |
columnDefs: [
|
226 |
infoFiltered: ''
|
227 |
},
|
228 |
initComplete: function () {
|
229 |
+
if (getAAM().isUI('main') && getLocal().caps.create_roles) {
|
230 |
var create = $('<a/>', {
|
231 |
'href': '#',
|
232 |
'class': 'btn btn-primary'
|
286 |
$('i.icon-cog', container).attr(
|
287 |
'class', 'aam-row-action icon-cog text-muted'
|
288 |
);
|
289 |
+
if (getAAM().isUI('main')) {
|
290 |
$('i.icon-cog', container).attr(
|
291 |
'class', 'aam-row-action icon-spin4 animate-spin'
|
292 |
);
|
312 |
break;
|
313 |
|
314 |
case 'edit':
|
315 |
+
if (getAAM().isUI('main')) {
|
316 |
$(container).append($('<i/>', {
|
317 |
'class': 'aam-row-action icon-pencil text-warning'
|
318 |
}).bind('click', function () {
|
335 |
break;
|
336 |
|
337 |
case 'no-edit':
|
338 |
+
if (getAAM().isUI('main')) {
|
339 |
$(container).append($('<i/>', {
|
340 |
'class': 'aam-row-action icon-pencil text-muted'
|
341 |
}));
|
343 |
break;
|
344 |
|
345 |
case 'clone':
|
346 |
+
if (getAAM().isUI('main')) {
|
347 |
$(container).append($('<i/>', {
|
348 |
'class': 'aam-row-action icon-clone text-success'
|
349 |
}).bind('click', function () {
|
359 |
break;
|
360 |
|
361 |
case 'no-clone':
|
362 |
+
if (getAAM().isUI('main')) {
|
363 |
$(container).append($('<i/>', {
|
364 |
'class': 'aam-row-action icon-clone text-muted'
|
365 |
}));
|
367 |
break;
|
368 |
|
369 |
case 'delete':
|
370 |
+
if (getAAM().isUI('main')) {
|
371 |
$(container).append($('<i/>', {
|
372 |
'class': 'aam-row-action icon-trash-empty text-danger'
|
373 |
}).bind('click', {role: data}, function (event) {
|
388 |
break;
|
389 |
|
390 |
case 'no-delete':
|
391 |
+
if (getAAM().isUI('main')) {
|
392 |
$(container).append($('<i/>', {
|
393 |
'class': 'aam-row-action icon-trash-empty text-muted'
|
394 |
}));
|
395 |
}
|
396 |
break;
|
397 |
+
|
398 |
+
case 'attach':
|
399 |
+
if (getAAM().isUI('principal')) {
|
400 |
+
$(container).append($('<i/>', {
|
401 |
+
'class': 'aam-row-action icon-check-empty'
|
402 |
+
}).bind('click', function() {
|
403 |
+
applyPolicy(
|
404 |
+
{
|
405 |
+
type: 'role',
|
406 |
+
id: data[0]
|
407 |
+
},
|
408 |
+
$('#object-id').val(),
|
409 |
+
1,
|
410 |
+
this
|
411 |
+
);
|
412 |
+
}));
|
413 |
+
}
|
414 |
+
break;
|
415 |
+
|
416 |
+
case 'detach':
|
417 |
+
if (getAAM().isUI('principal')) {
|
418 |
+
$(container).append($('<i/>', {
|
419 |
+
'class': 'aam-row-action icon-check text-success'
|
420 |
+
}).bind('click', function() {
|
421 |
+
applyPolicy(
|
422 |
+
{
|
423 |
+
type: 'role',
|
424 |
+
id: data[0]
|
425 |
+
},
|
426 |
+
$('#object-id').val(),
|
427 |
+
0,
|
428 |
+
this
|
429 |
+
);
|
430 |
+
}));
|
431 |
+
}
|
432 |
+
break;
|
433 |
|
434 |
default:
|
435 |
+
if (getAAM().isUI('main')) {
|
436 |
getAAM().triggerHook('role-action', {
|
437 |
container: container,
|
438 |
action : action,
|
761 |
params.sub_action = 'Subject_User.getTable';
|
762 |
params._ajax_nonce = getLocal().nonce;
|
763 |
params.role = $('#user-list-filter').val();
|
764 |
+
params.subject = getAAM().getSubject().type;
|
765 |
+
params.subjectId = getAAM().getSubject().id;
|
766 |
+
params.ui = getLocal().ui;
|
767 |
+
params.id = $('#object-id').val();
|
768 |
|
769 |
return params;
|
770 |
}
|
780 |
infoFiltered: ''
|
781 |
},
|
782 |
initComplete: function () {
|
783 |
+
if (getAAM().isUI('main') && getLocal().caps.create_users) {
|
784 |
var create = $('<a/>', {
|
785 |
'href': '#',
|
786 |
'class': 'btn btn-primary'
|
860 |
);
|
861 |
$('i.icon-cog', container).attr('class', 'aam-row-action icon-cog text-muted');
|
862 |
|
863 |
+
if (getAAM().isUI('main')) {
|
864 |
$('i.icon-cog', container).attr('class', 'aam-row-action icon-spin4 animate-spin');
|
865 |
getAAM().fetchContent('main');
|
866 |
$('i.icon-spin4', container).attr('class', 'aam-row-action icon-cog text-muted');
|
882 |
break;
|
883 |
|
884 |
case 'ttl':
|
885 |
+
if (getAAM().isUI('main')) {
|
886 |
$(container).append($('<i/>', {
|
887 |
'class': 'aam-row-action icon-clock text-' + (data[5] ? 'danger' : 'warning')
|
888 |
}).bind('click', function () {
|
917 |
break;
|
918 |
|
919 |
case 'no-ttl':
|
920 |
+
if (getAAM().isUI('main')) {
|
921 |
$(container).append($('<i/>', {
|
922 |