{"size": 501, "ext": "js", "max_stars_repo_path": "src/identity.js", "max_stars_repo_name": "AttackPattern/node-cqrs-projections", "max_stars_repo_stars_event_min_datetime": "2020-02-26T02:47:18.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-26T02:47:18.000Z", "max_issues_repo_path": "src/identity.js", "max_issues_repo_name": "AttackPattern/node-cqrs-projections", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/identity.js", "max_forks_repo_name": "AttackPattern/node-cqrs-projections", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.7826086957, "max_line_length": 63, "alphanum_fraction": 0.618762475}
export default class Identity {
  constructor(data = {}) {
    this.username = data.username;
    this.userId = data.userId;
    this.claims = data.claims || {};
    this._rights = data.rights || [];
  }

  get rights() {
    return this._rights;
  }

  static anonymous = new Identity({
    userId: 'anonymous'
  })
  isAnonymous = () => this.userId === Identity.anonymous.userId

  static system = new Identity({
    userId: 'system'
  })
  isSystem = () => this.userId === Identity.system.userId
}
