github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/state/apiserver/testing/fakeauthorizer.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package testing 5 6 import ( 7 "launchpad.net/juju-core/state" 8 ) 9 10 // FakeAuthorizer implements the common.Authorizer interface. 11 type FakeAuthorizer struct { 12 Tag string 13 LoggedIn bool 14 EnvironManager bool 15 MachineAgent bool 16 UnitAgent bool 17 Client bool 18 Entity state.Entity 19 } 20 21 func (fa FakeAuthorizer) AuthOwner(tag string) bool { 22 return fa.Tag == tag 23 } 24 25 func (fa FakeAuthorizer) AuthEnvironManager() bool { 26 return fa.EnvironManager 27 } 28 29 func (fa FakeAuthorizer) AuthMachineAgent() bool { 30 return fa.MachineAgent 31 } 32 33 func (fa FakeAuthorizer) AuthUnitAgent() bool { 34 return fa.UnitAgent 35 } 36 37 func (fa FakeAuthorizer) AuthClient() bool { 38 return fa.Client 39 } 40 41 func (fa FakeAuthorizer) GetAuthTag() string { 42 return fa.Tag 43 } 44 45 func (fa FakeAuthorizer) GetAuthEntity() state.Entity { 46 return fa.Entity 47 }