How to disable Copy and Paste dashboard option to Guest user

Hi Mohan,

in general the Copy dashboard functionality was not designed in a way to be removable.

You could try removing it by filtering the items$ of the ActionBarService.

I’ve been e.g. able to remove the Copy dashboard button by using:

import { Injectable, Injector } from '@angular/core';
import { Router } from '@angular/router';
import { ActionBarService } from '@c8y/ngx-components';
import { map } from 'rxjs/operators';

@Injectable({ providedIn: 'root' })
export class CustomActionBarService extends ActionBarService {
  constructor(rootInjector: Injector, router: Router) {
    super(rootInjector, router);

    this.items$ = this.items$.pipe(
      map(items => {
        return items.filter(item => item.placement !== 'more' || item.priority !== -2000);

and overriding the original ActionBarService with our custom implementation, by adding this to the providers of the app.module.ts:

providers: [{ provide: ActionBarService, useClass: CustomActionBarService }]

There is sadly no unique identifier to specifically identify the Copy dashboard ActionBarItem… Using the filter from above could potentially remove also other items in the more menu of the action bar, which use the same priority. So you might want to double check that you are not removing further items.

The above sample removes the Copy dashboard item completely, but you should be able to adapt this in case you only want to do this under certain conditions.

Similar procedures should also apply for e.g. the left navigation, the tabs and probably also further extension points.


1 Like