admin

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package admin defines and implements store for admin-level data like secret key, list of admins and so on

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoStore

type MongoStore struct {
	// contains filtered or unexported fields
}

MongoStore implements admin.Store with mongo backend

func NewMongoStore

func NewMongoStore(conn *mongo.Connection, key string) *MongoStore

NewMongoStore makes admin Store for mongo's connection

func (*MongoStore) Admins

func (m *MongoStore) Admins(siteID string) (ids []string)

Admins executes find by siteID and returns admins ids

func (*MongoStore) Email

func (m *MongoStore) Email(siteID string) (email string)

Email executes find by siteID and returns admin's email

func (*MongoStore) Key

func (m *MongoStore) Key() (key string, err error)

Key executes find by siteID and returns substructure with secret key

type StaticStore

type StaticStore struct {
	// contains filtered or unexported fields
}

StaticStore implements keys.Store with a single, predefined key

func NewStaticKeyStore

func NewStaticKeyStore(key string) *StaticStore

NewStaticKeyStore is a shortcut for making StaticStore for key consumers only

func NewStaticStore

func NewStaticStore(key string, admins []string, email string) *StaticStore

NewStaticStore makes StaticStore instance with given key

func (*StaticStore) Admins

func (s *StaticStore) Admins(string) (ids []string)

Admins returns static list of admin's ids, the same for all sites

func (*StaticStore) Email

func (s *StaticStore) Email(string) (email string)

Email gets static email address

func (*StaticStore) Key

func (s *StaticStore) Key() (key string, err error)

Key returns static key for all sites, allows empty site

type Store

type Store interface {
	Key() (key string, err error)
	Admins(siteID string) (ids []string)
	Email(siteID string) (email string)
}

Store defines interface returning admins info for given site

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL