func (app *AdminApp) CreateOrgIndex() { var err error logger.Info("Creating org index") app.index.org, err = index.NewOrg(nil) checkAppFatal("Could not create index: %s", err) app.index.org.Data.Body.Id = NewID() app.index.org.Data.Body.ParentId = app.entities.org.Data.Body.Id }
func (cont *OrgController) CreateIndex() (*index.OrgIndex, error) { logger.Debug("creating new org index") index, err := index.NewOrg(nil) if err != nil { return nil, err } index.Data.Body.Id = x509.NewID() index.Data.Body.ParentId = cont.org.Id() logger.Trace("returning index") return index, nil }
func (app *AdminApp) LoadOrgIndex() { var err error orgIndexId := app.config.org.Data.Index indexJson, err := app.fs.api.GetPrivate(app.entities.org.Data.Body.Id, orgIndexId) indexContainer, err := document.NewContainer(indexJson) checkAppFatal("Could not load index container: %s", err) err = app.entities.org.Verify(indexContainer) checkAppFatal("Could not verify index: %s", err) decryptedIndexJson, err := app.entities.org.Decrypt(indexContainer) checkAppFatal("Could not decrypt container: %s", err) app.index.org, err = index.NewOrg(decryptedIndexJson) checkAppFatal("Could not create index: %s", err) }
func (cont *OrgController) GetIndex() (*index.OrgIndex, error) { logger.Debug("getting org index") orgIndexId := cont.config.Data.Index logger.Debugf("getting org index with id '%s'", orgIndexId) indexJson, err := cont.env.api.GetPrivate(cont.org.Id(), orgIndexId) if err != nil { return nil, err } logger.Debug("creating container for index") indexContainer, err := document.NewContainer(indexJson) if err != nil { return nil, err } logger.Debug("verifying container") err = cont.org.Verify(indexContainer) if err != nil { return nil, err } logger.Debug("decrypting container") decryptedIndexJson, err := cont.org.Decrypt(indexContainer) if err != nil { return nil, err } logger.Debug("creating new index struct from JSON") index, err := index.NewOrg(decryptedIndexJson) if err != nil { return nil, err } logger.Trace("returning index") return index, nil }