Adriano Faria Posted February 13, 2022 Posted February 13, 2022 Hello, I have a new resource that adds a moderator permission and needs to send a notification to these moderators when a specific action happens. Item 1.1 of Marketplace Submission Guidelines says: Quote 1.1. All submissions are required to be unique and the original work of the author. You may not utilize any code, elements or assets from any third party without proper authorization and licensing from the copyright holder. Redistribution of Invision Community code and other digital assets protected by copyright and the End User License Agreement is expressly forbidden. Violations may incur removal from the Marketplace, license termination and further remedies afforded by law. It was already said to me in old ticket system that "there are things that can't be done in other way/there's only one way to do" or something like that, like methods from models, etc. So my question is basically in this part, for example, that can be found in \IPS\Content::report(): /* Send notification to mods */ $moderators = array( 'm' => array(), 'g' => array() ); foreach ( \IPS\Db::i()->select( '*', 'core_moderators' ) as $mod ) { $canView = FALSE; if ( $mod['perms'] == '*' ) { $canView = TRUE; } if ( $canView === FALSE ) { $perms = json_decode( $mod['perms'], TRUE ); if ( isset( $perms['can_view_reports'] ) AND $perms['can_view_reports'] === TRUE ) { $canView = TRUE; } } if ( $canView === TRUE ) { $moderators[ $mod['type'] ][] = $mod['id']; } } $notification = new \IPS\Notification( \IPS\Application::load('core'), 'report_center', $index, array( $index, $reportInsert, $this ) ); foreach ( \IPS\Db::i()->select( '*', 'core_members', ( \count( $moderators['m'] ) ? \IPS\Db::i()->in( 'member_id', $moderators['m'] ) . ' OR ' : '' ) . \IPS\Db::i()->in( 'member_group_id', $moderators['g'] ) . ' OR ' . \IPS\Db::i()->findInSet( 'mgroup_others', $moderators['g'] ) ) as $member ) { $notification->recipients->attach( \IPS\Member::constructFromData( $member ) ); } $notification->send(); That's exactly what I need: search for all moderators (unrestricted or that has a specific permission) but it would change basically the moderator permission name and the notification line. So the doubt is pretty straightforward: is it allowed/safe to use it? If no, how to check moderator permissions in "another way"? Thank you.
Solution Daniel F Posted February 14, 2022 Solution Posted February 14, 2022 Sure, I don't see why not. It should be really straightforward what's allowed and what not. Taking the downloads app and renaming any "downloads" references to "links" or "jobs" and "file" to "link" or "job" Same applies also to e.g. taking a complete class or method.. It should be really common sense that that's not allowed, or?:( E.g. once our IPS\nexus\Money class was copied into an own app to provide payment options.. that's a big NO! Copying some code which runs a query and which calls another method => That said, the code which you've posted it a great candidate to be extracted into an own method, so I have suggest this change internally. Adriano Faria, TAMAN and DawPi 2 1
Recommended Posts