Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
M
maintenanceMode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SondagesPro
coreAndTools
maintenanceMode
Commits
ac6060cb
Commit
ac6060cb
authored
Feb 19, 2018
by
Chenu Denis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[feature] Disable admin login for non super-admin (needed for 2.6)
parent
c48a48f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
maintenanceMode.php
maintenanceMode.php
+17
-2
No files found.
maintenanceMode.php
View file @
ac6060cb
...
...
@@ -63,7 +63,8 @@ class maintenanceMode extends PluginBase {
{
$this
->
subscribe
(
'beforeControllerAction'
);
$this
->
subscribe
(
'beforeSurveyPage'
,
'beforeControllerAction'
);
/* diable login (2.6) for admin */
$this
->
subscribe
(
'newUserSession'
);
$this
->
subscribe
(
'beforeTokenEmail'
);
$this
->
subscribe
(
'beforeActivate'
);
...
...
@@ -71,9 +72,23 @@ class maintenanceMode extends PluginBase {
$this
->
subscribe
(
'afterPluginLoad'
);
}
public
function
newUserSession
()
{
if
(
$this
->
get
(
'superAdminOnly'
)
&&
$this
->
_inMaintenance
()){
$identity
=
$this
->
getEvent
()
->
get
(
'identity'
);
$sUser
=
$identity
->
username
;
$oUser
=
$this
->
api
->
getUserByName
(
$sUser
);
if
(
$oUser
)
{
if
(
!
Permission
::
model
()
->
hasGlobalPermission
(
'superadmin'
,
'read'
,
$oUser
->
uid
))
{
$identity
->
id
=
null
;
$this
->
getEvent
()
->
set
(
'result'
,
new
LSAuthResult
(
99
,
$this
->
_translate
(
"This website are on maintenance mode."
)));
$this
->
getEvent
()
->
stop
();
}
}
}
}
/**
* fix some settings
* @see
ls\pluginmanager\
PluginBase
* @see PluginBase
*/
public
function
getPluginSettings
(
$getValues
=
true
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment