Skip to content

Commit

Permalink
Merge pull request #13 from ortus-boxlang/development
Browse files Browse the repository at this point in the history
beta 20 compat
  • Loading branch information
lmajano authored Oct 28, 2024
2 parents a656193 + abad0f3 commit 9da9703
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 9 deletions.
15 changes: 14 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Change to `toUnmodifiable` from `toImmutable`

### Added

- `cftoken` migration to comply with CFML engines.
- `cfid` migration to comply with CFML engines.

## [1.9.0] - 2024-10-15

## [1.8.0] - 2024-10-10

### Fixed
Expand Down Expand Up @@ -83,7 +94,9 @@ transpiler = {

- First iteration of this module

[Unreleased]: https://github.com/ortus-boxlang/bx-compat-cfml/compare/v1.8.0...HEAD
[Unreleased]: https://github.com/ortus-boxlang/bx-compat-cfml/compare/v1.9.0...HEAD

[1.9.0]: https://github.com/ortus-boxlang/bx-compat-cfml/compare/v1.8.0...v1.9.0

[1.8.0]: https://github.com/ortus-boxlang/bx-compat-cfml/compare/v1.7.0...v1.8.0

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Thu Oct 10 20:35:15 UTC 2024
#Tue Oct 15 15:37:17 UTC 2024
boxlangVersion=1.0.0-snapshot
jdkVersion=21
version=1.9.0
version=1.10.0
group=ortus.boxlang
4 changes: 2 additions & 2 deletions src/main/bx/interceptors/AdobeServerScope.bx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import java:ortus.boxlang.runtime.types.immutable.ImmutableStruct;
import java:ortus.boxlang.runtime.types.unmodifiable.UnmodifiableStruct;
import java:ortus.boxlang.runtime.scopes.Key;

/**
Expand Down Expand Up @@ -57,7 +57,7 @@ class{
"productversion" : "2023,0,06,330617",
"rootdir" : "'",
"updatelevel" : "0"
}.toImmutable();
}.toUnmodifiable();
}

}
6 changes: 3 additions & 3 deletions src/main/bx/interceptors/LuceeServerScope.bx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import java:ortus.boxlang.runtime.types.immutable.ImmutableStruct;
import java:ortus.boxlang.runtime.types.unmodifiable.UnmodifiableStruct;
import java:ortus.boxlang.runtime.scopes.Key;

/**
Expand Down Expand Up @@ -52,7 +52,7 @@ class{
"productlevel" : "os",
"productname" : "Lucee",
"productversion" : "2016,0,03,300357"
}.toImmutable();
}.toUnmodifiable();

// Add lucee struct
data.scope.lucee = {
Expand All @@ -64,7 +64,7 @@ class{
"version" : "6.0.0",
"versionName" : "Lucee",
"versionNameExplanation" : ""
}.toImmutable();
}.toUnmodifiable();
}

}
2 changes: 1 addition & 1 deletion src/main/bx/interceptors/QueryCompat.bx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import java:ortus.boxlang.runtime.types.immutable.ImmutableStruct;
import java:ortus.boxlang.runtime.types.unmodifiable.UnmodifiableStruct;
import java:ortus.boxlang.runtime.scopes.Key;
import java:ortus.boxlang.runtime.jdbc.QueryOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* [BoxLang]
*
* Copyright [2023] [Ortus Solutions, Corp]
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package ortus.boxlang.modules.compat.interceptors;

import ortus.boxlang.runtime.application.Session;
import ortus.boxlang.runtime.events.BaseInterceptor;
import ortus.boxlang.runtime.events.InterceptionPoint;
import ortus.boxlang.runtime.scopes.Key;
import ortus.boxlang.runtime.scopes.SessionScope;
import ortus.boxlang.runtime.types.IStruct;

/**
* Listens to when sessions get created to manipulate them for CFML compatibility
*/
public class SessionListener extends BaseInterceptor {

/**
* The URL token format
* MOVE TO COMPAT MODULE
*/
public static final String URL_TOKEN_FORMAT = "CFID=%s";

/**
* Intercept BIF Invocation
*
* @param interceptData The struct containing the context and arguments of the BIF Invocation
*/
@InterceptionPoint
public void onSessionCreated( IStruct interceptData ) {
// Get the session from the interceptData
Session userSession = ( Session ) interceptData.get( Key.session );
SessionScope sessionScope = userSession.getSessionScope();
Key sessionID = userSession.getID();

// This is 0 for compatibility with CFML and for security.
sessionScope.put( Key.cftoken, 0 );
// This is the session ID for compatibility with CFML
sessionScope.put( Key.cfid, sessionID.getName() );

// URL Token Compat
String bxid = userSession.getApplicationName() + Session.ID_CONCATENATOR + sessionID;
sessionScope.put( Key.urlToken, String.format( URL_TOKEN_FORMAT, bxid ) );
}

}

0 comments on commit 9da9703

Please sign in to comment.