Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Project
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
apis
Project
Merge requests
!19
New: Add additional functionality for resource and new resource fields
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New: Add additional functionality for resource and new resource fields
Topic/283-resourceEnhancement
into
Product/243-addEditProject
Overview
0
Commits
6
Pipelines
1
Changes
20
Merged
Benedikt Heinrichs
requested to merge
Topic/283-resourceEnhancement
into
Product/243-addEditProject
5 years ago
Overview
0
Commits
6
Pipelines
1
Changes
20
Expand
coscine/issues#283
0
0
Merge request reports
Compare
Product/243-addEditProject
Product/243-addEditProject (base)
and
latest version
latest version
79c8b95e
6 commits,
5 years ago
20 files
+
704
−
115
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
20
Search (e.g. *.vue) (Ctrl+P)
src/Project/Controllers/DataSourceController.cs
+
16
−
10
Options
@@ -75,11 +75,17 @@ namespace Coscine.Api.Project.Controllers
if
(
resource
.
Type
.
DisplayName
.
ToLower
()
==
"rds"
)
{
authHeader
=
BuildRdsAuthHeader
(
resource
.
ExternalId
);
RDSResourceTypeModel
rdsResourceTypeModel
=
new
RDSResourceTypeModel
();
var
rdsResourceType
=
rdsResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
authHeader
=
BuildRdsAuthHeader
(
rdsResourceType
);
}
else
if
(
resource
.
Type
.
DisplayName
.
ToLower
()
==
"gitlab"
)
{
authHeader
=
BuildGitlabAuthHeader
(
resource
.
ExternalId
,
resource
.
Url
);
GitlabResourceTypeModel
gitlabResourceTypeModel
=
new
GitlabResourceTypeModel
();
var
gitlabResourceType
=
gitlabResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
authHeader
=
BuildGitlabAuthHeader
(
gitlabResourceType
);
}
if
(
authHeader
!=
null
)
@@ -146,39 +152,39 @@ namespace Coscine.Api.Project.Controllers
return
_jwtHandler
.
GenerateJwtToken
(
payload
);
}
private
string
BuildRdsAuthHeader
(
string
bucketnam
e
)
private
string
BuildRdsAuthHeader
(
RDSResourceType
rdsResourceTyp
e
)
{
var
auth
=
new
Dictionary
<
string
,
object
>();
var
credentials
=
new
Dictionary
<
string
,
object
>
{
{
"access_key"
,
_configuration
.
GetString
(
"coscine/global/rds_access_key"
)
},
{
"secret_key"
,
_configuration
.
GetString
(
"coscine/global/rds_secret_key"
)
}
{
"access_key"
,
rdsResourceType
.
AccessKey
},
{
"secret_key"
,
rdsResourceType
.
SecretKey
}
};
var
settings
=
new
Dictionary
<
string
,
object
>
{
{
"bucket"
,
b
ucket
n
ame
}
{
"bucket"
,
rdsResourceType
.
B
ucket
N
ame
}
};
return
BuildWaterbutlerPayload
(
auth
,
credentials
,
settings
);
}
private
string
BuildGitlabAuthHeader
(
string
externalId
,
string
url
)
private
string
BuildGitlabAuthHeader
(
GitlabResourceType
gitlabResourceType
)
{
var
auth
=
new
Dictionary
<
string
,
object
>();
var
credentials
=
new
Dictionary
<
string
,
object
>
{
{
"token"
,
_configuration
.
GetString
(
"coscine/global/gitlabt
oken
"
)
}
{
"token"
,
gitlabResourceType
.
T
oken
}
};
var
settings
=
new
Dictionary
<
string
,
object
>
{
{
"owner"
,
"Tester"
},
{
"repo"
,
u
rl
},
{
"repo_id"
,
externalId
},
{
"repo"
,
gitlabResourceType
.
RepositoryU
rl
},
{
"repo_id"
,
gitlabResourceType
.
RepositoryNumber
},
{
"host"
,
"https://git.rwth-aachen.de"
}
};
Loading