fleet/server/mock/datastore_sessions.go
Zachary Wasserman 5cbaa9cb9f Prevent non-admin users from modifying other users
An incorrect authorization check allowed non-admin users to modify the details of other users. We now enforce the appropriate authorization so that unprivileged users can only modify their own details.

Thanks to 'Quikke' for the report.
2018-09-18 14:56:25 -04:00

80 lines
2.3 KiB
Go

// Automatically generated by mockimpl. DO NOT EDIT!
package mock
import "github.com/kolide/fleet/server/kolide"
var _ kolide.SessionStore = (*SessionStore)(nil)
type SessionByKeyFunc func(key string) (*kolide.Session, error)
type SessionByIDFunc func(id uint) (*kolide.Session, error)
type ListSessionsForUserFunc func(id uint) ([]*kolide.Session, error)
type NewSessionFunc func(session *kolide.Session) (*kolide.Session, error)
type DestroySessionFunc func(session *kolide.Session) error
type DestroyAllSessionsForUserFunc func(id uint) error
type MarkSessionAccessedFunc func(session *kolide.Session) error
type SessionStore struct {
SessionByKeyFunc SessionByKeyFunc
SessionByKeyFuncInvoked bool
SessionByIDFunc SessionByIDFunc
SessionByIDFuncInvoked bool
ListSessionsForUserFunc ListSessionsForUserFunc
ListSessionsForUserFuncInvoked bool
NewSessionFunc NewSessionFunc
NewSessionFuncInvoked bool
DestroySessionFunc DestroySessionFunc
DestroySessionFuncInvoked bool
DestroyAllSessionsForUserFunc DestroyAllSessionsForUserFunc
DestroyAllSessionsForUserFuncInvoked bool
MarkSessionAccessedFunc MarkSessionAccessedFunc
MarkSessionAccessedFuncInvoked bool
}
func (s *SessionStore) SessionByKey(key string) (*kolide.Session, error) {
s.SessionByKeyFuncInvoked = true
return s.SessionByKeyFunc(key)
}
func (s *SessionStore) SessionByID(id uint) (*kolide.Session, error) {
s.SessionByIDFuncInvoked = true
return s.SessionByIDFunc(id)
}
func (s *SessionStore) ListSessionsForUser(id uint) ([]*kolide.Session, error) {
s.ListSessionsForUserFuncInvoked = true
return s.ListSessionsForUserFunc(id)
}
func (s *SessionStore) NewSession(session *kolide.Session) (*kolide.Session, error) {
s.NewSessionFuncInvoked = true
return s.NewSessionFunc(session)
}
func (s *SessionStore) DestroySession(session *kolide.Session) error {
s.DestroySessionFuncInvoked = true
return s.DestroySessionFunc(session)
}
func (s *SessionStore) DestroyAllSessionsForUser(id uint) error {
s.DestroyAllSessionsForUserFuncInvoked = true
return s.DestroyAllSessionsForUserFunc(id)
}
func (s *SessionStore) MarkSessionAccessed(session *kolide.Session) error {
s.MarkSessionAccessedFuncInvoked = true
return s.MarkSessionAccessedFunc(session)
}