community: github.com/documize/community/domain/user Index | Files

package user

import "github.com/documize/community/domain/user"

Index

Package Files

endpoint.go store.go user.go

func AttachUserAccounts Uses

func AttachUserAccounts(ctx domain.RequestContext, s store.Store, orgID string, u *user.User)

AttachUserAccounts attachs user accounts to user object.

func GetSecuredUser Uses

func GetSecuredUser(ctx domain.RequestContext, s store.Store, orgID, id string) (u user.User, err error)

GetSecuredUser contain associated accounts but credentials are wiped.

type Handler Uses

type Handler struct {
    Runtime *env.Runtime
    Store   *store.Store
}

Handler contains the runtime information such as logging and database.

func (*Handler) Add Uses

func (h *Handler) Add(w http.ResponseWriter, r *http.Request)

Add is the endpoint that enables an administrator to add a new user for their organization.

func (*Handler) BulkImport Uses

func (h *Handler) BulkImport(w http.ResponseWriter, r *http.Request)

BulkImport imports comma-delimited list of users: firstname, lastname, email

func (*Handler) ChangePassword Uses

func (h *Handler) ChangePassword(w http.ResponseWriter, r *http.Request)

ChangePassword accepts password change from within the app.

func (*Handler) Delete Uses

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

Delete is the endpoint to delete a user specified by userID, the caller must be an Administrator.

func (*Handler) ForgotPassword Uses

func (h *Handler) ForgotPassword(w http.ResponseWriter, r *http.Request)

ForgotPassword initiates the change password procedure. Generates a reset token and sends email to the user. User has to click link in email and then provide a new password.

func (*Handler) Get Uses

func (h *Handler) Get(w http.ResponseWriter, r *http.Request)

Get returns user specified by ID

func (*Handler) GetOrganizationUsers Uses

func (h *Handler) GetOrganizationUsers(w http.ResponseWriter, r *http.Request)

GetOrganizationUsers is the endpoint that allows administrators to view the users in their organization.

func (*Handler) GetSpaceUsers Uses

func (h *Handler) GetSpaceUsers(w http.ResponseWriter, r *http.Request)

GetSpaceUsers returns every user within a given space

func (*Handler) MatchUsers Uses

func (h *Handler) MatchUsers(w http.ResponseWriter, r *http.Request)

MatchUsers returns users where provided text matches firstname, lastname, email

func (*Handler) ResetPassword Uses

func (h *Handler) ResetPassword(w http.ResponseWriter, r *http.Request)

ResetPassword stores the newly chosen password for the user.

func (*Handler) Update Uses

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

Update is the endpoint to update user information for the given userID. Note that unless they have admin privildges, a user can only update their own information. Also, only admins can update user roles in organisations.

type Store Uses

type Store struct {
    store.Context
    store.UserStorer
}

Store provides data access to space information.

func (Store) Add Uses

func (s Store) Add(ctx domain.RequestContext, u user.User) (err error)

Add adds the given user record to the user table.

func (Store) CountActiveUsers Uses

func (s Store) CountActiveUsers() (c []domain.SubscriptionUserAccount)

CountActiveUsers returns the number of active users in the system.

func (Store) DeactiveUser Uses

func (s Store) DeactiveUser(ctx domain.RequestContext, userID string) (err error)

DeactiveUser deletes the account record for the given userID and persister.Context.OrgID.

func (Store) ForgotUserPassword Uses

func (s Store) ForgotUserPassword(ctx domain.RequestContext, email, token string) (err error)

ForgotUserPassword sets the password to ” and the reset field to token, for a user identified by email.

func (Store) Get Uses

func (s Store) Get(ctx domain.RequestContext, id string) (u user.User, err error)

Get returns the user record for the given id.

func (Store) GetActiveUsersForOrganization Uses

func (s Store) GetActiveUsersForOrganization(ctx domain.RequestContext) (u []user.User, err error)

GetActiveUsersForOrganization returns a slice containing of active user records for the organization identified in the Persister.

func (Store) GetByDomain Uses

func (s Store) GetByDomain(ctx domain.RequestContext, domain, email string) (u user.User, err error)

GetByDomain matches user by email and domain.

func (Store) GetByEmail Uses

func (s Store) GetByEmail(ctx domain.RequestContext, email string) (u user.User, err error)

GetByEmail returns a single row match on email.

func (Store) GetBySerial Uses

func (s Store) GetBySerial(ctx domain.RequestContext, serial string) (u user.User, err error)

GetBySerial is used to retrieve a user via their temporary password salt value! This occurs when we you share a folder with a new user and they have to complete the onboarding process.

func (Store) GetByToken Uses

func (s Store) GetByToken(ctx domain.RequestContext, token string) (u user.User, err error)

GetByToken returns a user record given a reset token value.

func (Store) GetSpaceUsers Uses

func (s Store) GetSpaceUsers(ctx domain.RequestContext, spaceID string) (u []user.User, err error)

GetSpaceUsers returns a slice containing all user records for given space.

func (Store) GetUsersForOrganization Uses

func (s Store) GetUsersForOrganization(ctx domain.RequestContext, filter string, limit int) (u []user.User, err error)

GetUsersForOrganization returns a slice containing all of the user records for the organizaiton identified in the context.

func (Store) GetUsersForSpaces Uses

func (s Store) GetUsersForSpaces(ctx domain.RequestContext, spaces []string) (u []user.User, err error)

GetUsersForSpaces returns users with access to specified spaces.

func (Store) MatchUsers Uses

func (s Store) MatchUsers(ctx domain.RequestContext, text string, maxMatches int) (u []user.User, err error)

MatchUsers returns users that have match to either firstname, lastname or email.

func (Store) UpdateUser Uses

func (s Store) UpdateUser(ctx domain.RequestContext, u user.User) (err error)

UpdateUser updates the user table using the given replacement user record.

func (Store) UpdateUserPassword Uses

func (s Store) UpdateUserPassword(ctx domain.RequestContext, userID, salt, password string) (err error)

UpdateUserPassword updates a user record with new password and salt values.

Package user imports 28 packages (graph) and is imported by 7 packages. Updated 2019-07-01. Refresh now. Tools for package owners.