Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
fusiondirectory
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
27
Issues
27
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
fusiondirectory
fusiondirectory
Commits
fd385981
Verified
Commit
fd385981
authored
Jun 03, 2019
by
Côme Chilliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚜
fix(config) Move hooks to their own config tab
issue
#5937
parent
b426f184
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
78 deletions
+153
-78
plugins/config/class_DebugLevelAttribute.inc
plugins/config/class_DebugLevelAttribute.inc
+48
-0
plugins/config/class_configInLdap.inc
plugins/config/class_configInLdap.inc
+3
-78
plugins/config/class_dashBoardConfig.inc
plugins/config/class_dashBoardConfig.inc
+1
-0
plugins/config/class_hooksConfig.inc
plugins/config/class_hooksConfig.inc
+100
-0
plugins/config/class_mainPluginsConfig.inc
plugins/config/class_mainPluginsConfig.inc
+1
-0
No files found.
plugins/config/class_DebugLevelAttribute.inc
0 → 100644
View file @
fd385981
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Debug level is an OR combination of several values */
class
DebugLevelAttribute
extends
SetAttribute
{
protected
function
loadAttrValue
(
array
$attrs
)
{
if
(
isset
(
$attrs
[
$this
->
getLdapName
()]))
{
$value
=
$attrs
[
$this
->
getLdapName
()][
0
];
$this
->
value
=
[];
foreach
(
$this
->
attribute
->
getChoices
()
as
$choice
)
{
if
(
$value
&
$choice
)
{
$this
->
value
[]
=
$choice
;
}
}
}
else
{
$this
->
resetToDefault
();
}
}
function
computeLdapValue
()
{
$value
=
0
;
foreach
(
$this
->
value
as
$v
)
{
$value
|=
$v
;
}
return
$value
;
}
}
plugins/config/class_configInLdap.inc
View file @
fd385981
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2016 FusionDirectory
Copyright (C) 2012-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -18,34 +19,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Debug level is an OR combination of several values */
class
DebugLevelAttribute
extends
SetAttribute
{
protected
function
loadAttrValue
(
array
$attrs
)
{
if
(
isset
(
$attrs
[
$this
->
getLdapName
()]))
{
$value
=
$attrs
[
$this
->
getLdapName
()][
0
];
$this
->
value
=
[];
foreach
(
$this
->
attribute
->
getChoices
()
as
$choice
)
{
if
(
$value
&
$choice
)
{
$this
->
value
[]
=
$choice
;
}
}
}
else
{
$this
->
resetToDefault
();
}
}
function
computeLdapValue
()
{
$value
=
0
;
foreach
(
$this
->
value
as
$v
)
{
$value
|=
$v
;
}
return
$value
;
}
}
class
configInLdap
extends
simplePlugin
{
static
function
plInfo
()
:
array
...
...
@@ -77,11 +50,7 @@ class configInLdap extends simplePlugin
static
function
getAttributesInfo
()
:
array
{
global
$config
;
$plugins
=
[];
if
(
session
::
global_is_set
(
'plist'
))
{
$plugins
=
array_keys
(
session
::
global_get
(
'plist'
)
->
info
);
}
sort
(
$plugins
);
return
[
'look_n_feel'
=>
[
'name'
=>
_
(
'Look and feel'
),
...
...
@@ -392,48 +361,6 @@ class configInLdap extends simplePlugin
new
HiddenAttribute
(
'fdManagementConfig'
),
]
],
'hooks'
=>
[
'name'
=>
_
(
'Hooks'
),
'class'
=>
[
'fullwidth'
],
'attrs'
=>
[
new
OrderedArrayAttribute
(
new
CompositeAttribute
(
_
(
'Hooks that are called when specific actions happens'
),
'fdTabHook'
,
[
new
SelectAttribute
(
_
(
'Tab'
),
_
(
'The tab that this hook concerns'
),
'hookTab'
,
TRUE
,
$plugins
),
new
SelectAttribute
(
_
(
'Mode'
),
_
(
'When to call this command'
),
'hookMode'
,
TRUE
,
[
'postcreate'
,
'postremove'
,
'postmodify'
,
'precreate'
,
'preremove'
,
'premodify'
,
'check'
,
'prelock'
,
'postlock'
,
'preunlock'
,
'postunlock'
]
),
new
TextAreaAttribute
(
_
(
'Command'
),
_
(
'The command that will be called'
),
'hookCmd'
,
TRUE
)
],
'/^([^\\|]+)\\|([^\\|]+)\\|(.*)$/'
,
'%s|%s|%s'
,
''
,
// acl
_
(
'Hooks'
)
),
FALSE
,
// non-ordered
[],
TRUE
// edition
),
new
BooleanAttribute
(
_
(
'Display hook output'
),
_
(
'When enabled successful hook execution output is displayed to the user using a dialog.'
),
'fdDisplayHookOutput'
),
]
],
];
}
...
...
@@ -514,8 +441,6 @@ class configInLdap extends simplePlugin
]
);
$this
->
attributesAccess
[
'fdTabHook'
]
->
setLinearRendering
(
FALSE
);
$this
->
attributesAccess
[
'fdForceSSL'
]
->
setManagedAttributes
(
[
'disable'
=>
[
...
...
plugins/config/class_dashBoardConfig.inc
View file @
fd385981
...
...
@@ -28,6 +28,7 @@ class dashboardConfig extends simplePlugin
'plCategory'
=>
[
'configuration'
],
'plObjectClass'
=>
[
'fdDashboardPluginConf'
],
'plObjectType'
=>
[
'smallConfig'
],
'plPriority'
=>
2
,
'plProvidedAcls'
=>
parent
::
generatePlProvidedAcls
(
static
::
getAttributesInfo
())
];
...
...
plugins/config/class_hooksConfig.inc
0 → 100644
View file @
fd385981
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
hooksConfig
extends
simplePlugin
{
static
function
plInfo
()
:
array
{
return
[
'plShortName'
=>
_
(
'Hooks'
),
'plTitle'
=>
_
(
'Hooks configuration'
),
'plPriority'
=>
1
,
'plObjectType'
=>
[
'configuration'
],
'plProvidedAcls'
=>
parent
::
generatePlProvidedAcls
(
static
::
getAttributesInfo
())
];
}
static
function
getAttributesInfo
()
:
array
{
global
$config
;
$plugins
=
[];
if
(
session
::
global_is_set
(
'plist'
))
{
$plugins
=
array_keys
(
session
::
global_get
(
'plist'
)
->
info
);
}
sort
(
$plugins
);
return
[
'hooks'
=>
[
'name'
=>
_
(
'Hooks'
),
'class'
=>
[
'fullwidth'
],
'attrs'
=>
[
new
BooleanAttribute
(
_
(
'Display hook output'
),
_
(
'When enabled successful hook execution output is displayed to the user using a dialog.'
),
'fdDisplayHookOutput'
),
new
OrderedArrayAttribute
(
new
CompositeAttribute
(
_
(
'Hooks that are called when specific actions happens'
),
'fdTabHook'
,
[
new
SelectAttribute
(
_
(
'Tab'
),
_
(
'The tab that this hook concerns'
),
'hookTab'
,
TRUE
,
$plugins
),
new
SelectAttribute
(
_
(
'Mode'
),
_
(
'When to call this command'
),
'hookMode'
,
TRUE
,
[
'postcreate'
,
'postremove'
,
'postmodify'
,
'precreate'
,
'preremove'
,
'premodify'
,
'check'
,
'prelock'
,
'postlock'
,
'preunlock'
,
'postunlock'
]
),
new
TextAreaAttribute
(
_
(
'Command'
),
_
(
'The command that will be called'
),
'hookCmd'
,
TRUE
)
],
'/^([^\\|]+)\\|([^\\|]+)\\|(.*)$/'
,
'%s|%s|%s'
,
''
,
// acl
_
(
'Hooks'
)
),
FALSE
,
// non-ordered
[],
TRUE
// edition
),
]
],
];
}
function
__construct
(
$dn
=
NULL
,
$object
=
NULL
,
$parent
=
NULL
,
$mainTab
=
FALSE
)
{
global
$config
;
parent
::
__construct
(
$dn
,
$object
,
$parent
,
$mainTab
);
$this
->
attributesAccess
[
'fdTabHook'
]
->
setLinearRendering
(
FALSE
);
}
}
plugins/config/class_mainPluginsConfig.inc
View file @
fd385981
...
...
@@ -28,6 +28,7 @@ class mainPluginsConfig extends simplePlugin
'plCategory'
=>
[
'configuration'
],
'plObjectClass'
=>
[
'fusionDirectoryPluginsConf'
],
'plObjectType'
=>
[
'smallConfig'
],
'plPriority'
=>
1
,
'plProvidedAcls'
=>
parent
::
generatePlProvidedAcls
(
static
::
getAttributesInfo
())
];
...
...
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