Delete credential
(sess *Session, asUid types.Uid, authLvl auth.Level, msg *ClientComMessage)
| 3307 | |
| 3308 | // Delete credential |
| 3309 | func (t *Topic) replyDelCred(sess *Session, asUid types.Uid, authLvl auth.Level, msg *ClientComMessage) error { |
| 3310 | now := types.TimeNow() |
| 3311 | incomingReqTs := msg.Timestamp |
| 3312 | del := msg.Del |
| 3313 | |
| 3314 | if t.cat != types.TopicCatMe { |
| 3315 | sess.queueOut(ErrPermissionDeniedReply(msg, now)) |
| 3316 | return errors.New("del.cred: invalid topic category") |
| 3317 | } |
| 3318 | if del.Cred == nil || del.Cred.Method == "" { |
| 3319 | sess.queueOut(ErrMalformedReply(msg, now)) |
| 3320 | return errors.New("del.cred: missing method") |
| 3321 | } |
| 3322 | |
| 3323 | tags, err := deleteCred(asUid, authLvl, del.Cred) |
| 3324 | if tags != nil { |
| 3325 | // Check if anything has been actually removed. |
| 3326 | _, removed, _ := stringSliceDelta(t.tags, tags) |
| 3327 | if len(removed) > 0 { |
| 3328 | t.tags = tags |
| 3329 | t.presSubsOnline("tags", "", nilPresParams, nilPresFilters, "") |
| 3330 | } |
| 3331 | } else if err == nil { |
| 3332 | sess.queueOut(InfoNoActionReply(msg, now)) |
| 3333 | return nil |
| 3334 | } |
| 3335 | sess.queueOut(decodeStoreErrorExplicitTs(err, del.Id, del.Topic, now, incomingReqTs, nil)) |
| 3336 | return err |
| 3337 | } |
| 3338 | |
| 3339 | // Delete subscription. |
| 3340 | func (t *Topic) replyDelSub(sess *Session, asUid types.Uid, msg *ClientComMessage) error { |
no test coverage detected