Skip to content
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

Update permissions when when entities are updated #2221

Merged
merged 20 commits into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'v2-master' into permissions-new-endpoint
* v2-master: (55 commits)
  Add code coverage config file
  Tweak to cover radio button in single select columns (map existing route table)
  Remove todo from firehose permission - tested for admin/non admin - admin read-only needs to be applied later on - doppler.firehose scope wasn't required to show the firehose
  Add user info to the response when connecting an endpoint
  Fix tests
  Fix typing issue, highlighted by unit tests
  Ensure we handle cases where the permissions haven't been fetched yet
  Revert "Add `has space role in any space in any cf org`"
  Real fix
  Add `has space role in any space in any cf org`
  Three changes - Ensure there's no dups in org spaceGuids list - Fetch list of spaceGuids from org and not space object - Wire in new all spaces
  Fix selection following merge - Fix issue in master where select column/multi actions not showing - Fix manage users selection columns
  Fix return to select users step (missing user rows) - The ngIf on selected users which determines if the step is visible flipped - This caused the table to disconnect, which was never connected again - Not sure how the step was even still visible
  Fix redirect for states without query params
  Re-add selected users list to modify roles step, fixed title when start with multi users - This was brought up in demo - Needed in some cases for warm fuzzies (user has preselected users list, either single or multiple) - Only case where we might not show it is when the select users step is shown, however for consistency felt it should be the same for all
  Fix stepper blocked indicator (failed to populate cf/users when nav direct and single user)
  Update app-service-binding-card.component.spec.ts
  Ensure query params are retained through auth guard/login redirect
  Increase jasmine timeout to 10 seconds
  Do proper check when checking all spaces
  ...
  • Loading branch information
KlapTrap committed May 24, 2018
commit d1f84c47a983ec283f7473718fdea8694d859849
220 changes: 131 additions & 89 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ import {
TableCellServicePlanComponent,
} from '../cf-spaces-service-instances/table-cell-service-plan/table-cell-service-plan.component';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operators';
import { map, switchMap } from 'rxjs/operators';
import { CurrentUserPermissionsService } from '../../../../../core/current-user-permissions.service';
import { CurrentUserPermissions } from '../../../../../core/current-user-permissions.config';

interface CanCache {
[spaceGuid: string]: Observable<boolean>;
}

@Injectable()
export class CfServiceInstancesListConfigBase extends ListConfig<APIResource<IServiceInstance>>
Expand Down Expand Up @@ -90,14 +96,26 @@ export class CfServiceInstancesListConfigBase extends ListConfig<APIResource<ISe
private listActionDelete: IListAction<APIResource> = {
action: (item: APIResource) => this.deleteServiceInstance(item),
label: 'Delete',
description: 'Delete Service Instance'
description: 'Delete Service Instance',
createVisible: (row$: Observable<APIResource<IServiceInstance>>) =>
row$.pipe(
switchMap(
row => this.can(this.canDeleteCache, CurrentUserPermissions.SERVICE_INSTANCE_DELETE, row.entity.cfGuid, row.entity.space_guid)
)
)
};

private listActionDetach: IListAction<APIResource> = {
action: (item: APIResource) => this.deleteServiceBinding(item),
label: 'Detach',
description: 'Detach Service Instance',
createEnabled: (row$: Observable<APIResource>) => row$.pipe(map(row => row.entity.service_bindings.length === 1))
createEnabled: (row$: Observable<APIResource<IServiceInstance>>) => row$.pipe(map(row => row.entity.service_bindings.length === 1)),
createVisible: (row$: Observable<APIResource<IServiceInstance>>) =>
row$.pipe(
switchMap(
row => this.can(this.canDetachCache, CurrentUserPermissions.SERVICE_BINDING_EDIT, row.entity.cfGuid, row.entity.space_guid)
)
)
};

private can(cache: CanCache, perm: CurrentUserPermissions, cfGuid: string, spaceGuid: string): Observable<boolean> {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.