1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 21:15:24 +02:00

moving endpoints to new API (WIP)

This commit is contained in:
Harvey Kandola 2017-07-26 10:50:26 +01:00
parent 27640dffc4
commit 72b14def6d
36 changed files with 1371 additions and 472 deletions

View file

@ -13,23 +13,23 @@ package user
import (
"github.com/documize/community/domain"
"github.com/documize/community/domain/account"
"github.com/documize/community/model/user"
"github.com/pkg/errors"
)
// GetSecuredUser contain associated accounts but credentials are wiped.
func GetSecuredUser(s domain.StoreContext, orgID, q string) (u User, err error) {
u, err = Get(s, q)
AttachUserAccounts(s, orgID, &u)
func GetSecuredUser(ctx domain.RequestContext, s domain.Store, orgID, q string) (u user.User, err error) {
u, err = s.User.Get(ctx, q)
AttachUserAccounts(ctx, s, orgID, &u)
return
}
// AttachUserAccounts attachs user accounts to user object.
func AttachUserAccounts(s domain.StoreContext, orgID string, u *User) {
func AttachUserAccounts(ctx domain.RequestContext, s domain.Store, orgID string, u *user.User) {
u.ProtectSecrets()
a, err := account.GetUserAccounts(s, u.RefID)
a, err := s.Account.GetUserAccounts(ctx, u.RefID)
if err != nil {
err = errors.Wrap(err, "fetch user accounts")
return