Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lemonldap-ng
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
258
Issues
258
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
c964cec6
Commit
c964cec6
authored
Feb 06, 2016
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish cli (Closes: #921)
parent
2523d816
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
12 deletions
+97
-12
Makefile
Makefile
+3
-7
lemonldap-ng-common/MANIFEST
lemonldap-ng-common/MANIFEST
+1
-0
lemonldap-ng-common/lib/Lemonldap/NG/Common/Cli.pm
lemonldap-ng-common/lib/Lemonldap/NG/Common/Cli.pm
+77
-0
lemonldap-ng-common/scripts/lemonldap-ng-cli
lemonldap-ng-common/scripts/lemonldap-ng-cli
+16
-4
lemonldap-ng-manager/t/14-bad-changes-in-conf.t
lemonldap-ng-manager/t/14-bad-changes-in-conf.t
+0
-1
No files found.
Makefile
View file @
c964cec6
...
...
@@ -427,21 +427,17 @@ install_bin: install_conf_dir
${SRCCOMMONDIR}
/scripts/lmMigrateConfFiles2ini
\
${SRCCOMMONDIR}
/scripts/rotateOidcKeys
\
${SRCMANAGERDIR}
/scripts/lmConfigEditor
\
${SRC
MANAGER
DIR}
/scripts/lemonldap-ng-cli
\
${SRC
COMMON
DIR}
/scripts/lemonldap-ng-cli
\
$(RBINDIR)
@
if
[
!
"
$(APACHEUSER)
"
]
;
then
\
$(PERL)
-i
-pe
's#__APACHEUSER__#nobody#g;'
$(RBINDIR)
/lmConfigEditor
;
\
$(PERL)
-i
-pe
's#__APACHEUSER__#nobody#g;'
$(RBINDIR)
/lemonldap-ng-cli
;
\
else
\
$(PERL)
-i
-pe
's#__APACHEUSER__#
$(APACHEUSER)
#g;'
$(RBINDIR)
/lmConfigEditor
;
\
$(PERL)
-i
-pe
's#__APACHEUSER__#
$(APACHEUSER)
#g;'
$(RBINDIR)
/lemonldap-ng-cli
;
\
fi
@
if
[
!
"
$(APACHEGROUP)
"
]
;
then
\
$(PERL)
-i
-pe
's#__APACHEGROUP__#nobody#g;'
$(RBINDIR)
/lmConfigEditor
;
\
$(PERL)
-i
-pe
's#__APACHEGROUP__#nobody#g;'
$(RBINDIR)
/lemonldap-ng-cli
;
\
else
\
$(PERL)
-i
-pe
's#__APACHEGROUP__#
$(APACHEGROUP)
#g;'
$(RBINDIR)
/lmConfigEditor
;
\
$(PERL)
-i
-pe
's#__APACHEGROUP__#
$(APACHEGROUP)
#g;'
$(RBINDIR)
/lemonldap-ng-cli
;
\
fi
@
chmod
+x
$(RBINDIR)
/
*
...
...
@@ -894,7 +890,7 @@ debian-diff:
@
$(DIFF)
$(SRCMANAGERDIR)
/site/static
$(DIFFPREFIX)
/var/lib/lemonldap-ng/manager/static
||
true
@
$(DIFF)
$(SRCMANAGERDIR)
/site/templates
$(DIFFPREFIX)
/var/lib/lemonldap-ng/manager/templates
||
true
@
$(DIFF)
--ignore-matching-lines
=
'set.*get.*\[2\]'
$(SRCMANAGERDIR)
/scripts/lmConfigEditor
$(DIFFPREFIX)
/usr/share/lemonldap-ng/bin/lmConfigEditor
||
true
@
$(DIFF)
--ignore-matching-lines
=
'giveUpPrivileges'
$(SRC
MANAGER
DIR)
/scripts/lemonldap-ng-cli
$(DIFFPREFIX)
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli
||
true
@
$(DIFF)
--ignore-matching-lines
=
'giveUpPrivileges'
$(SRC
COMMON
DIR)
/scripts/lemonldap-ng-cli
$(DIFFPREFIX)
/usr/share/lemonldap-ng/bin/lemonldap-ng-cli
||
true
default-diff
:
@
# Portal
...
...
@@ -924,7 +920,7 @@ default-diff:
@
$(DIFF)
$(SRCMANAGERDIR)
/site/static
$(LMPREFIX)
/htdocs/manager/static
||
true
@
$(DIFF)
$(SRCMANAGERDIR)
/site/templates
$(LMPREFIX)
/htdocs/manager/templates
||
true
@
$(DIFF)
--ignore-matching-lines
=
'set.*get.*\[2\]'
$(SRCMANAGERDIR)
/scripts/lmConfigEditor
$(LMPREFIX)
/bin/lmConfigEditor
||
true
@
$(DIFF)
--ignore-matching-lines
=
'giveUpPrivileges'
$(SRC
MANAGER
DIR)
/scripts/lemonldap-ng-cli
$(LMPREFIX)
/bin/lemonldap-ng-cli
||
true
@
$(DIFF)
--ignore-matching-lines
=
'giveUpPrivileges'
$(SRC
COMMON
DIR)
/scripts/lemonldap-ng-cli
$(LMPREFIX)
/bin/lemonldap-ng-cli
||
true
test-diff
:
@
for
file
in
`
find lemonldap-ng-
*
/lib
-type
f
`
;
do
\
...
...
lemonldap-ng-common/MANIFEST
View file @
c964cec6
...
...
@@ -11,6 +11,7 @@ lib/Lemonldap/NG/Common/Captcha.pm
lib/Lemonldap/NG/Common/CGI.pm
lib/Lemonldap/NG/Common/CGI/SOAPServer.pm
lib/Lemonldap/NG/Common/CGI/SOAPService.pm
lib/Lemonldap/NG/Common/Cli.pm
lib/Lemonldap/NG/Common/Conf.pm
lib/Lemonldap/NG/Common/Conf/_DBI.pm
lib/Lemonldap/NG/Common/Conf/CDBI.pm
...
...
lemonldap-ng-common/lib/Lemonldap/NG/Common/Cli.pm
0 → 100644
View file @
c964cec6
package
Lemonldap::NG::Common::
Cli
;
use
strict
;
use
Mouse
;
use
Data::
Dumper
;
use
Lemonldap::NG::Common::
Conf
;
has
confAccess
=>
(
is
=>
'
rw
',
isa
=>
'
HashRef
',
builder
=>
sub
{
my
$res
=
Lemonldap::NG::Common::
Conf
->
new
(
{
confFile
=>
$_
[
0
]
->
{
iniFile
}
}
);
die
$
Lemonldap::NG::Common::Conf::
msg
unless
(
$res
);
return
$res
;
},
);
has
cfgNum
=>
(
is
=>
'
rw
',
isa
=>
'
Int
',
);
sub
info
{
my
(
$self
)
=
@_
;
my
$conf
=
$self
->
confAccess
(
{
cfgNum
=>
$self
->
cfgNum
,
raw
=>
1
}
)
or
die
$
Lemonldap::NG::Common::Conf::
msg
;
print
qq{
Num : $conf->{cfgNum}
Author : $conf->{cfgAuthor}
Author IP: $conf->{cfgAuthorIP}
Date : $conf->{cfgDate}
Log : $conf->{cfgLog}
}
;
}
sub
updateCache
{
my
$self
=
shift
;
my
$conf
=
$self
->
confAccess
(
{
noCache
=>
1
,
raw
=>
1
}
);
die
"
Must not be launched as root
"
unless
(
$>
);
print
STDERR
qq{Cache updated to configuration $conf->{cfgNum} for user $>\n}
;
}
sub
run
{
my
$self
=
shift
;
# Options simply call corresponding accessor
my
$args
;
while
(
$_
[
0
]
=~
s/^--?//
)
{
my
$k
=
shift
;
my
$v
=
shift
;
if
(
ref
$self
)
{
eval
{
$self
->
$k
(
$v
)
};
if
(
$@
)
{
die
"
Unknown option -
$k
or bad value ($@)
";
}
}
else
{
$args
->
{
$k
}
=
$v
;
}
}
unless
(
ref
$self
)
{
$self
=
$self
->
new
(
$args
);
}
unless
(
@
_
)
{
die
'
nothing to do, aborting
';
}
$self
->
confAccess
()
->
lastCfg
()
unless
(
$self
->
cfgNum
);
my
$action
=
shift
;
unless
(
$action
=~
/^(?:info|update-cache)$/
)
{
die
"
unknown action
$action
. Only info or update are accepted
";
}
$self
->
$action
(
@
_
);
}
1
;
lemonldap-ng-common/scripts/lemonldap-ng-cli
View file @
c964cec6
...
...
@@ -3,14 +3,25 @@
use
warnings
;
use
strict
;
if
(
$ARGV
[
0
]
=~
/^(?:[gs]et|(?:add|del)Key)$/
)
{
my
$action
;
for
(
my
$i
=
0
;
$i
<
@ARGV
;
$i
++
)
{
if
(
$ARGV
[
$i
]
=~
/^-/
)
{
$i
++
;
next
;
}
$action
=
$ARGV
[
$i
];
last
;
}
if
(
$action
=~
/^(?:[gs]et|(?:add|del)Key)$/
)
{
eval
{
require
Lemonldap::NG::Manager::
Cli
;
};
die
'
Manager libraries not available, aborting
'
if
(
$@
);
Lemonldap::NG::Manager::
Cli
->
run
(
@ARGV
);
}
elsif
(
$
ARGV
[
0
]
=~
/^(?:info|update-cache)$/
)
{
elsif
(
$
action
=~
/^(?:info|update-cache)$/
)
{
eval
{
require
Lemonldap::NG::Common::
Cli
;
};
die
'
Lemonldap::NG common libraries not available, aborting
'
if
(
$@
);
die
"
Lemonldap::NG common libraries not available, aborting ($@)
"
if
(
$@
);
Lemonldap::NG::Common::
Cli
->
run
(
@ARGV
);
}
else
{
...
...
@@ -29,6 +40,7 @@ Available actions:
- addKey <key> <subkey> <value> : add or set a subkey in a parameter
- delKey <key> <subkey> : delete subkey of a parameter
See Lemonldap::NG::Common::Cli(3) or Lemonldap::NG::Manager::CLi(3) for more}
;
See Lemonldap::NG::Common::Cli(3) or Lemonldap::NG::Manager::CLi(3) for more
}
;
}
lemonldap-ng-manager/t/14-bad-changes-in-conf.t
View file @
c964cec6
...
...
@@ -26,7 +26,6 @@ ok( $resBody->{result} == 0, "JSON response contains \"result:0\"" )
ok
(
@
{
$resBody
->
{
details
}
->
{
__errors__
}
}
==
1
,
'
1 error detected
'
);
count
(
5
);
print
STDERR
Dumper
(
$resBody
);
done_testing
(
count
()
);
...
...
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