class WorkspacePermissionsFilter extends CheMethodInvokerFilter {

  void checkAccountPermissions(String accountName, AccountOperation operation)
      throws ForbiddenException, NotFoundException, ServerException {
    if (accountName == null) {
      // default namespace will be used
      return;
    }

    final Account account = accountManager.getByName(accountName);

    AccountPermissionsChecker accountPermissionsChecker =
        accountTypeToPermissionsChecker.get(account.getType());

    if (accountPermissionsChecker == null) {
      throw new ForbiddenException("User is not authorized to use specified namespace");
    }

    accountPermissionsChecker.checkPermissions(account.getId(), operation);
  }

  @Inject public  WorkspacePermissionsFilter(
      WorkspaceManager workspaceManager,
      AccountManager accountManager,
      Set<AccountPermissionsChecker> accountPermissionsCheckers,
      SuperPrivilegesChecker superPrivilegesChecker);

}