1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

Problem: we are showing inactive users in lists

Solution: allow optional parameter to show/hide inactive users
This commit is contained in:
Harvey Kandola 2017-03-22 12:04:48 +00:00
parent 90eb4f9517
commit fa0f176613
5 changed files with 73 additions and 10 deletions

View file

@ -155,6 +155,23 @@ func (p *Persister) GetUserBySerial(serial string) (user entity.User, err error)
return
}
// GetActiveUsersForOrganization returns a slice containing of active user records for the organization
// identified in the Persister.
func (p *Persister) GetActiveUsersForOrganization() (users []entity.User, err error) {
err = Db.Select(&users,
`SELECT u.id, u.refid, u.firstname, u.lastname, u.email, u.initials, u.password, u.salt, u.reset, u.created, u.revised
FROM user u
WHERE u.refid IN (SELECT userid FROM account WHERE orgid = ? AND active=1) ORDER BY u.firstname,u.lastname`,
p.Context.OrgID)
if err != nil {
log.Error(fmt.Sprintf("Unable to get all users for org %s", p.Context.OrgID), err)
return
}
return
}
// GetUsersForOrganization returns a slice containing all of the user records for the organizaiton
// identified in the Persister.
func (p *Persister) GetUsersForOrganization() (users []entity.User, err error) {