mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
Export to PDF related improvements
This commit is contained in:
parent
2e9734e73e
commit
ad2e653f3c
5 changed files with 701 additions and 690 deletions
|
@ -25,11 +25,7 @@ import (
|
||||||
type RequestContext struct {
|
type RequestContext struct {
|
||||||
AllowAnonymousAccess bool
|
AllowAnonymousAccess bool
|
||||||
Authenticated bool
|
Authenticated bool
|
||||||
Administrator bool
|
|
||||||
Guest bool
|
Guest bool
|
||||||
Editor bool
|
|
||||||
Global bool
|
|
||||||
Analytics bool
|
|
||||||
UserID string
|
UserID string
|
||||||
OrgID string
|
OrgID string
|
||||||
OrgName string
|
OrgName string
|
||||||
|
@ -41,6 +37,13 @@ type RequestContext struct {
|
||||||
Fullname string
|
Fullname string
|
||||||
Transaction *sqlx.Tx
|
Transaction *sqlx.Tx
|
||||||
AppVersion string
|
AppVersion string
|
||||||
|
|
||||||
|
Administrator bool
|
||||||
|
Analytics bool
|
||||||
|
Active bool
|
||||||
|
Editor bool
|
||||||
|
Global bool
|
||||||
|
ViewUsers bool
|
||||||
}
|
}
|
||||||
|
|
||||||
//GetAppURL returns full HTTP url for the app
|
//GetAppURL returns full HTTP url for the app
|
||||||
|
|
|
@ -18,8 +18,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetSecuredUser contain associated accounts but credentials are wiped.
|
// GetSecuredUser contain associated accounts but credentials are wiped.
|
||||||
func GetSecuredUser(ctx domain.RequestContext, s domain.Store, orgID, q string) (u user.User, err error) {
|
func GetSecuredUser(ctx domain.RequestContext, s domain.Store, orgID, id string) (u user.User, err error) {
|
||||||
u, err = s.User.Get(ctx, q)
|
u, err = s.User.Get(ctx, id)
|
||||||
AttachUserAccounts(ctx, s, orgID, &u)
|
AttachUserAccounts(ctx, s, orgID, &u)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import AjaxService from 'ember-ajax/services/ajax';
|
|
||||||
import config from '../config/environment';
|
import config from '../config/environment';
|
||||||
|
import AjaxService from 'ember-ajax/services/ajax';
|
||||||
|
|
||||||
export default AjaxService.extend({
|
export default AjaxService.extend({
|
||||||
session: service(),
|
session: service(),
|
||||||
|
@ -44,7 +44,7 @@ export default AjaxService.extend({
|
||||||
window.location.href = 'auth/login';
|
window.location.href = 'auth/login';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.not.empty(userUpdate)) {
|
if (this.get('session.authenticated') && is.not.empty(userUpdate) && is.not.undefined(userUpdate)) {
|
||||||
let latest = JSON.parse(userUpdate);
|
let latest = JSON.parse(userUpdate);
|
||||||
|
|
||||||
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin || user.analytics !== latest.analytics || user.viewUsers !== latest.viewUsers) {
|
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin || user.analytics !== latest.analytics || user.viewUsers !== latest.viewUsers) {
|
||||||
|
@ -52,7 +52,9 @@ export default AjaxService.extend({
|
||||||
window.location.href = 'auth/login';
|
window.location.href = 'auth/login';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e){} // eslint-disable-line no-empty
|
} catch(e) {
|
||||||
|
console.log(e); // eslint-disable-line no-console
|
||||||
|
} // eslint-disable-line no-empty
|
||||||
|
|
||||||
return this._super(...arguments);
|
return this._super(...arguments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,10 +138,12 @@ func (m *middleware) Authorize(w http.ResponseWriter, r *http.Request, next http
|
||||||
|
|
||||||
rc.AllowAnonymousAccess = org.AllowAnonymousAccess
|
rc.AllowAnonymousAccess = org.AllowAnonymousAccess
|
||||||
rc.OrgName = org.Title
|
rc.OrgName = org.Title
|
||||||
|
rc.Active = false
|
||||||
rc.Administrator = false
|
rc.Administrator = false
|
||||||
|
rc.Analytics = false
|
||||||
rc.Editor = false
|
rc.Editor = false
|
||||||
rc.Global = false
|
rc.Global = false
|
||||||
rc.Analytics = false
|
rc.ViewUsers = false
|
||||||
rc.AppURL = r.Host
|
rc.AppURL = r.Host
|
||||||
rc.Subdomain = organization.GetSubdomainFromHost(r)
|
rc.Subdomain = organization.GetSubdomainFromHost(r)
|
||||||
rc.SSL = r.TLS != nil
|
rc.SSL = r.TLS != nil
|
||||||
|
@ -169,9 +171,11 @@ func (m *middleware) Authorize(w http.ResponseWriter, r *http.Request, next http
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.Administrator = u.Admin
|
rc.Administrator = u.Admin
|
||||||
|
rc.Active = u.Active
|
||||||
|
rc.Analytics = u.Analytics
|
||||||
rc.Editor = u.Editor
|
rc.Editor = u.Editor
|
||||||
rc.Global = u.Global
|
rc.Global = u.Global
|
||||||
rc.Analytics = u.Analytics
|
rc.ViewUsers = u.ViewUsers
|
||||||
rc.Fullname = u.Fullname()
|
rc.Fullname = u.Fullname()
|
||||||
|
|
||||||
// We send back with every HTTP request/response cycle the latest
|
// We send back with every HTTP request/response cycle the latest
|
||||||
|
@ -195,7 +199,9 @@ func (m *middleware) Authorize(w http.ResponseWriter, r *http.Request, next http
|
||||||
w.Header().Add("X-Documize-Status", string(sb))
|
w.Header().Add("X-Documize-Status", string(sb))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug context output
|
||||||
// m.Runtime.Log.Info(fmt.Sprintf("%v", rc))
|
// m.Runtime.Log.Info(fmt.Sprintf("%v", rc))
|
||||||
|
|
||||||
ctx := context.WithValue(r.Context(), domain.DocumizeContextKey, rc)
|
ctx := context.WithValue(r.Context(), domain.DocumizeContextKey, rc)
|
||||||
r = r.WithContext(ctx)
|
r = r.WithContext(ctx)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue