Skip to content

Instantly share code, notes, and snippets.

View ppeiris's full-sized avatar
🏋️‍♂️
Working on machine learning projects

Prabath Peiris ppeiris

🏋️‍♂️
Working on machine learning projects
View GitHub Profile
@ppeiris
ppeiris / ryan.py
Last active November 19, 2019 18:20
"""
args:
- users
- user_roles
"""
def get_user_roles(self, users, user_roles={}):
for user in users:
if user in user_roles:
continue
self.connection.set_url(f'/api/mo/sys/userext/user-{user}.json?rsp-subtree=full')
<?php
use Admin\Command\AddInterceptFactory;
return [
[
'name' => 'addintercept',
'route' => '[--authkey=]',
'description' => 'Find out all the users that need to intercept to direct the Notification Walled Garden ',
'short_description' => 'Add intercept',
<?php
use Zend\Console\Console;
use ZF\Console\Application;
use Zend\Console\ColorInterface as Color;
use ZF\Console\Dispatcher;
use Admin\Forms\NotificationPrimaryInfo;
chdir(dirname(__DIR__));
<?php
use Zend\Expressive\Helper\ServerUrlMiddleware;
use Zend\Expressive\Helper\UrlHelperMiddleware;
use Zend\Expressive\Middleware\ImplicitHeadMiddleware;
use Zend\Expressive\Middleware\ImplicitOptionsMiddleware;
use Zend\Expressive\Middleware\NotFoundHandler;
use Zend\Stratigility\Middleware\ErrorHandler;
public function attach(EventManagerInterface $events)
{
$events->attach('dispatch.error', array($this, 'onDispatchError'), 100);
}
public function onDispatchError($e)
{
// $logInfo = [
// 'event' => $e->getRequest()->getServer()->toArray(),
// 'error' => $e->getError()
<?php
namespace ispaccount;
use ZF\ApiProblem\ApiProblem;
use ZF\Apigility\Provider\ApigilityProviderInterface;
use Zend\Http\Response\ApiProblemResponse;
use Zend\Mvc\MvcEvent;
class Module implements ApigilityProviderInterface
{
'router' => [
'routes' => [
'ispaccount.rest.ispaccount' => [
'type' => 'Segment',
'options' => [
'route' => '/api/ispaccount[/:ispaccount_id]',
'constraints' => [
'ispaccount_id' => '[a-zA-Z][a-zA-Z0-9_-]+',
],
'defaults' => [
<?php
return array(
'controllers' => array(
'factories' => array(
LoginController::class => LoginControllerFactory::class,
),
// 'invokables' => array(
// 'Login\Controller\Login' => 'Login\Controller\LoginController',
<?php
namespace Login;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
class Module implements AutoloaderProviderInterface, ConfigProviderInterface
{
public function getAutoloaderConfig()
<?php
$tarr = array(
'controllers' => array(
'invokables' => array(
'Login\Controller\Login' => 'Login\Controller\LoginController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(