mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
document tag editor re-vamped
This commit is contained in:
parent
d6e18b4289
commit
9ccd0fd19c
9 changed files with 54 additions and 48 deletions
|
@ -54,21 +54,14 @@ func (s Scope) Add(ctx domain.RequestContext, account account.Account) (err erro
|
|||
|
||||
// GetUserAccount returns the database account record corresponding to the given userID, using the client's current organizaion.
|
||||
func (s Scope) GetUserAccount(ctx domain.RequestContext, userID string) (account account.Account, err error) {
|
||||
stmt, err := s.Runtime.Db.Preparex(`
|
||||
SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a.admin, a.active, a.created, a.revised, b.company, b.title, b.message, b.domain
|
||||
FROM account a, organization b
|
||||
WHERE b.refid=a.orgid and a.orgid=? and a.userid=?`)
|
||||
defer streamutil.Close(stmt)
|
||||
err = s.Runtime.Db.Get(&account, `
|
||||
SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a.admin, a.active, a.created, a.revised,
|
||||
b.company, b.title, b.message, b.domain
|
||||
FROM account a, organization b
|
||||
WHERE b.refid=a.orgid AND a.orgid=? AND a.userid=?`, ctx.OrgID, userID)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("prepare select for account by user %s", userID))
|
||||
return
|
||||
}
|
||||
|
||||
err = stmt.Get(&account, ctx.OrgID, userID)
|
||||
if err != sql.ErrNoRows && err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("execute select for account by user %s", userID))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -92,7 +85,8 @@ func (s Scope) GetUserAccounts(ctx domain.RequestContext, userID string) (t []ac
|
|||
// GetAccountsByOrg returns a slice of database account records, for all users in the client's organization.
|
||||
func (s Scope) GetAccountsByOrg(ctx domain.RequestContext) (t []account.Account, err error) {
|
||||
err = s.Runtime.Db.Select(&t,
|
||||
`SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a.admin, a.active, a.created, a.revised, b.company, b.title, b.message, b.domain
|
||||
`SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a.admin, a.active, a.created, a.revised,
|
||||
b.company, b.title, b.message, b.domain
|
||||
FROM account a, organization b
|
||||
WHERE a.orgid=b.refid AND a.orgid=? AND a.active=1`, ctx.OrgID)
|
||||
|
||||
|
|
|
@ -153,7 +153,6 @@ func (p *Provider) Refresh(ctx *provider.Context, configJSON, data string) strin
|
|||
|
||||
err := json.Unmarshal([]byte(configJSON), &c)
|
||||
if err != nil {
|
||||
p.Runtime.Log.Error("unable to unmarshall github config", err)
|
||||
return "internal configuration error '" + err.Error() + "'"
|
||||
}
|
||||
|
||||
|
@ -164,7 +163,6 @@ func (p *Provider) Refresh(ctx *provider.Context, configJSON, data string) strin
|
|||
|
||||
byts, err := json.Marshal(refreshReportData(&c, client))
|
||||
if err != nil {
|
||||
p.Runtime.Log.Error("unable to marshall github data", err)
|
||||
return "internal configuration error '" + err.Error() + "'"
|
||||
}
|
||||
|
||||
|
@ -188,9 +186,7 @@ func (p *Provider) Render(ctx *provider.Context, config, data string) string {
|
|||
var c = githubConfig{}
|
||||
|
||||
err = json.Unmarshal([]byte(config), &c)
|
||||
|
||||
if err != nil {
|
||||
p.Runtime.Log.Error("unable to unmarshall github config", err)
|
||||
return "Please delete and recreate this Github section."
|
||||
}
|
||||
|
||||
|
@ -206,7 +202,6 @@ func (p *Provider) Render(ctx *provider.Context, config, data string) string {
|
|||
|
||||
err = json.Unmarshal([]byte(data), &payload)
|
||||
if err != nil {
|
||||
p.Runtime.Log.Error("unable to unmarshall github data", err)
|
||||
return "Please delete and recreate this Github section."
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ func (s Scope) GetUsersForOrganization(ctx domain.RequestContext) (u []user.User
|
|||
// GetSpaceUsers returns a slice containing all user records for given folder.
|
||||
func (s Scope) GetSpaceUsers(ctx domain.RequestContext, spaceID string) (u []user.User, err error) {
|
||||
err = s.Runtime.Db.Select(&u, `
|
||||
SELECT u.id, u.refid, u.firstname, u.lastname, u.email, u.initials, u.password, u.salt, u.reset, u.created, u.revised, u.global
|
||||
SELECT u.id, u.refid, u.firstname, u.lastname, u.email, u.initials, u.password, u.salt, u.reset, u.created, u.revised, u.global,
|
||||
a.active, a.users AS viewusers, a.editor, a.admin
|
||||
FROM user u, account a
|
||||
WHERE a.orgid=? AND u.refid = a.userid AND a.active=1 AND u.refid IN (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue