Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
UI
DojoCLI
Commits
95ffba7e
Commit
95ffba7e
authored
2 years ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
EnonceCreate => Add template access check
parent
85e27950
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
NodeApp/src/commander/enonce/EnonceCreateCommand.ts
+22
-7
22 additions, 7 deletions
NodeApp/src/commander/enonce/EnonceCreateCommand.ts
with
22 additions
and
7 deletions
NodeApp/src/commander/enonce/EnonceCreateCommand.ts
+
22
−
7
View file @
95ffba7e
import
CommanderCommand
from
'
../CommanderCommand
'
;
import
GitlabUser
from
'
../../models/GitlabUser
'
;
import
chalk
from
'
chalk
'
;
import
ora
from
'
ora
'
;
import
GitlabManager
from
'
../../managers/GitlabManager
'
;
import
Config
from
'
../../config/Config
'
;
import
SessionManager
from
'
../../managers/SessionManager
'
;
import
GitlabUser
from
'
../../shared/types/Gitlab/GitlabUser
'
;
import
DojoBackendManager
from
'
../../managers/DojoBackendManager
'
;
import
Toolbox
from
'
../../shared/Toolbox
'
;
class
EnonceCreateCommand
extends
CommanderCommand
{
...
...
@@ -28,6 +29,7 @@ class EnonceCreateCommand extends CommanderCommand {
.
requiredOption
(
'
-n, --name <name>
'
,
'
name of the enonce.
'
)
.
option
(
'
-i, --members_id <ids...>
'
,
'
list of members ids (teaching staff) to add to the repository.
'
)
.
option
(
'
-m, --members_username <usernames...>
'
,
'
list of members username (teaching staff) to add to the repository.
'
)
.
option
(
'
-t, --template <string>
'
,
'
id or url of the template (http(s) and ssh urls are possible).
'
)
.
action
(
this
.
commandAction
.
bind
(
this
));
}
...
...
@@ -101,8 +103,21 @@ class EnonceCreateCommand extends CommanderCommand {
if
(
!
members
)
{
return
;
}
if
(
options
.
template
)
{
let
templateIdOrNamespace
:
string
=
options
.
template
;
if
(
Number
.
isNaN
(
Number
(
templateIdOrNamespace
))
)
{
templateIdOrNamespace
=
encodeURIComponent
(
Toolbox
.
urlToPath
(
templateIdOrNamespace
));
}
if
(
!
await
DojoBackendManager
.
checkTemplateAccess
(
templateIdOrNamespace
)
)
{
return
;
}
}
}
}
}
...
...
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