mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
fix(users): update task log for admins
This commit is contained in:
parent
41a95f16f1
commit
dafc6590df
@ -203,6 +203,7 @@ type Store interface {
|
||||
GetSchedule(projectID int, scheduleID int) (Schedule, error)
|
||||
DeleteSchedule(projectID int, scheduleID int) error
|
||||
|
||||
GetAllAdmins() ([]User, error)
|
||||
GetProjectUsers(projectID int, params RetrieveQueryParams) ([]UserWithProjectRole, error)
|
||||
CreateProjectUser(projectUser ProjectUser) (ProjectUser, error)
|
||||
DeleteProjectUser(projectID int, userID int) error
|
||||
|
@ -198,3 +198,11 @@ func (d *BoltDb) GetUserByLoginOrEmail(login string, email string) (existingUser
|
||||
err = db.ErrNotFound
|
||||
return
|
||||
}
|
||||
|
||||
func (d *BoltDb) GetAllAdmins() (users []db.User, err error) {
|
||||
err = d.getObjects(0, db.UserProps, db.RetrieveQueryParams{}, func(i interface{}) bool {
|
||||
user := i.(db.User)
|
||||
return user.Admin
|
||||
}, &users)
|
||||
return
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package sql
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"github.com/ansible-semaphore/semaphore/db"
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/ansible-semaphore/semaphore/db"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"time"
|
||||
)
|
||||
@ -216,3 +216,9 @@ func (d *SqlDb) GetUserByLoginOrEmail(login string, email string) (existingUser
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (d *SqlDb) GetAllAdmins() (users []db.User, err error) {
|
||||
_, err = d.selectAll(&users, "select * from "+db.UserProps.TableName+" where admin = true")
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -271,6 +271,15 @@ func (t *TaskRunner) populateDetails() error {
|
||||
t.users = append(t.users, user.ID)
|
||||
}
|
||||
|
||||
admins, err := t.pool.store.GetAllAdmins()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, user := range admins {
|
||||
t.users = append(t.users, user.ID)
|
||||
}
|
||||
|
||||
// get inventory
|
||||
t.Inventory, err = t.pool.store.GetInventory(t.Template.ProjectID, t.Template.InventoryID)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user