-
Notifications
You must be signed in to change notification settings - Fork 4
[NAE-2241] Anonymous access refactor #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/7.0.0-rev10
Are you sure you want to change the base?
Changes from all commits
9cdebe0
41cc8fb
8babfe3
f0a63a8
ffb3b5e
44be3b6
3949d93
0305882
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -11,15 +11,15 @@ import {Observable, throwError} from 'rxjs'; | |||
| import {catchError, tap} from 'rxjs/operators'; | ||||
| import {SessionService} from '../session/services/session.service'; | ||||
| import {RedirectService} from '../../routing/redirect-service/redirect.service'; | ||||
| import {AnonymousService} from '../anonymous/anonymous.service'; | ||||
| // import {AnonymousService} from '../anonymous/anonymous.service'; | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Remove commented-out import. Delete the commented-out import rather than leaving dead code. If the ♻️ Proposed fix-// import {AnonymousService} from '../anonymous/anonymous.service';📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
| import {SessionIdleTimerService} from "../session/services/session-idle-timer.service"; | ||||
|
|
||||
| @Injectable() | ||||
| export class AuthenticationInterceptor implements HttpInterceptor { | ||||
|
|
||||
| constructor(private _session: SessionService, | ||||
| private _redirect: RedirectService, | ||||
| private _anonymousService: AnonymousService, | ||||
| // private _anonymousService: AnonymousService, | ||||
| private idleTimerService: SessionIdleTimerService) { | ||||
| } | ||||
|
Comment on lines
20
to
24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Remove commented-out constructor parameter. The commented-out ♻️ Proposed fix constructor(private _session: SessionService,
private _redirect: RedirectService,
- // private _anonymousService: AnonymousService,
private idleTimerService: SessionIdleTimerService) {
}🤖 Prompt for AI Agents |
||||
|
|
||||
|
|
@@ -37,7 +37,7 @@ export class AuthenticationInterceptor implements HttpInterceptor { | |||
| return next.handle(req).pipe( | ||||
| tap(event => { | ||||
| if (event instanceof HttpResponse) { | ||||
| if (event.headers.has(this._session.sessionHeader) && !event.headers.has(this._anonymousService.jwtHeader)) { | ||||
| if (event.headers.has(this._session.sessionHeader)) { | ||||
| this._session.setVerifiedToken(event.headers.get(this._session.sessionHeader)); | ||||
| } | ||||
| } | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -121,6 +121,13 @@ export class MergedFilter extends Filter { | |||||||||||||||||||||||||||||||||
| return this._filters.some(f => f.query !== undefined && f.query !== null); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||
| * See [Filter.bodyContainsCaseId()]{@link Filter#bodyContainsCaseId} | ||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||
| bodyContainsCaseId(): boolean { | ||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+124
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stub implementation may incorrectly return The existing Consider implementing consistent logic: 🔧 Proposed fix to iterate filter bodies bodyContainsCaseId(): boolean {
- return false;
+ return this._filters.some(f =>
+ !!f['case'] &&
+ ((!Array.isArray(f['case']) && !!f['case'].id && f['case'].id.length > 0) ||
+ (Array.isArray(f['case']) && f['case'].length > 0))
+ );
}Alternatively, if this stub is intentional (e.g., merged filters are never expected to contain case IDs in anonymous access scenarios), please add a comment explaining why returning 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||
| * Returns the necessary request params for the filter. | ||||||||||||||||||||||||||||||||||
| * @returns params with `operation` set to either `AND` or `OR` based on this object's `_operator` property. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,20 @@ export class SimpleFilter extends Filter { | |
| return this._filter.query !== undefined && this._filter.query !== null; | ||
| } | ||
|
|
||
| /** | ||
| * See [Filter.bodyContainsCaseId()]{@link Filter#bodyContainsCaseId} | ||
| */ | ||
| bodyContainsCaseId(): boolean { | ||
| return !!this._filter | ||
| && !!this._filter['case'] | ||
| && ((!Array.isArray(this._filter['case']) | ||
| && !!this._filter['case'].id | ||
| && this._filter['case'].id.length > 0) | ||
| || (Array.isArray(this._filter['case']) | ||
| && this._filter['case'].length > 0)); | ||
| } | ||
|
Comment on lines
+108
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent validation between array and non-array case. For a single case object (lines 111-113), you validate that This inconsistency could cause 🔧 Proposed fix for consistent validation bodyContainsCaseId(): boolean {
return !!this._filter
&& !!this._filter['case']
&& ((!Array.isArray(this._filter['case'])
&& !!this._filter['case'].id
&& this._filter['case'].id.length > 0)
|| (Array.isArray(this._filter['case'])
- && this._filter['case'].length > 0));
+ && this._filter['case'].some(c => !!c.id && c.id.length > 0)));
}If the current behavior is intentional (any array presence is sufficient regardless of element validity), please add a clarifying comment. 🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| /** | ||
| * See [Filter.getRequestBody()]{@link Filter#getRequestBody} | ||
| */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,6 @@ import {UserResourceService} from '../../resources/engine-endpoint/user-resource | |||||||||||||
| import {UserTransformer} from '../../authentication/models/user.transformer'; | ||||||||||||||
| import {SessionService} from '../../authentication/session/services/session.service'; | ||||||||||||||
| import {User} from '../../user/models/user'; | ||||||||||||||
| import {AnonymousService} from '../../authentication/anonymous/anonymous.service'; | ||||||||||||||
| import {ActiveGroupService} from '../../groups/services/active-group.service'; | ||||||||||||||
| import {TaskResourceService} from '../../resources/engine-endpoint/task-resource.service'; | ||||||||||||||
| import {LanguageService} from '../../translate/language.service'; | ||||||||||||||
|
|
@@ -396,9 +395,9 @@ class TestUserService extends UserService { | |||||||||||||
| userTransform: UserTransformer, | ||||||||||||||
| log: LoggerService, | ||||||||||||||
| session: SessionService, | ||||||||||||||
| anonymousService: AnonymousService, | ||||||||||||||
| // anonymousService: AnonymousService, | ||||||||||||||
| config: ConfigurationService) { | ||||||||||||||
| super(authService, userResource, userTransform, log, session, anonymousService, config); | ||||||||||||||
| super(authService, userResource, userTransform, log, session, config); | ||||||||||||||
|
Comment on lines
+398
to
+400
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Remove commented-out code instead of leaving it in place. The ♻️ Suggested cleanup `@Injectable`()
class TestUserService extends UserService {
constructor(authService: AuthenticationService,
userResource: UserResourceService,
userTransform: UserTransformer,
log: LoggerService,
session: SessionService,
- // anonymousService: AnonymousService,
config: ConfigurationService) {
super(authService, userResource, userTransform, log, session, config);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| public setUser(user: User) { | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Remove the commented export from the public API surface.
Keeping commented exports in a public API file creates dead code and ambiguity. If this export is intentionally retired, delete it outright.
🧹 Suggested cleanup
-// export * from './services/anonymous-authentication-interceptor'📝 Committable suggestion
🤖 Prompt for AI Agents