Comments (5)
The endpoint expects an id
and a type
to be provided. Where type
is one of user
, group
or nobody
. The id
is, of course, the id
of the user or the id
of the group.
To support this functionality in this gem, we introduce something like
def assign_to(type, user_or_group_id=nil)
report = Hackerone::Report.first
esjee = Hackerone::User.find 'esjee'
report.assign_to(esjee.id, 'user')
However, I'm doubting whether that's a perfect solution. Perhaps masking the details of how the API works is nicer, and we could do something like
def remove_assignee # assign_to 'nobody'
def assign(user_or_group_name)
report = Hackerone::Report.first
report.remove_assignee
report.assign_to 'esjee'
report.assign_to 'developers'
But maybe I'm just overthinking this. 😄
Do you have any thoughts on this? Do you plan to use this functionality, and if so, how would you like to use it?
from hackerone-client.
@esjee Woah, I didn't realize h1 had the option to assign issues to a group or even how that is managed.
report.assign_to(esjee.id, 'user')
What happens if you do something like report.assign_to(some_group.id, 'user')
? Would the API reject that? It seems like supplying the type would only be useful as a sanity check, but the param is required so I'm assuming it matters greatly.
report.assign_to 'esjee'
Would this do a lookup to see if esjee
is a group or a user? Same goes for developers
. Assuming the assignment blows up if you supply the wrong type, I think this API is better even if it does cost an extra API call (although I'd prefer that the actual API treated the type
as optional).
from hackerone-client.
What happens if you do something like report.assign_to(some_group.id, 'user')? Would the API reject that?
Well, that depends. It'll try to assign to a user with the id of the group. If you happen to have a user in your team that is lucky enough to have the same id as the group, then the API assumes you want to assign to that person. If no such user can be found, the request fails.
So yes, it matters greatly. 😕
Would this do a lookup to see if esjee is a group or a user? Same goes for developers. Assuming the assignment blows up if you supply the wrong type, I think this API is better even if it does cost an extra API call (although I'd prefer that the actual API treated the type as optional).
Cool! I'll try to implement this behavior.
from hackerone-client.
If you happen to have a user in your team that is lucky enough to have the same id as the group
Ah, I guess I was assuming a user ID couldn't be a group ID but I'm not sure where I'd get that feeling.
from hackerone-client.
Fixed in #16
from hackerone-client.
Related Issues (15)
- Feature: state changes
- Move report-specific functionality into Report class HOT 3
- Feature: Bounties HOT 2
- Optionally assign report to user during report state changes HOT 15
- Prevent invalid state changes
- Allow for pagination and better filtering among reports HOT 4
- Where do you find the program id ?
- Feature: program reporter info HOT 1
- Get all reporters params like page[size] ? HOT 2
- CAPEC weakness ratings throw ArgumentError in classification label; HOT 8
- Feature: Comments HOT 2
- Add support for Custom Fields
- Add Sorbet for Type Checking
- Allow passing H1 Credentials as variables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hackerone-client.