v3.0.3.8 Custom Extension Sub-folders #11785
Buddyboy-git
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
Quite confusing. To start with: What problem exactly are you trying to solve? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My original suggestion is insufficient. So I went back to the drawing board and have a new code change suggestion. And funny enough, v4 does exactly what i am proposing here for v3.x.
The only problem is, I am still horrible at git, and the user voice feature doesn't work.
So I am proposing my code change here. And this allows for custom extensions to have subdirectories.
And since you guys are seasoned developers you will probably touch this up a bit.
Here is my new Admin/Controller/Startup/Permission
Code: Select all
`
class ControllerStartupPermission extends Controller {
public function index() {
if (isset($this->request->get['route'])) {
$route = '';
$part = explode('/', $this->request->get['route']);
``
if (isset($part[0])) {
$route .= $part[0];
}
if (isset($part[1])) {
$route .= '/' . $part[1];
}
// If a 3rd part is found we need to check if its under one of the extension folders.
$extension = array(
'extension/advertise',
'extension/dashboard',
'extension/analytics',
'extension/captcha',
'extension/extension',
'extension/feed',
'extension/fraud',
'extension/module',
'extension/payment',
'extension/shipping',
'extension/theme',
'extension/total',
'extension/report'
);
if (isset($part[2]) && in_array($route, $extension)) {
$route .= '/' . $part[2];
}
// We want to ingore some pages from having its permission checked.
$ignore = array(
'common/dashboard',
'common/login',
'common/logout',
'common/forgotten',
'common/reset',
'error/not_found',
'error/permission'
);
if (!in_array($route, $ignore) && !$this->user->hasPermission('access', $permission_check_route ) {
return new Action('error/permission');
}
}
}
}
`
Beta Was this translation helpful? Give feedback.
All reactions