Skip to content

Commit 9ba1c5f

Browse files
author
Lee Hicks
committed
Merge branch 'release/0.8.1'
2 parents 8e902d2 + bd9803c commit 9ba1c5f

6 files changed

Lines changed: 65 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
6+
## [0.8.1] - 2018-01-25
7+
### Added
8+
- DF-1293 Added implements_access_list config option for overriding swagger def for role service access
9+
### Fixed
10+
- DF-1287 Fixed NodeJS (and Python) script execution for large script, making script size limit check configurable
11+
- DF-1293 Fixed role service access components when swagger def is supplied
12+
613
## [0.8.0] - 2017-12-28
714
### Added
815
- DF-1254 Allowed setting response headers in all cases
@@ -75,7 +82,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7582
## 0.1.0 - 2016-11-30
7683
First official release working with the new [dreamfactory](https://github.com/dreamfactorysoftware/dreamfactory) project.
7784

78-
[Unreleased]: https://github.com/dreamfactorysoftware/df-script/compare/0.8.0...HEAD
85+
[Unreleased]: https://github.com/dreamfactorysoftware/df-script/compare/0.8.1...HEAD
86+
[0.8.1]: https://github.com/dreamfactorysoftware/df-script/compare/0.8.0...0.8.1
7987
[0.8.0]: https://github.com/dreamfactorysoftware/df-script/compare/0.7.0...0.8.0
8088
[0.7.0]: https://github.com/dreamfactorysoftware/df-script/compare/0.6.2...0.7.0
8189
[0.6.2]: https://github.com/dreamfactorysoftware/df-script/compare/0.6.1...0.6.2

database/migrations/2017_08_29_203705_update_script_tables_for_service_linking.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function up()
1919
// so set the default no action and clear out created/modified by another user when deleting a user.
2020
$onDelete = (('sqlsrv' === $driver) ? 'no action' : 'set null');
2121

22-
if(Schema::hasTable('script_config') && !Schema::hasColumn('script_config', 'storage_service_id')){
22+
if (Schema::hasTable('script_config') && !Schema::hasColumn('script_config', 'storage_service_id')) {
2323
Schema::table('script_config', function (Blueprint $t) use ($onDelete) {
2424
$t->string('scm_reference')->nullable()->after('config');
2525
$t->string('scm_repository')->nullable()->after('config');
@@ -29,7 +29,7 @@ public function up()
2929
});
3030
}
3131

32-
if(Schema::hasTable('event_script') && !Schema::hasColumn('event_script', 'storage_service_id')){
32+
if (Schema::hasTable('event_script') && !Schema::hasColumn('event_script', 'storage_service_id')) {
3333
Schema::table('event_script', function (Blueprint $t) use ($onDelete) {
3434
$t->string('scm_reference')->nullable()->after('config');
3535
$t->string('scm_repository')->nullable()->after('config');
@@ -47,19 +47,21 @@ public function up()
4747
*/
4848
public function down()
4949
{
50-
if(Schema::hasTable('script_config') && Schema::hasColumn('script_config', 'storage_service_id')) {
51-
Schema::table('script_config', function (Blueprint $t){
50+
if (Schema::hasTable('script_config') && Schema::hasColumn('script_config', 'storage_service_id')) {
51+
Schema::table('script_config', function (Blueprint $t) {
5252
$t->dropColumn('storage_service_id');
5353
$t->dropColumn('storage_path');
5454
$t->dropColumn('scm_reference');
55+
$t->dropColumn('scm_repository');
5556
});
5657
}
5758

58-
if(Schema::hasTable('event_script') && Schema::hasColumn('event_script', 'storage_service_id')) {
59-
Schema::table('event_script', function (Blueprint $t){
59+
if (Schema::hasTable('event_script') && Schema::hasColumn('event_script', 'storage_service_id')) {
60+
Schema::table('event_script', function (Blueprint $t) {
6061
$t->dropColumn('storage_service_id');
6162
$t->dropColumn('storage_path');
6263
$t->dropColumn('scm_reference');
64+
$t->dropColumn('scm_repository');
6365
});
6466
}
6567
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class ScriptImplementsAccessList extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('script_config', function (Blueprint $table) {
17+
$table->boolean('implements_access_list')->default(0)->after('queued');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('script_config', function (Blueprint $table) {
29+
$table->dropColumn('implements_access_list');
30+
});
31+
}
32+
}

src/Engines/ExecutedEngine.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public static function loadScriptingModule($module)
137137

138138
protected function getWritablePath($identifier)
139139
{
140+
$identifier = uniqid($identifier . "_", true);
140141
$filePath = storage_path('scripting' . DIRECTORY_SEPARATOR . $identifier);
141142
if ($this->fileExtension) {
142143
$filePath .= '.' . $this->fileExtension;

src/Models/ScriptConfig.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ class ScriptConfig extends BaseServiceConfigModel
2727
'storage_service_id',
2828
'scm_reference',
2929
'scm_repository',
30-
'storage_path'
30+
'storage_path',
31+
'implements_access_list',
3132
];
3233

3334
// deprecated, service has type designation now
3435
protected $hidden = ['type'];
3536

3637
protected $casts = [
37-
'service_id' => 'integer',
38-
'config' => 'array',
39-
'queued' => 'boolean',
40-
'storage_service_id' => 'integer',
38+
'service_id' => 'integer',
39+
'config' => 'array',
40+
'queued' => 'boolean',
41+
'storage_service_id' => 'integer',
42+
'implements_access_list' => 'boolean'
4143
];
4244

4345
/**
@@ -88,8 +90,6 @@ protected static function prepareConfigSchemaField(array &$schema)
8890
break;
8991
case 'queued':
9092
$schema['label'] = 'Queue For Later Execution';
91-
$schema['type'] = 'boolean';
92-
$schema['default'] = false;
9393
$schema['description'] =
9494
'Select to queue the script for later execution ' .
9595
'(queuing success or failure returned to client immediately), ' .
@@ -113,6 +113,12 @@ protected static function prepareConfigSchemaField(array &$schema)
113113
case 'storage_service_id':
114114
$schema['type'] = 'integer';
115115
break;
116+
case 'implements_access_list':
117+
$schema['label'] = 'Script Implements Access List';
118+
$schema['description'] =
119+
'By default, the access list is generated by the OpenAPI specification provided. ' .
120+
'To override, check this and implement the access list in the script.';
121+
break;
116122
}
117123
}
118124
}

src/Services/Script.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ public function getAccessList()
162162
$paths = array_keys((array)array_get($this->getApiDoc(), 'paths'));
163163
foreach ($paths as $path) {
164164
// drop service from path
165-
if (!empty($path = ltrim(strstr(ltrim($path, '/'), '/'), '/'))) {
165+
if (!empty($path = ltrim($path, '/'))) {
166166
$list[] = $path;
167-
$path = explode("/", $path);
167+
$path = explode('/', $path);
168168
end($path);
169169
while ($level = prev($path)) {
170170
$list[] = $level . '/*';

0 commit comments

Comments
 (0)