Coder Social home page Coder Social logo

slim3-flex's Introduction

Anurag's GitHub stats


Hi there ๐Ÿ‘‹ I'm Frank

I'm a 31 y/o french DevOps Engineer whom first began working as a fullstack software developer.

Most of my GitHub activity occurs on private repos but I like to either contribute or develop new projects whenever I can find enough free time.

Currently I'm mostly spending my time on topics including Ansible automation, CI/CD, containers orchestration, postgresql, linux, and ISO 27001 certification.

slim3-flex's People

Contributors

caglarkarakoc avatar fidanf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

slim3-flex's Issues

added 2 security levels

Hi,
I added 2 security levels onto Slim3 Flex master. Can you please update?

users table.
Added usertype (1 = normal user, 2 = Admin)

File : app\Middlewares\RoutesUser.php

namespace App\Middlewares;

use App\Auth\Auth;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Router;

class RoutesUser
{
    protected $auth;

    protected $router;

    public function __construct(Auth $auth, Router $router)
    {
        $this->auth = $auth;
        $this->router = $router;
    }

    public function __invoke(Request $request, Response $response, callable $next)
    {
        if (!$this->auth->check()) {
            return $response->withRedirect('/auth/login');
        }

        return $next($request, $response);
    }
}

File : app\Middlewares\RoutesAdmin.php

namespace App\Middlewares;

use App\Auth\Auth;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Router;

class RoutesAdmin {

    protected $auth;
    protected $router;

    public function __construct(Auth $auth, Router $router) {
        $this->auth = $auth;
        $this->router = $router;
    }

    public function __invoke(Request $request, Response $response, callable $next) {

        if (!$this->auth->admincheck()) {
            return $response->withRedirect('/auth/login');
        }

        return $next($request, $response);
    }

}

File : app\Auth\Auth.php

[public function check() {
        return $this->hasUserInSession();
    }

 public function admincheck() {
        
        if ($this->user->usertype == 2) {
            return true;
        }
        return false;
    }](url)

File : routes\web.php

$app->group('', function() {
   // insert your routes here
})->add(new App\Middlewares\RoutesUser(
                $container->get(App\Auth\Auth::class),
                $container->get('router')
));

$app->group('', function() {
   // insert your routes here
})->add(new App\Middlewares\RoutesAdmin(
                $container->get(App\Auth\Auth::class),
                $container->get('router')
));

Im trying to add Swiftmailer 6.2 to this project

Hi,

Im trying to add Swiftmailer 6.2 to this project. Not sure what to do.. Tried to use the email files from the skim3starter. Not getting it right,, can you please provide guidance.

Thanks

Please upgrade to Slim 4

Hi,

Please consider upgrading this project to slim 4. It will be appreciated.
I would do it, but my knowledge regarding slim limited.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.