예제 #1
0
register_admin_route(adminAliasPath() . 'delete_group/{id}', array('as' => 'delete_group', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@group_delete'))->before('auth');
//  ACL Permissions Routes
register_admin_route(adminAliasPath() . 'permissions', array('as' => 'permissions', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permissions'))->before('auth');
register_admin_route(adminAliasPath() . 'create_permission', array('as' => 'create_permission', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permission_create'))->before('auth');
register_admin_route(adminAliasPath() . 'edit_permission/{id}', array('as' => 'edit_permission', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permission_edit'))->before('auth');
register_admin_route_post(adminAliasPath() . 'save_permission', array('as' => 'save_permission', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permission_save'));
register_admin_route_post(adminAliasPath() . 'save_permission/{id}', array('as' => 'update_permission', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permission_save'));
register_admin_route(adminAliasPath() . 'delete_permission/{id}', array('as' => 'delete_permission', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permission_delete'))->before('auth');
//  AJAX Routes
register_admin_route_post(adminAliasPath() . 'user_exists', array('as' => 'user_exists', 'uses' => '\\Developeryamhi\\AuthModule\\UserController@userExists'))->before('auth');
register_admin_route_post(adminAliasPath() . 'group_exists', array('as' => 'group_exists', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@groupExists'))->before('auth');
register_admin_route_post(adminAliasPath() . 'permission_exists', array('as' => 'permission_exists', 'uses' => '\\Developeryamhi\\AuthModule\\ACLController@permissionExists'))->before('auth');
register_admin_route_post(adminAliasPath() . 'users_autocomplete', array('as' => 'users_autocomplete', 'uses' => '\\Developeryamhi\\AuthModule\\UserController@userLists'))->before('auth');
//  Check Module Migrated
if ($this->migrationsDone()) {
    //  Get Groups with Interfaces
    $groups = \Developeryamhi\AuthModule\GroupItem::hasInterface()->get();
    //  Loop Each Groups
    $groups->each(function ($group) {
        //  Check Routes Save
        if ($group->hasValidInterface()) {
            //  Register Group Routes
            register_admin_route(adminAliasPath() . $group->getRoute("list") . "/{group?}", array('as' => $group->getRoute("list"), 'uses' => '\\Developeryamhi\\AuthModule\\UserController@custom_index'))->before('auth');
            register_admin_route(adminAliasPath() . $group->getRoute("create"), array('as' => $group->getRoute("create"), 'uses' => '\\Developeryamhi\\AuthModule\\UserController@custom_create'))->before('auth');
            register_admin_route(adminAliasPath() . $group->getRoute("edit") . '/{id}', array('as' => $group->getRoute("edit"), 'uses' => '\\Developeryamhi\\AuthModule\\UserController@custom_edit'))->before('auth');
            register_admin_route_post(adminAliasPath() . $group->getRoute("save"), array('as' => $group->getRoute("save"), 'uses' => '\\Developeryamhi\\AuthModule\\UserController@custom_save'));
            register_admin_route_post(adminAliasPath() . $group->getRoute("save") . '/{id}', array('as' => $group->getRoute("update"), 'uses' => '\\Developeryamhi\\AuthModule\\UserController@custom_update'));
            register_admin_route(adminAliasPath() . $group->getRoute("delete") . '/{id}', array('as' => $group->getRoute("delete"), 'uses' => '\\Developeryamhi\\AuthModule\\UserController@custom_delete'))->before('auth');
        }
    });
}
예제 #2
0
        //  Clear Contents
        $level = ob_get_level();
        while ($level > 0) {
            @ob_clean();
            $level--;
        }
        //  Return Response
        return Response::view('laravel-admin::errors.error', array("errorTitle" => "Application Error", "exception" => $exception), 500);
    }
});
//  Listen 404
App::missing(function ($exception) {
    //  Get Path Info
    $pathInfo = currentPathInfo();
    //  Get Admin Alias Path
    $adminAliasPath = adminAliasPath();
    //  Match
    if (substr($pathInfo, 0, strlen($adminAliasPath)) == $adminAliasPath) {
        //  Return Response
        return Response::view('laravel-admin::errors.missing', array("errorTitle" => "404 Page not Found", "exception" => $exception), 404);
    }
});
App::down(function () {
    //  Get Path Info
    $pathInfo = trim(currentPathInfo(), "/");
    //  Allowed
    $allowed = false;
    //  Check for Login Page
    if (currentPathUrl() == urlRoute(\Developeryamhi\AuthModule\UserItem::loginRoute(), \Developeryamhi\AuthModule\UserItem::loginRouteParams()) || currentPathUrl() == urlRoute(\Developeryamhi\AuthModule\UserItem::logoutRoute(), \Developeryamhi\AuthModule\UserItem::logoutRouteParams())) {
        $allowed = true;
    }
예제 #3
0
/**
 * Register Admin Route
 */
function register_admin_route($uri, $action = array(), $type = "get")
{
    if ($type == "get") {
        return Route::get(adminAliasPath() . $uri, $action);
    } else {
        if ($type == "post") {
            return Route::post(adminAliasPath() . $uri, $action);
        } else {
            if ($type == "patch") {
                return Route::patch(adminAliasPath() . $uri, $action);
            } else {
                if ($type == "put") {
                    return Route::put(adminAliasPath() . $uri, $action);
                } else {
                    if ($type == "options") {
                        return Route::options(adminAliasPath() . $uri, $action);
                    } else {
                        if ($type == "delete") {
                            return Route::delete(adminAliasPath() . $uri, $action);
                        } else {
                            return Route::any(adminAliasPath() . $uri, $action);
                        }
                    }
                }
            }
        }
    }
}