View Issue Details

IDProjectCategoryView StatusLast Update
0015808mantisbtapi soappublic2014-01-23 17:59
Reportervboctor Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status acknowledgedResolutionopen 
Product Version1.2.15 
Summary0015808: mc_issue_update() accepts AccountData but requires id for monitoring users
Description

As per the convention any api that accepts an objectref or account, should accept id, name, or email and use these to lookup the user. The helper method that internally handles setting monitoring users requires the id field to be set otherwise it causes a PHP notice.

TagsNo tags attached.

Activities

rombert

rombert

2013-05-06 15:40

reporter   ~0036793

Sounds like something we should fix.

dregad

dregad

2013-05-06 16:42

developer   ~0036794

Careful with using email as identifier as it is not necessarily unique

vboctor

vboctor

2013-05-07 00:33

manager   ~0036796

We already have a helper method (mci_get_user_id) that gets a user id given an AccountData or ObjectRef. It follows this algorithm:

  • If id specified, use it.
  • If name specified, lookup by name, return id.
  • If email specified, lookup by email, return it.

When looking up by email it assumes uniqueness or the fact that any match will be fine. We could return no match when there is more than one match.

The current implementation also doesn't consider empty emails as "not specified". Hence, if allow blank emails is ON, then there could be multiple matches there as well.