Skip to content

Commit 7fdd7dd

Browse files
thquadrichard-cox
authored andcommitted
Change creator visibility and fix permission bug (#4876)
Signed-off-by: Thomas Quandt <[email protected]>
1 parent 329fdc5 commit 7fdd7dd

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoint-card/endpoint-card.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ export class EndpointCardComponent extends CardCell<EndpointModel> implements On
140140
this.sessionService.userEndpointsEnabled(),
141141
this.sessionService.userEndpointsNotDisabled(),
142142
this.currentUserPermissionsService.can(StratosCurrentUserPermissions.EDIT_ADMIN_ENDPOINT),
143+
this.currentUserPermissionsService.can(StratosCurrentUserPermissions.EDIT_ENDPOINT)
143144
]).pipe(
144-
map(([userEndpointsEnabled, userEndpointsNotDisabled, isAdmin]) => {
145-
return userEndpointsEnabled || (userEndpointsNotDisabled && isAdmin);
145+
map(([userEndpointsEnabled, userEndpointsNotDisabled, isAdmin, isEndpointAdmin]) => {
146+
return (userEndpointsEnabled && (isAdmin || isEndpointAdmin)) || (userEndpointsNotDisabled && isAdmin);
146147
})
147148
);
148149
}

src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoint-list.helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class EndpointListHelper {
183183
row$
184184
]).pipe(
185185
map(([userEndpointsEnabled, isAdmin, isEndpointAdmin, row]) => {
186-
if (!userEndpointsEnabled || row.creator.admin) {
186+
if (!userEndpointsEnabled || row.creator.system) {
187187
return isAdmin;
188188
} else {
189189
return isEndpointAdmin || isAdmin;
@@ -207,7 +207,7 @@ export class EndpointListHelper {
207207
row$
208208
]).pipe(
209209
map(([userEndpointsEnabled, isAdmin, isEndpointAdmin, row]) => {
210-
if (!userEndpointsEnabled || row.creator.admin) {
210+
if (!userEndpointsEnabled || row.creator.system) {
211211
return isAdmin;
212212
} else {
213213
return isEndpointAdmin || isAdmin;

src/frontend/packages/core/src/shared/components/list/list-types/endpoint/endpoints-list-config.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ export class EndpointsListConfigService implements IListConfig<EndpointModel> {
130130
sessionService.userEndpointsEnabled(),
131131
sessionService.userEndpointsNotDisabled(),
132132
currentUserPermissionsService.can(StratosCurrentUserPermissions.EDIT_ADMIN_ENDPOINT),
133+
currentUserPermissionsService.can(StratosCurrentUserPermissions.EDIT_ENDPOINT)
133134
]).pipe(
134-
map(([userEndpointsEnabled, userEndpointsNotDisabled, isAdmin]) => {
135-
return userEndpointsEnabled || (userEndpointsNotDisabled && isAdmin);
135+
first(),
136+
map(([userEndpointsEnabled, userEndpointsNotDisabled, isAdmin, isEndpointAdmin]) => {
137+
return (userEndpointsEnabled && (isAdmin || isEndpointAdmin)) || (userEndpointsNotDisabled && isAdmin);
136138
})
137139
).subscribe(enabled => {
138140
if (enabled) {

src/jetstream/cnsi.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ func (p *portalProxy) DoRegisterEndpoint(cnsiName string, apiEndpoint string, sk
203203
newCNSI.SSOAllowed = ssoAllowed
204204
newCNSI.SubType = subType
205205

206-
// admins currently can't create user endpoints
207206
if p.GetConfig().UserEndpointsEnabled != config.UserEndpointsConfigEnum.Disabled && (!isAdmin || !createSystemEndpoint) {
208207
newCNSI.Creator = userId
209208
}

src/jetstream/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (p *portalProxy) getInfo(c echo.Context) (*interfaces.Info, error) {
102102

103103
// set the creator preemptively as admin, if no id is found
104104
endpoint.Creator = &interfaces.CreatorInfo{
105-
Name: "system",
105+
Name: "Global Endpoint",
106106
Admin: false,
107107
System: true,
108108
}

0 commit comments

Comments
 (0)