GetSubscriber handles the retrieval of a single subscriber by ID.
(c echo.Context)
| 57 | |
| 58 | // GetSubscriber handles the retrieval of a single subscriber by ID. |
| 59 | func (a *App) GetSubscriber(c echo.Context) error { |
| 60 | user := auth.GetUser(c) |
| 61 | |
| 62 | // Check if the user has access to at least one of the lists on the subscriber. |
| 63 | id := getID(c) |
| 64 | if err := a.hasSubPerm(user, []int{id}); err != nil { |
| 65 | return err |
| 66 | } |
| 67 | |
| 68 | // Fetch the subscriber from the DB. |
| 69 | out, err := a.core.GetSubscriber(id, "", "") |
| 70 | if err != nil { |
| 71 | return err |
| 72 | } |
| 73 | |
| 74 | maskRestrictedSubLists(user, &out) |
| 75 | |
| 76 | return c.JSON(http.StatusOK, okResp{out}) |
| 77 | } |
| 78 | |
| 79 | // GetSubscriberActivity handles the retrieval of a subscriber's campaign views and link clicks. |
| 80 | func (a *App) GetSubscriberActivity(c echo.Context) error { |
no test coverage detected