Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
20c59d22
Commit
20c59d22
authored
9 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
Added a command line utility allowing bootstrapping of admin users.
parent
369c71f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmdline/CMakeLists.txt
+8
-0
8 additions, 0 deletions
cmdline/CMakeLists.txt
cmdline/CTAAddAdminUser.cpp
+46
-0
46 additions, 0 deletions
cmdline/CTAAddAdminUser.cpp
with
54 additions
and
0 deletions
cmdline/CMakeLists.txt
+
8
−
0
View file @
20c59d22
...
...
@@ -6,3 +6,11 @@ include_directories (${XROOTD_INCLUDE_DIR} ${XROOTD_PRIVATE_INCLUDE_DIR} ${CMAKE
add_executable
(
cta CTACmdMain.cpp CTACmd.cpp
)
target_link_libraries
(
cta
${
XROOTD_XRDCL_LIB
}
ctacommon cryptopp
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/tapeserver/
)
add_executable
(
ctaAddAdminUser CTAAddAdminUser.cpp
)
target_link_libraries
(
ctaAddAdminUser castorcommon castorserver castorlog
CTAObjectStore ctaOStoreSchedulerDB ctacommon castorutils protobuf ctascheduler
ctanameserver
)
This diff is collapsed.
Click to expand it.
cmdline/CTAAddAdminUser.cpp
0 → 100644
+
46
−
0
View file @
20c59d22
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include
<exception>
#include
"objectstore/BackendVFS.hpp"
#include
"tapeserver/castor/common/CastorConfiguration.hpp"
#include
"tapeserver/castor/log/DummyLogger.hpp"
#include
"scheduler/OStoreDB/OStoreDB.hpp"
#include
"common/SecurityIdentity.hpp"
#include
<iostream>
int
main
(
int
argc
,
char
**
argv
)
{
try
{
if
(
argc
!=
3
)
throw
std
::
runtime_error
(
"In ctaAddAdminUser: expected 2 arguments (uid, gid)"
);
uid_t
uid
=
atol
(
argv
[
1
]);
gid_t
gid
=
atol
(
argv
[
2
]);
castor
::
common
::
CastorConfiguration
&
castorConf
=
castor
::
common
::
CastorConfiguration
::
getConfig
();
castor
::
log
::
DummyLogger
log
(
"ctaAddAdminUser"
);
cta
::
objectstore
::
BackendVFS
be
(
castorConf
.
getConfEntString
(
"TapeServer"
,
"ObjectStoreBackendPath"
,
&
log
));
be
.
noDeleteOnExit
();
cta
::
OStoreDB
db
(
be
);
db
.
createAdminUser
(
cta
::
SecurityIdentity
(
cta
::
UserIdentity
(
getuid
(),
getgid
()),
castor
::
utils
::
getHostName
()),
cta
::
UserIdentity
(
uid
,
gid
),
""
);
}
catch
(
std
::
exception
&
e
)
{
std
::
cerr
<<
"In ctaAddAdminUser: got an exception: "
<<
e
.
what
()
<<
std
::
endl
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment