Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2-giiant
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dmstr
yii2-giiant
Commits
f8097fe6
Commit
f8097fe6
authored
Jan 07, 2016
by
Yii-developer
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
cc73b483
' into ak
parents
cda01ff3
cc73b483
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
20 deletions
+35
-20
.gitlab-ci.yml
.gitlab-ci.yml
+3
-1
controller-rest.php
src/generators/crud/default/controller-rest.php
+12
-8
bash.sh
tests/bash.sh
+7
-0
env.sh
tests/env.sh
+11
-0
init.sh
tests/init.sh
+1
-7
run.sh
tests/run.sh
+1
-4
No files found.
.gitlab-ci.yml
View file @
f8097fe6
before_script
:
-
export CI_BUILD_REF_NAME_NORMALIZED=$(echo ${CI_BUILD_REF_NAME} | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')
-
export CI_APP_VOLUME=${CI_PROJECT_DIR}
-
export COMPOSE_PROJECT_NAME=buildref${CI_BUILD_REF}${CI_BUILD_REF_NAME}
-
export COMPOSE_PROJECT_NAME=buildref${CI_BUILD_REF}${CI_BUILD_REF_NAME
_NORMALIZED
}
-
mv tests/docker-compose.ci.override.yml tests/docker-compose.override.yml
-
cd tests
-
sh ./env.sh
build
:
stage
:
build
...
...
src/generators/crud/default/controller-rest.php
View file @
f8097fe6
...
...
@@ -14,6 +14,7 @@ namespace <?= $generator->controllerNs ?>\api;
*/
use yii\filters\AccessControl;
use yii\helpers\ArrayHelper;
class
<?=
$controllerClassName
?>
extends \yii\rest\ActiveController
{
...
...
@@ -24,17 +25,20 @@ class <?= $controllerClassName ?> extends \yii\rest\ActiveController
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);},
return ArrayHelper::merge(
parent::behaviors(),
[
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'matchCallback' => function ($rule, $action) {return \Yii::$app->user->can($this->module->id . '_' . $this->id . '_' . $action->id, ['route' => true]);},
]
]
]
]
]
;
)
;
}
<?php
endif
;
?>
}
tests/bash.sh
0 → 100644
View file @
f8097fe6
#!/usr/bin/env bash
set
-e
.
./env.sh
${
DOCKER_COMPOSE
}
run
--rm
php bash
tests/env.sh
0 → 100644
View file @
f8097fe6
#!/usr/bin/env bash
echo
"Setting ENV variables..."
export
GIIANT_TEST_DB
=
${
GIIANT_TEST_DB
-sakila
}
export
CI_APP_VOLUME
=
${
CI_APP_VOLUME
-..
}
export
COMPOSE_PROJECT_NAME
=
${
COMPOSE_PROJECT_NAME
-giiant
}
export
DOCKER_COMPOSE
=
"docker-compose --x-networking"
# replace the stack name in the yml configuration for isolated CI stacks
sed
-i
.bak s/giiant_/
${
COMPOSE_PROJECT_NAME
}
_/ acceptance.suite.yml
tests/init.sh
View file @
f8097fe6
...
...
@@ -2,13 +2,7 @@
set
-e
export
GIIANT_TEST_DB
=
${
GIIANT_TEST_DB
-sakila
}
export
CI_APP_VOLUME
=
${
CI_APP_VOLUME
-..
}
export
COMPOSE_PROJECT_NAME
=
${
COMPOSE_PROJECT_NAME
-giiant
}
DOCKER_COMPOSE
=
"docker-compose --x-networking"
# replace the stack name in the yml configuration for isolated CI stacks
sed
-i
.bak s/giiant_/
${
COMPOSE_PROJECT_NAME
}
_/ acceptance.suite.yml
.
./env.sh
${
DOCKER_COMPOSE
}
kill
${
DOCKER_COMPOSE
}
rm
-fv
...
...
tests/run.sh
View file @
f8097fe6
...
...
@@ -2,10 +2,7 @@
set
-e
export
GIIANT_TEST_DB
=
${
GIIANT_TEST_DB
-sakila
}
export
CI_APP_VOLUME
=
${
CI_APP_VOLUME
-..
}
export
COMPOSE_PROJECT_NAME
=
${
COMPOSE_PROJECT_NAME
-giiant
}
DOCKER_COMPOSE
=
"docker-compose --x-networking"
.
./env.sh
# replace the stack name in the yml configuration for isolated CI stacks
sed
-i
.bak s/giiant_/
${
COMPOSE_PROJECT_NAME
}
_/ acceptance.suite.yml
...
...
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