Skip to content

Commit c9b3599

Browse files
committed
Merge remote-tracking branch 'origin/release/7.0.0-rev2' into NAE-2072
# Conflicts: # projects/netgrif-components-core/src/lib/user/models/iuser.ts # projects/netgrif-components-core/src/lib/user/services/user.service.ts # projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-authentication-method-service.ts # projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-authentication.service.ts # projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-user-resource.service.ts
2 parents eb739ee + acc9a97 commit c9b3599

File tree

29 files changed

+253
-192
lines changed

29 files changed

+253
-192
lines changed

nae.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"extends": "nae-default",
44
"providers": {
55
"auth": {
6-
"address": "http://localhost:8800/api/",
7-
"authentication": "BasicWithRealm",
6+
"address": "http://localhost:8080/api/",
7+
"authentication": "Basic",
88
"endpoints": {
99
"login": "auth/login",
1010
"logout": "auth/logout",
@@ -24,37 +24,37 @@
2424
"resources": [
2525
{
2626
"name": "case",
27-
"address": "http://localhost:8800/api/",
27+
"address": "http://localhost:8080/api/",
2828
"format": "json"
2929
},
3030
{
3131
"name": "task",
32-
"address": "http://localhost:8800/api/",
32+
"address": "http://localhost:8080/api/",
3333
"format": "json"
3434
},
3535
{
3636
"name": "petrinet",
37-
"address": "http://localhost:8800/api/",
37+
"address": "http://localhost:8080/api/",
3838
"format": "json"
3939
},
4040
{
4141
"name": "user",
42-
"address": "http://localhost:8800/api/",
42+
"address": "http://localhost:8080/api/",
4343
"format": "json"
4444
},
4545
{
4646
"name": "dashboard",
47-
"address": "http://localhost:8800/api/",
47+
"address": "http://localhost:8080/api/",
4848
"format": "json"
4949
},
5050
{
5151
"name": "filter",
52-
"address": "http://localhost:8800/api/",
52+
"address": "http://localhost:8080/api/",
5353
"format": "json"
5454
},
5555
{
5656
"name": "impersonation",
57-
"address": "http://localhost:8800/api/",
57+
"address": "http://localhost:8080/api/",
5858
"format": "json"
5959
}
6060
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components-project",
3-
"version": "7.0.0-rc.1",
3+
"version": "7.0.0-rc.2",
44
"description": "Netgrif Application Engine Frontend project. Project includes angular libraries as base for NAE applications.",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",

projects/nae-example-app/src/app/doc/authentication/authentication.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div fxLayout="column" fxLayoutAlign="start center" fxFlex="25">
88
<form fxLayout="column" fxLayoutAlign="start center" class="full-width outer-padding">
99
<mat-form-field class="full-width">
10-
<mat-label>Login</mat-label>
10+
<mat-label>RealmId</mat-label>
1111
<input matInput type="text" placeholder="RealmId" name="realmId" [(ngModel)]="credentials.realmId">
1212
</mat-form-field>
1313
<mat-form-field class="full-width">

projects/netgrif-components-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components-core",
3-
"version": "7.0.0-rc.1",
3+
"version": "7.0.0-rc.2",
44
"description": "Netgrif Application engine frontend core Angular library",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",

projects/netgrif-components-core/src/lib/authentication/models/user.transformer.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ describe('UserTransformer', () => {
1010
const userTransformer = new UserTransformer();
1111
expect(userTransformer.transform({
1212
id: 'string',
13+
username: 'string',
14+
realmId: 'string',
1315
email: 'string',
1416
name: 'string',
17+
firstName: 'string',
1518
surname: 'string',
19+
lastName: 'string',
1620
fullName: 'string string',
1721
groups: [],
1822
authorities: [{authority: 'ADMIN'}],
1923
processRoles: [{stringId: 'string', description: 'desc', name: 'name', importId: 'importId'}],
2024
nextGroups: [],
21-
_links: {}
25+
_links: {},
2226
}).fullName).toEqual('string string');
2327
});
2428

projects/netgrif-components-core/src/lib/authentication/models/user.transformer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export class UserTransformer implements Transformer<UserResource, User> {
1818

1919
return new User(
2020
user.id,
21+
user.username,
2122
user.email,
23+
user.realmId,
2224
user.name,
2325
user.surname,
2426
user.workspaceId,

projects/netgrif-components-core/src/lib/authentication/services/methods/basic-authentication/basic-with-realm-authentication.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class BasicWithRealmAuthenticationService extends AuthenticationMethodSer
2626
if (credentials.username === '' || credentials.password === '') {
2727
return throwError(new Error('User\'s credentials are empty!'));
2828
}
29-
console.log("TOTOOOTOTOTOOK!!!")
3029
return this._http.post<UserResource>(url, credentials);
3130
}
3231

projects/netgrif-components-core/src/lib/authorization/permission/permission.service.spec.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@ describe('PermissionService', () => {
2727
NoopAnimationsModule,
2828
BrowserAnimationsModule,
2929
TranslateLibModule,
30-
HttpClientTestingModule
30+
HttpClientTestingModule,
3131
],
3232
providers: [
3333
PermissionService,
3434
{provide: UserService, useClass: MockUserService},
3535
],
3636
declarations: [],
37-
schemas: [NO_ERRORS_SCHEMA]
37+
schemas: [NO_ERRORS_SCHEMA],
3838
});
3939
permissionService = TestBed.inject(PermissionService);
4040
userService = TestBed.inject(UserService);
4141
}));
4242

4343
it('should canAssign be true with role', () => {
4444
(userService as unknown as MockUserService).user =
45-
new User('', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
45+
new User('', '', '', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
4646
const task = {
4747
caseId: 'string',
4848
transitionId: 'string',
@@ -52,8 +52,8 @@ describe('PermissionService', () => {
5252
user: undefined,
5353
roles: {
5454
assignRole: {
55-
assign: true
56-
}
55+
assign: true,
56+
},
5757
},
5858
startDate: undefined,
5959
finishDate: undefined,
@@ -64,19 +64,19 @@ describe('PermissionService', () => {
6464
layout: {
6565
offset: 0,
6666
cols: undefined,
67-
rows: undefined
67+
rows: undefined,
6868
},
6969
dataGroups: [],
7070
_links: {},
7171
users: {},
72-
userRefs: {}
72+
userRefs: {},
7373
};
7474
expect(permissionService.canAssign(task)).toBeTrue();
7575
});
7676

7777
it('should canAssign be false with role', () => {
7878
(userService as unknown as MockUserService).user =
79-
new User('', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
79+
new User('', '', '', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
8080
const task = {
8181
caseId: 'string',
8282
transitionId: 'string',
@@ -86,8 +86,8 @@ describe('PermissionService', () => {
8686
user: undefined,
8787
roles: {
8888
assignRole: {
89-
assign: false
90-
}
89+
assign: false,
90+
},
9191
},
9292
startDate: undefined,
9393
finishDate: undefined,
@@ -98,19 +98,19 @@ describe('PermissionService', () => {
9898
layout: {
9999
offset: 0,
100100
cols: undefined,
101-
rows: undefined
101+
rows: undefined,
102102
},
103103
dataGroups: [],
104104
_links: {},
105105
users: {},
106-
userRefs: {}
106+
userRefs: {},
107107
};
108108
expect(permissionService.canAssign(task)).toBeFalse();
109109
});
110110

111111
it('should canAssign be true with userRef', () => {
112112
(userService as unknown as MockUserService).user =
113-
new User('user123', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
113+
new User('user123', '', '', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
114114
const task = {
115115
caseId: 'string',
116116
transitionId: 'string',
@@ -128,27 +128,27 @@ describe('PermissionService', () => {
128128
layout: {
129129
offset: 0,
130130
cols: undefined,
131-
rows: undefined
131+
rows: undefined,
132132
},
133133
dataGroups: [],
134134
_links: {},
135135
users: {
136136
user123: {
137-
assign: true
138-
}
137+
assign: true,
138+
},
139139
},
140140
userRefs: {
141141
userList1: {
142-
assign: true
143-
}
144-
}
142+
assign: true,
143+
},
144+
},
145145
};
146146
expect(permissionService.canAssign(task)).toBeTrue();
147147
});
148148

149149
it('should canAssign be false with userRef', () => {
150150
(userService as unknown as MockUserService).user =
151-
new User('', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
151+
new User('', '', '', '', '', '', [], [{stringId: 'assignRole', name: '', importId: ''}]);
152152
const task = {
153153
caseId: 'string',
154154
transitionId: 'string',
@@ -166,31 +166,31 @@ describe('PermissionService', () => {
166166
layout: {
167167
offset: 0,
168168
cols: undefined,
169-
rows: undefined
169+
rows: undefined,
170170
},
171171
dataGroups: [],
172172
_links: {},
173173
users: {},
174174
userRefs: {
175175
userList1: {
176-
assign: true
177-
}
178-
}
176+
assign: true,
177+
},
178+
},
179179
};
180180
expect(permissionService.canAssign(task)).toBeFalse();
181181
});
182182

183183
it('should canDelete', () => {
184184
(userService as unknown as MockUserService).user =
185-
new User('', '', '', '', [], [{stringId: 'deleteRole', name: '', importId: ''}]);
185+
new User('', '', '', '', '', '', [], [{stringId: 'deleteRole', name: '', importId: ''}]);
186186
const case_ = {
187187
stringId: 'string',
188188
title: 'string',
189189
author: {email: 'email', fullName: 'fullName'},
190190
permissions: {
191191
deleteRole: {
192-
delete: true
193-
}
192+
delete: true,
193+
},
194194
},
195195
users: {},
196196
color: 'color',
@@ -207,29 +207,29 @@ describe('PermissionService', () => {
207207
processIdentifier: 0,
208208
time: 0,
209209
timeSecond: 0,
210-
timestamp: 0
210+
timestamp: 0,
211211
},
212212
immediateData: [
213213
{stringId: 'date', title: 'string', type: 'date', value: [2020, 1, 1, 10, 10]},
214214
{stringId: 'string', title: 'string', type: 'string', value: 'dasdsadsad'},
215215
{stringId: 'dateTime', title: 'string', type: 'dateTime', value: [2020, 1, 1, 10, 10]},
216216
{stringId: 'enum', title: 'string', type: 'enumeration', value: {defaultValue: 'dasd'}},
217-
]
217+
],
218218
};
219219
expect(permissionService.hasCasePermission(case_, PermissionType.DELETE)).toBeTrue();
220220
});
221221

222222
it('should canDelete be false', () => {
223223
(userService as unknown as MockUserService).user =
224-
new User('', '', '', '', [], [{stringId: 'deleteRole', name: '', importId: ''}]);
224+
new User('', '', '', '', '', '', [], [{stringId: 'deleteRole', name: '', importId: ''}]);
225225
const case_ = {
226226
stringId: 'string',
227227
title: 'string',
228228
author: {email: 'email', fullName: 'fullName'},
229229
permissions: {
230230
deleteRole: {
231-
delete: false
232-
}
231+
delete: false,
232+
},
233233
},
234234
users: {},
235235
color: 'color',
@@ -246,14 +246,14 @@ describe('PermissionService', () => {
246246
processIdentifier: 0,
247247
time: 0,
248248
timeSecond: 0,
249-
timestamp: 0
249+
timestamp: 0,
250250
},
251251
immediateData: [
252252
{stringId: 'date', title: 'string', type: 'date', value: [2020, 1, 1, 10, 10]},
253253
{stringId: 'string', title: 'string', type: 'string', value: 'dasdsadsad'},
254254
{stringId: 'dateTime', title: 'string', type: 'dateTime', value: [2020, 1, 1, 10, 10]},
255255
{stringId: 'enum', title: 'string', type: 'enumeration', value: {defaultValue: 'dasd'}},
256-
]
256+
],
257257
};
258258
expect(permissionService.hasCasePermission(case_, PermissionType.DELEGATE)).toBeFalse();
259259
});
@@ -269,13 +269,13 @@ describe('PermissionService', () => {
269269
defaultCaseName: '',
270270
initials: '',
271271
version: '',
272-
title: ''
272+
title: '',
273273
});
274274
net.permissions = {};
275275
expect(permissionService.hasNetPermission(PermissionType.CREATE, net)).toBeFalse();
276276

277277
(userService as unknown as MockUserService).user =
278-
new User('', '', '', '', [], [{stringId: 'role1', name: '', importId: ''}]);
278+
new User('', '', '', '', '', '', [], [{stringId: 'role1', name: '', importId: ''}]);
279279
net.permissions = {role1: {create: true}};
280280
expect(permissionService.hasNetPermission(PermissionType.CREATE, net)).toBeTrue();
281281

@@ -286,7 +286,7 @@ describe('PermissionService', () => {
286286
expect(permissionService.hasNetPermission(PermissionType.CREATE, net)).toBeFalse();
287287

288288
(userService as unknown as MockUserService).user =
289-
new User('', '', '', '', [],
289+
new User('', '', '', '', '', '', [],
290290
[{stringId: 'role1', name: '', importId: ''}, {stringId: 'role2', name: '', importId: ''}]);
291291
net.permissions = {role1: {create: false}, role2: {create: true}};
292292
expect(permissionService.hasNetPermission(PermissionType.CREATE, net)).toBeFalse();

0 commit comments

Comments
 (0)