diff --git a/src/components/com_cluster/administrator/access.xml b/src/components/com_cluster/administrator/access.xml
index aa5a2bb..27f5e20 100644
--- a/src/components/com_cluster/administrator/access.xml
+++ b/src/components/com_cluster/administrator/access.xml
@@ -8,5 +8,6 @@
+
diff --git a/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.ini b/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.ini
index 1a0d1d8..25dee5d 100644
--- a/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.ini
+++ b/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.ini
@@ -92,3 +92,6 @@ COM_CLUSTER_PAGE_VIEW_USER = "Cluster user: View"
COM_CLUSTER_USER_LIST_VIEW_NAME="User"
COM_CLUSTER_USER_LIST_VIEW_CLUSTER="Cluster Name"
COM_CLUSTER_USERLIST_VIEW_ID="ID"
+
+JACTION_MANAGE_ALL_CLUSTER="Manage All Clusters"
+JACTION_MANAGE_ALL_CLUSTER_DESC="Manage All Clusters"
diff --git a/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.sys.ini b/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.sys.ini
index e2bca07..11d9fcd 100644
--- a/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.sys.ini
+++ b/src/components/com_cluster/administrator/languages/en-GB/en-GB.com_cluster.sys.ini
@@ -7,4 +7,5 @@ COM_CLUSTER_CLUSTER_VIEW_EDIT_DESC="Shows a form to create a New Cluster."
COM_CLUSTER_CLUSTERS_VIEW_DEFAULT_TITLE="List all Clusters"
COM_CLUSTER_CLUSTERS_VIEW_DEFAULT_DESC="Shows a list of all the Clusters."
COM_CLUSTER_TITLE_ITEM_VIEW_CLUSTER="Single Cluster"
-COM_CLUSTER_TITLE_CLUSTER="Cluster"
\ No newline at end of file
+COM_CLUSTER_TITLE_CLUSTER="Cluster"
+COM_CLUSTERS_VIEW_CLUSTER_USERS="Cluster users"
diff --git a/src/components/com_cluster/administrator/libraries/cluster.php b/src/components/com_cluster/administrator/libraries/cluster.php
index 8ee5279..3052c92 100644
--- a/src/components/com_cluster/administrator/libraries/cluster.php
+++ b/src/components/com_cluster/administrator/libraries/cluster.php
@@ -231,4 +231,34 @@ public function isOwner($userId = null)
return false;
}
+
+ /**
+ * Function isMember to check user associated with passed cluster_id
+ *
+ * @param INT $userId User Id
+ *
+ * @return boolean
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function isMember($userId = null)
+ {
+ $userId = Factory::getuser($userId)->id;
+
+ $ClusterModel = ClusterFactory::model('ClusterUsers', array('ignore_request' => true));
+
+ $ClusterModel->setState('filter.published', 1);
+ $ClusterModel->setState('filter.cluster_id', (int) $this->id);
+ $ClusterModel->setState('filter.user_id', $userId);
+
+ // Check user associated with passed cluster_id
+ $clusters = $ClusterModel->getItems();
+
+ if (!empty($clusters))
+ {
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/src/components/com_cluster/administrator/models/clusterusers.php b/src/components/com_cluster/administrator/models/clusterusers.php
index 005c8ea..1e5ebfa 100644
--- a/src/components/com_cluster/administrator/models/clusterusers.php
+++ b/src/components/com_cluster/administrator/models/clusterusers.php
@@ -10,7 +10,9 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
+use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ListModel;
+use Joomla\CMS\Component\ComponentHelper;
/**
* Methods supporting a list of records.
@@ -34,7 +36,7 @@ public function __construct($config = array())
$config['filter_fields'] = array(
'id', 'cu.id',
'cluster_id', 'cu.cluster_id',
- 'state', 'cu.state',
+ 'state', 'cu.state','cl.name','cl.client_id'
);
}
@@ -54,11 +56,30 @@ protected function getListQuery()
$db = $this->getDbo();
$query = $db->getQuery(true);
- $query->select(array('cu.*','cl.name', 'users.name as uname'));
+ $query->select(array('cu.*','cl.name', 'users.name as uname', 'users.username','cl.name as title', 'cl.client_id as client_id'));
$query->from($db->quoteName('#__tj_cluster_nodes', 'cu'));
- $query->join('INNER', $db->quoteName('#__users', 'users') . ' ON (' . $db->quoteName('cu.user_id') . ' = ' . $db->quoteName('users.id') . ')');
+ $query->join('INNER', $db->quoteName('#__users', 'users') . ' ON (' . $db->quoteName('cu.user_id') . ' = '
+ . $db->quoteName('users.id') . ')');
$query->join('INNER', $db->quoteName('#__tj_clusters', 'cl') . ' ON (' . $db->quoteName('cl.id') . ' = ' . $db->quoteName('cu.cluster_id') . ')');
+ // Get com_subusers component status
+ $subUserExist = ComponentHelper::getComponent('com_subusers', true)->enabled;
+
+ if ($subUserExist)
+ {
+ $roleId = $this->getState('filter.role_id');
+
+ if (is_numeric($roleId))
+ {
+ $query->join('INNER', $db->qn('#__tjsu_users', 'su') .
+ ' ON (' . $db->qn('users.id') . ' = ' . $db->qn('su.user_id') . ' AND ' . $db->qn('su.client') . ' = "com_multiagency" )');
+ $query->join('INNER', $db->qn('#__tjsu_roles', 'r') .
+ ' ON (' . $db->qn('r.id') . ' = ' . $db->qn('su.role_id') . ' AND ' . $db->qn('r.state') . ' = 1 )');
+
+ $query->where($db->quoteName('su.role_id') . ' != ' . (int) $roleId);
+ }
+ }
+
// Filter by search in title.
$search = $this->getState('filter.search');
@@ -122,7 +143,7 @@ protected function getListQuery()
$query->where("cl.client_id IN ('" . implode("','", $clusterClientId) . "')");
}
- // Filter by state
+ // Filter by cluster table state
$published = $this->getState('filter.published');
if (is_numeric($published))
@@ -134,7 +155,7 @@ protected function getListQuery()
$query->where('(cl.state = 0 OR cl.state = 1)');
}
- // Filter by blocked users
+ // Filter users by block
$blockUser = $this->getState('filter.block');
if (is_numeric($blockUser))
diff --git a/src/components/com_cluster/administrator/models/forms/cluster.xml b/src/components/com_cluster/administrator/models/forms/cluster.xml
index 387d57c..fe0e06b 100644
--- a/src/components/com_cluster/administrator/models/forms/cluster.xml
+++ b/src/components/com_cluster/administrator/models/forms/cluster.xml
@@ -1,24 +1,91 @@
diff --git a/src/components/com_cluster/administrator/models/forms/clusteruser.xml b/src/components/com_cluster/administrator/models/forms/clusteruser.xml
index a791e59..e1ac266 100644
--- a/src/components/com_cluster/administrator/models/forms/clusteruser.xml
+++ b/src/components/com_cluster/administrator/models/forms/clusteruser.xml
@@ -1,21 +1,81 @@
diff --git a/src/components/com_cluster/administrator/models/forms/filter_clusters.xml b/src/components/com_cluster/administrator/models/forms/filter_clusters.xml
index 96201ab..12a0ca3 100644
--- a/src/components/com_cluster/administrator/models/forms/filter_clusters.xml
+++ b/src/components/com_cluster/administrator/models/forms/filter_clusters.xml
@@ -1,13 +1,34 @@
+
\ No newline at end of file
diff --git a/src/components/com_cluster/administrator/models/forms/filter_clusterusers.xml b/src/components/com_cluster/administrator/models/forms/filter_clusterusers.xml
index 78a0347..b66ce18 100644
--- a/src/components/com_cluster/administrator/models/forms/filter_clusterusers.xml
+++ b/src/components/com_cluster/administrator/models/forms/filter_clusterusers.xml
@@ -1,14 +1,45 @@
+
\ No newline at end of file