launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/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 "launchpad.net/juju-core/state"
     7  
     8  // FakeAuthorizer implements the common.Authorizer interface.
     9  type FakeAuthorizer struct {
    10  	Tag            string
    11  	LoggedIn       bool
    12  	EnvironManager bool
    13  	MachineAgent   bool
    14  	UnitAgent      bool
    15  	Client         bool
    16  	Entity         state.Entity
    17  }
    18  
    19  func (fa FakeAuthorizer) AuthOwner(tag string) bool {
    20  	return fa.Tag == tag
    21  }
    22  
    23  func (fa FakeAuthorizer) AuthEnvironManager() bool {
    24  	return fa.EnvironManager
    25  }
    26  
    27  func (fa FakeAuthorizer) AuthMachineAgent() bool {
    28  	return fa.MachineAgent
    29  }
    30  
    31  func (fa FakeAuthorizer) AuthUnitAgent() bool {
    32  	return fa.UnitAgent
    33  }
    34  
    35  func (fa FakeAuthorizer) AuthClient() bool {
    36  	return fa.Client
    37  }
    38  
    39  func (fa FakeAuthorizer) GetAuthTag() string {
    40  	return fa.Tag
    41  }
    42  
    43  func (fa FakeAuthorizer) GetAuthEntity() state.Entity {
    44  	return fa.Entity
    45  }