Jump to content

Moderator permission on my content item


Adriano Faria

Recommended Posts

Posted

I'm not sure I already asked this so here it goes again.

There are some mod permissions that I explicitly disallow on my content item:

	/**
	 * Can pin?
	 *
	 * @param	\IPS\Member|NULL	$member	The member to check for (NULL for currently logged in member)
	 * @return	bool
	 */
	public function canPin( $member=NULL )
	{
		return FALSE;
	}

	/**
	 * Can unpin?
	 *
	 * @param	\IPS\Member|NULL	$member	The member to check for (NULL for currently logged in member)
	 * @return	bool
	 */
	public function canUnpin( $member=NULL )
	{
		return FALSE;
	}

	/**
	 * Can feature?
	 *
	 * @param	\IPS\Member|NULL	$member	The member to check for (NULL for currently logged in member)
	 * @return	bool
	 */
	public function canFeature( $member=NULL )
	{
		return FALSE;
	}

	/**
	 * Can unfeature?
	 *
	 * @param	\IPS\Member|NULL	$member	The member to check for (NULL for currently logged in member)
	 * @return	bool
	 */
	public function canUnfeature( $member=NULL )
	{
		return FALSE;
	}
	
	/**
	 * Can move?
	 *
	 * @param	\IPS\Member|NULL	$member	The member to check for (NULL for currently logged in member)
	 * @return	bool
	 */
	public function canMove( $member=NULL )
	{
		return FALSE;
	}

Still I got on moderator permissions:

wB1AQOF.png

 

This can be confusing to the admin. Shouldn't it check my content item permissions and then display only what I allow ?

Tks.

Posted
3 hours ago, HeadStand said:

Why can't you just leave out the appropriate interfaces? For example, if you have pin and unpin always false, don't implement IPS\Content\Pinnable. Does that not work? 

True. I’ll remove them from the class to see if they doesn’t appear.

Posted
13 hours ago, Adriano Faria said:

Shouldn't it check my content item permissions and then display only what I allow ?

No.

What to display if you have

	public function canPin( $member=NULL )
	{
		return ($this->container()->_id == 5);
	}

Don't implement an interface as HeadStand said

Posted

The moderator permissions form is handled via IPS\Content\ModeratorPermissions and not the canX methods inside the item classes.

So just create an own ModeratorPermissions Extensions for your item and unset all unnecessary stuff.

Posted
3 minutes ago, Daniel F said:

So just create an own ModeratorPermissions Extensions for your item and unset all unnecessary stuff.

Great. I’ll do it for the MOVE then. The rest I won’t implement. 

Thank you all. 

Posted
1 hour ago, Daniel F said:

So just create an own ModeratorPermissions Extensions for your item and unset all unnecessary stuff.

This will create additional tab with permissions as you have for Downloads

content_item.thumb.jpg.dc969ed364991c1b39df1a5b4cec5c3c.jpg

and

mod_perms.thumb.jpg.575cd24c17212bf16e4f532cd49e242c.jpg


Btw Why you didn't use ContentModeratorPermissions extension to add 2 permissions?

 

Posted
2 hours ago, Daniel F said:

So just create an own ModeratorPermissions Extensions for your item and unset all unnecessary stuff. 

Wouldn't it be the ContentModeratorPermissions extension? can_move_ is handled on it, right? I'm not sure how to unset a permission there, as I can't return parent, etc.

I have 2 permission on ModeratorPermissions:

	public function getPermissions()
	{
		$return = array(
			'can_manage_fields'		=> 'YesNo',
			'can_manage_applications'	=> 'YesNo'
		);

		return $return;
	}

But this is for custom permissions, right?

Posted
16 hours ago, Adriano Faria said:

@bfarber, any suggestion here? I need to remove the CAN MOVE XXXX? from Moderator Permission in my app.

Tks.

I give you 3 suggestions

1. Use css to hide MOVE permission

2. Create code hook and unset() MOVE permission

3. Create ContentModeratorPermissions extension and override MOVE permission

Posted
1 hour ago, newbie LAC said:

2. Create code hook and unset() MOVE permission

Hook where?

1 hour ago, newbie LAC said:

3. Create ContentModeratorPermissions extension and override MOVE permission

 

On 12/5/2018 at 9:29 AM, Adriano Faria said:

Wouldn't it be the ContentModeratorPermissions extension? can_move_ is handled on it, right? I'm not sure how to unset a permission there, as I can't return parent, etc.

 

Posted
13 minutes ago, Adriano Faria said:

Hook where?

\IPS\core\extensions\core\ModeratorPermissions\ContentGenerator

 

26 minutes ago, Adriano Faria said:

Wouldn't it be the ContentModeratorPermissions extension? can_move_ is handled on it, right? I'm not sure how to unset a permission there, as I can't return parent, etc.

This extension add additional elements. You can't unset element. Only override.

Something like

unsupported.jpg.e4e22e66653df8ee94b832345e582f27.jpg

Posted
4 minutes ago, Adriano Faria said:

So instead of removing it I would have to show a text like your image?

It's example for 

Quote

3. Create ContentModeratorPermissions extension and override MOVE permission


If you want remove use 

Quote

2. Create code hook and unset() MOVE permission

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...