Skip to content

Commit

Permalink
Add user impersonation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Gawryl authored and Jacqbus committed Feb 4, 2021
1 parent 8d03a89 commit e31a4dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ export class Redmine {
}
};

const { apiKey, username, password } = this.options;
const { apiKey, username, password, impersonateUser } = this.options;

// Set authentication
if (apiKey) {
connConfig.headers['X-Redmine-API-Key'] = apiKey;
}
Expand All @@ -74,6 +75,11 @@ export class Redmine {
};
}

// Set impersonate
if (impersonateUser) {
connConfig.headers['X-Redmine-Switch-User'] = impersonateUser;
}

this.conn = axios.create(connConfig);
}

Expand Down Expand Up @@ -991,6 +997,7 @@ export namespace RedmineTS {
apiKey?: string;
username?: string;
password?: string;
impersonateUser?: string;
maxUploadSize?: number; // Default: 5MB
}

Expand Down

0 comments on commit e31a4dc

Please sign in to comment.