Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Helmholtz Centre for Environmental Research – UFZ
IT
RDM
BioMe
tmd
frontend
Commits
ad191318
Commit
ad191318
authored
3 years ago
by
Chris Steinmann
Browse files
Options
Downloads
Patches
Plain Diff
#301
add query for userRoles
parent
51f62f9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!314
Merging for 0.8.1 Hotfix
,
!286
Resolve "Transektsteckbrief: Zuweisung/Änderungsmöglichkeit eines Nutzers zum Transekt und seine Rolle zum Transekt"
Pipeline
#421037
failed
3 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/helper/transect.service.ts
+37
-1
37 additions, 1 deletion
app/src/helper/transect.service.ts
app/src/views/TransectProfile.ts
+22
-0
22 additions, 0 deletions
app/src/views/TransectProfile.ts
with
59 additions
and
1 deletion
app/src/helper/transect.service.ts
+
37
−
1
View file @
ad191318
...
...
@@ -298,6 +298,8 @@ export class TransectService {
/**
* Update users for a transect
* @param transectId id of the transect e.g ("/transects/1")
* @param userIds ids of users that should be assigned to this transect (in a string array)
*/
public
updateUsersForTransect
=
async
(
transectId
:
string
,
userIds
:
string
[])
=>
{
let
userString
=
""
;
...
...
@@ -323,7 +325,41 @@ export class TransectService {
}
}
}
}`
}`
;
return
await
ApiService
.
getInstance
().
postQuery
(
query
);
}
/**
* Update roles for a specific user
* @param userId id of the user which roles are to be changed e.g ("/tmd/api/index.php/users/1")
* @param userRoles roles that should be assigned to this user (in a string array)
*/
public
updateUserRolesForTransect
=
async
(
userId
:
string
,
userRoles
:
string
[])
=>
{
let
userRolesString
=
""
;
for
(
const
userId
of
userRoles
)
{
userRolesString
=
userRolesString
+
userId
+
"
,
"
;
};
const
query
=
`mutation {
updateUser (
input: {
id: "
${
userId
}
"
userRoles: [
"
${
userRolesString
}
"
]
}
) {
user {
id,
username,
userRoles {
collection {
id,
label
}
}
}
}
}`
;
return
await
ApiService
.
getInstance
().
postQuery
(
query
);
}
}
This diff is collapsed.
Click to expand it.
app/src/views/TransectProfile.ts
+
22
−
0
View file @
ad191318
...
...
@@ -167,6 +167,28 @@ export default class TransectManagement extends Vue {
});
}
private
async
assignUserRolesToUser
(
userId
:
string
)
{
const
userRoleIds
:
string
[]
=
[];
for
(
const
userRole
of
this
.
selectedRoles
)
{
userRoleIds
.
push
(
userRole
.
toString
());
}
return
await
TransectService
.
getInstance
().
updateUserRolesForTransect
(
userId
,
userRoleIds
)
.
then
((
response
:
AxiosResponse
)
=>
{
const
isValidReponse
=
response
&&
response
.
data
&&
response
.
data
.
data
;
if
(
isValidReponse
)
{
if
(
response
.
data
.
data
.
errors
)
{
this
.
showFailAlert
(
response
.
data
.
data
.
errors
[
0
]);
}
else
{
this
.
showConfirmationAlert
();
this
.
requestTransectProfileData
();
}
}
this
.
delay
(
2000
).
then
(()
=>
{
this
.
showAssignDialog
=
false
;
});
});
}
private
delay
(
millis
:
number
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
millis
));
}
...
...
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