By Marcus Roskill on Tuesday, 24 July 2018
Posted in General Issues
Replies 10
Likes 0
Views 570
Votes 0
Hi guys,

Trying to setup a user account which is a super user, as they need to be able to pin posts on the stream that stay at the top but I want to narrow down their permissions i.e. only see the easy social component in Joomla. How do I go about doing this?

Thanks,
Katie
Hi Katie,
I want to narrow down their permissions i.e. only see the easy social component in Joomla
Not really sure what you mean here. Do you mean you want to allow super users to access EasySocial webpages on the site only, not other components?

Unfortunately super users cannot be restricted and this is native Joomla behavior. The only way to do this is to assign the user to another user group, which means other users can no longer see their pinned stream items in the main dashboard.
·
Wednesday, 25 July 2018 10:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Raymond, This is Richard - I am working with Katie on this project.

To be clear - we are unable to provide full super user access to our client who will operate the website. To do so would expose configuration and code elements to the client which we cannot permit.

So, we wish to create an admin account for the back end which will lock down certain parts of the administration interface. This is not a super user.

How do we allow this specific client admin account to pin their stream items in the newsfeed?

I have looked at the behaviour in the function canSticky() and can make a modification to specify a specific Joomla user ID, but this does not allow this client admin user to pin their item in the newsfeed.




/**
* Determines if the stream item can be made sticky
*
* @since 1.3
* @access public
*/
public function canSticky()
{
if (!$this->config->get('stream.pin.enabled')) {
return false;
}

// If the stream is moderated, it shouldn't be allowed to be stickied
if ($this->isModerated()) {
return false;
}

if ($this->isCluster()) {
$cluster = ES::cluster($this->cluster_type, $this->cluster_id);

// if user is not the cluster owner or the admin, then dont alllow to sticky
if (!$cluster->isOwner() && !$cluster->isAdmin()) {
return false;
}

// bonzomedia enable only if the user is set to be a specific user id rather than implicit easysocial isAdmin

//$bonzo_user = JFactory::getUser();

//if (!$cluster->isOwner() && $bonzo_user->id != 287) {
// return false;
//}

} else {
if (!$this->isOwner()) {
return false;
}
}

return true;
}



Somewhere else in your code you are making some kind of check for super user to allow this item pin in the newsfeed.

Can you tell me where this is, or suggest another way to allow the specification of a specific administrator user to be able to pin their item in the newsfeed please?

From my perspective, as it currently stands this is a severe limitation of easysocial - locking this functionality to a super user is not workable in environments where access to only parts of the administration interface is required.

Look forward to hearing from you,

Richard
·
Tuesday, 28 August 2018 19:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Richard,

If I understand correctly, you would like to assign other users which under `admin` Joomla user group to have this pin other stream item feature on your site right?

If yes, this is how the current system check for the user whether got permission to use this pin functionality.

1. Determine that stream item dropdown option whether need to show this pin option or not
JoomlaFolder/administrator/components/com_easysocial/includes/stream/item.php canSticky method

2. When you click that Pin option, this is another checking whether this user have the permission to use Pin option
JoomlaFolder/administrator/components/com_easysocial/tables/stream.php canSticky method

3. From the dashboard sticky display part
JoomlaFolder/administrator/components/com_easysocial/includes/stream/stream.php

This following code will check for the site admin, i think this part you have to add some custom code to retrieve your `admin` Joomla user group users
LINE 1242


// Only retrieve sticky from admin
if ($adminOnly) {
$userModel = ES::model('Users');
$admins = $userModel->getSiteAdmins();

$adminIds = array();

foreach ($admins as $admin) {
$adminIds[] = $admin->id;
}
}
·
Tuesday, 28 August 2018 23:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Arlex,

Thanks for your reply.

Having looked at that code, I can't see anywhere that it requires a SUPER USER,

To put this simply - does the front-end user have to be SUPER USER or can any member of the ADMINISTRATOR user group pin items to the newsfeed?

If the answer is that any user belonging to the ADMINISTRATOR group can do this pin, then we don't need to make any changes!

Richard
·
Wednesday, 29 August 2018 16:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Richard,

If you see the following functions(isSiteAdmin/getSiteAdmins) in the code, then they are basically checking for users belonging to the super user group.

By default only super users can pin items to the newsfeed, which means you would have to make changes to achieve your desired behavior.
·
Wednesday, 29 August 2018 18:56
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post