Beispiel #1
0
func (s *userManagerSuite) TestNewUserManagerAPIRefusesNonClient(c *gc.C) {
	anAuthoriser := s.authorizer
	anAuthoriser.Client = false
	endPoint, err := usermanager.NewUserManagerAPI(s.State, anAuthoriser)
	c.Assert(endPoint, gc.IsNil)
	c.Assert(err, gc.ErrorMatches, "permission denied")
}
Beispiel #2
0
func (s *userManagerSuite) SetUpTest(c *gc.C) {
	s.JujuConnSuite.SetUpTest(c)

	s.authorizer = apiservertesting.FakeAuthorizer{
		Tag:      "user-admin",
		LoggedIn: true,
		Client:   true,
	}

	var err error
	s.usermanager, err = usermanager.NewUserManagerAPI(s.State, s.authorizer)
	c.Assert(err, gc.IsNil)
}
Beispiel #3
0
// UserManager returns an object that provides access to the UserManager API
// facade. The id argument is reserved for future use and currently
// needs to be empty
func (r *srvRoot) UserManager(id string) (*usermanager.UserManagerAPI, error) {
	if id != "" {
		return nil, common.ErrBadId
	}
	return usermanager.NewUserManagerAPI(r.srv.state, r)
}