This commit is contained in:
@@ -26,10 +26,11 @@ type Secret struct {
|
||||
|
||||
// Used for querying all secrets the user has access to
|
||||
type UserSecret struct {
|
||||
User
|
||||
UserId int `db:"UserId" json:"userId"`
|
||||
GroupId int `db:"GroupId" json:"groupId"`
|
||||
Group
|
||||
Permission
|
||||
Safe
|
||||
SafeName string `db:"SafeName"`
|
||||
Secret
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ func SecretsGetAllowed(s *Secret, userId int) ([]UserSecret, error) {
|
||||
|
||||
// Query for group access
|
||||
queryArgs := []interface{}{}
|
||||
query := `SELECT *
|
||||
query := `SELECT users.UserId, users.GroupId, permissions.ReadOnly, safes.SafeName, secrets.*
|
||||
FROM users
|
||||
INNER JOIN groups ON users.GroupId = groups.GroupId
|
||||
INNER JOIN permissions ON groups.GroupId = permissions.GroupId
|
||||
@@ -125,7 +126,7 @@ func SecretsGetAllowed(s *Secret, userId int) ([]UserSecret, error) {
|
||||
*/
|
||||
|
||||
// Execute the query
|
||||
log.Printf("SecretsGetAllowedForGroup query string : '%s'\nArguments: %+v\n", query, queryArgs)
|
||||
log.Printf("SecretsGetAllowedForGroup query string : '%s'\nArguments:%+v\n", query, queryArgs)
|
||||
rows, err := db.Queryx(query, queryArgs...)
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user