Adriano Faria Posted December 4, 2018 Share Posted December 4, 2018 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: This can be confusing to the admin. Shouldn't it check my content item permissions and then display only what I allow ? Tks. Link to comment Share on other sites More sharing options...
HeadStand Posted December 5, 2018 Share Posted December 5, 2018 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? Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 5, 2018 Author Share Posted December 5, 2018 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. Link to comment Share on other sites More sharing options...
newbie LAC Posted December 5, 2018 Share Posted December 5, 2018 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 Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 5, 2018 Author Share Posted December 5, 2018 That will work fine, except for MOVE, which isn’t implementable, IIRC. Not sure. Will try it within an hour. Link to comment Share on other sites More sharing options...
Daniel F Posted December 5, 2018 Share Posted December 5, 2018 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. Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 5, 2018 Author Share Posted December 5, 2018 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. Link to comment Share on other sites More sharing options...
newbie LAC Posted December 5, 2018 Share Posted December 5, 2018 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 and Btw Why you didn't use ContentModeratorPermissions extension to add 2 permissions? Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 5, 2018 Author Share Posted December 5, 2018 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? Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 7, 2018 Author Share Posted December 7, 2018 @bfarber, any suggestion here? I need to remove the CAN MOVE XXXX? from Moderator Permission in my app. Tks. Link to comment Share on other sites More sharing options...
newbie LAC Posted December 8, 2018 Share Posted December 8, 2018 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 Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 8, 2018 Author Share Posted December 8, 2018 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. Link to comment Share on other sites More sharing options...
newbie LAC Posted December 8, 2018 Share Posted December 8, 2018 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 Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 8, 2018 Author Share Posted December 8, 2018 So instead of removing it I would have to show a text like your image? Link to comment Share on other sites More sharing options...
newbie LAC Posted December 8, 2018 Share Posted December 8, 2018 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 Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 8, 2018 Author Share Posted December 8, 2018 Ok. I’ll try a hook in \IPS\core\extensions\core\ModeratorPermissions\ContentGenerator 👍 Link to comment Share on other sites More sharing options...
Adriano Faria Posted December 8, 2018 Author Share Posted December 8, 2018 A hook in \IPS\core\extensions\core\ModeratorPermissions\ContentGenerator worked. Tks @newbie LAC Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.