mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
implemented view users permission
This commit is contained in:
parent
f5f30d2322
commit
30321781c2
13 changed files with 423 additions and 388 deletions
|
@ -110,7 +110,7 @@ func (h *Handler) Login(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
h.Runtime.Log.Info("login " + email + " @ " + dom)
|
h.Runtime.Log.Info("logged in " + email + " @ " + dom)
|
||||||
|
|
||||||
authModel := auth.AuthenticationModel{}
|
authModel := auth.AuthenticationModel{}
|
||||||
authModel.Token = GenerateJWT(h.Runtime, u.RefID, org.RefID, dom)
|
authModel.Token = GenerateJWT(h.Runtime, u.RefID, org.RefID, dom)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{{#if folders}}
|
<div class="page-customize">
|
||||||
|
<div class="space-admin">
|
||||||
|
|
||||||
<div class="global-folder-settings">
|
{{#if folders}}
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">{{folders.length}} shared {{label}}</div>
|
<div class="title">{{folders.length}} shared {{label}}</div>
|
||||||
<div class="tip">View and change shared space ownership</div>
|
<div class="tip">View and change shared space ownership</div>
|
||||||
|
@ -18,7 +19,6 @@
|
||||||
<div class="clearfix" />
|
<div class="clearfix" />
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dropdown-dialog delete-space-dialog">
|
<div class="dropdown-dialog delete-space-dialog">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -41,11 +41,11 @@
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
||||||
<div class="global-folder-settings">
|
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">{{folders.length}} shared {{label}}</div>
|
<div class="title">{{folders.length}} shared {{label}}</div>
|
||||||
<div class="tip">There are no spaces to maintain</div>
|
<div class="tip">There are no spaces to maintain</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
{{customize/user-settings add=(action 'add')}}
|
{{customize/user-settings add=(action 'add')}}
|
||||||
|
|
||||||
<div class="clearfix" />
|
|
||||||
|
|
||||||
{{customize/user-admin users=model onDelete=(action "onDelete") onSave=(action "onSave") onPassword=(action "onPassword")}}
|
{{customize/user-admin users=model onDelete=(action "onDelete") onSave=(action "onSave") onPassword=(action "onPassword")}}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
|
||||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
beforeModel: function (transition) {
|
beforeModel: function (transition) {
|
||||||
if (is.equal(transition.targetName, 'folder.settings.index')) {
|
if (is.equal(transition.targetName, 'folder.settings.index')) {
|
||||||
this.transitionTo('folder.settings.invitation');
|
this.transitionTo('folder.settings.security');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default AjaxService.extend({
|
||||||
if (is.not.empty(userUpdate)) {
|
if (is.not.empty(userUpdate)) {
|
||||||
let latest = JSON.parse(userUpdate);
|
let latest = JSON.parse(userUpdate);
|
||||||
|
|
||||||
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin) {
|
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin || user.viewUsers !== latest.viewUsers) {
|
||||||
window.location.href = 'auth/login';
|
window.location.href = 'auth/login';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,15 @@ export default SimpleAuthSession.extend({
|
||||||
currentFolder: null,
|
currentFolder: null,
|
||||||
isMac: false,
|
isMac: false,
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
|
|
||||||
hasAccounts: computed('isAuthenticated', 'session.content.authenticated.user', function() {
|
hasAccounts: computed('isAuthenticated', 'session.content.authenticated.user', function() {
|
||||||
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.accounts').length > 0;
|
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.accounts').length > 0;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
accounts: computed('hasAccounts', function() {
|
accounts: computed('hasAccounts', function() {
|
||||||
return this.get('session.content.authenticated.user.accounts');
|
return this.get('session.content.authenticated.user.accounts');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
user: computed('isAuthenticated', 'session.content.authenticated.user', function () {
|
user: computed('isAuthenticated', 'session.content.authenticated.user', function () {
|
||||||
if (this.get('isAuthenticated')) {
|
if (this.get('isAuthenticated')) {
|
||||||
let user = this.get('session.content.authenticated.user') || { id: '0' };
|
let user = this.get('session.content.authenticated.user') || { id: '0' };
|
||||||
|
@ -39,19 +42,23 @@ export default SimpleAuthSession.extend({
|
||||||
return this.get('store').push(data);
|
return this.get('store').push(data);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
authenticated: computed('session.content.authenticated.user', function () {
|
authenticated: computed('session.content.authenticated.user', function () {
|
||||||
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.id') !== '0';
|
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.id') !== '0';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isAdmin: computed('session.content.authenticated.user', function () {
|
isAdmin: computed('session.content.authenticated.user', function () {
|
||||||
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
|
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
|
||||||
this.get('session.content.authenticated.user.id') !== '0' &&
|
this.get('session.content.authenticated.user.id') !== '0' &&
|
||||||
this.get('session.content.authenticated.user.admin') === true;
|
this.get('session.content.authenticated.user.admin') === true;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isEditor: computed('session.content.authenticated.user', function () {
|
isEditor: computed('session.content.authenticated.user', function () {
|
||||||
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
|
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
|
||||||
this.get('session.content.authenticated.user.id') !== '0' &&
|
this.get('session.content.authenticated.user.id') !== '0' &&
|
||||||
this.get('session.content.authenticated.user.editor') === true;
|
this.get('session.content.authenticated.user.editor') === true;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isGlobalAdmin: computed('session.content.authenticated.user', function () {
|
isGlobalAdmin: computed('session.content.authenticated.user', function () {
|
||||||
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
|
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
|
||||||
this.get('session.content.authenticated.user.id') !== '0' &&
|
this.get('session.content.authenticated.user.id') !== '0' &&
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
.page-customize {
|
.page-customize {
|
||||||
@include content-container();
|
|
||||||
|
|
||||||
.user-admin {
|
> .auth-admin, > .general-admin, > .license-admin, > .smtp-admin, > .space-admin {
|
||||||
|
@include content-container();
|
||||||
|
}
|
||||||
|
|
||||||
|
> .add-user {
|
||||||
|
@include content-container();
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .user-admin {
|
||||||
|
@include content-container();
|
||||||
margin: 30px 0;
|
margin: 30px 0;
|
||||||
|
|
||||||
> .heading {
|
> .heading {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<form class=>
|
<div class="page-customize">
|
||||||
|
<div class="auth-admin">
|
||||||
|
<form>
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">Authentication</div>
|
<div class="title">Authentication</div>
|
||||||
<div class="tip">Determine the method for user authentication</div>
|
<div class="tip">Determine the method for user authentication</div>
|
||||||
|
@ -70,3 +72,5 @@
|
||||||
|
|
||||||
<div class="regular-button button-blue" {{action 'onSave'}}>save</div>
|
<div class="regular-button button-blue" {{action 'onSave'}}>save</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,3 +1,5 @@
|
||||||
|
<div class="page-customize">
|
||||||
|
<div class="general-admin">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">Instance Settings</div>
|
<div class="title">Instance Settings</div>
|
||||||
|
@ -28,3 +30,5 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,3 +1,5 @@
|
||||||
|
<div class="page-customize">
|
||||||
|
<div class="smtp-admin">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">Mail Server Settings</div>
|
<div class="title">Mail Server Settings</div>
|
||||||
|
@ -30,10 +32,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="regular-button button-blue" {{ action 'saveSMTP' }}>save</div>
|
<div class="regular-button button-blue" {{ action 'saveSMTP' }}>save</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="margin-top-50">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="margin-top-50" />
|
||||||
|
|
||||||
|
<div class="license-admin">
|
||||||
<form class="form-bordered">
|
<form class="form-bordered">
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">Optional Edition License</div>
|
<div class="title">Optional Edition License</div>
|
||||||
|
@ -46,3 +49,5 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="regular-button button-blue" {{ action 'saveLicense' }}>save</div>
|
<div class="regular-button button-blue" {{ action 'saveLicense' }}>save</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<div class="page-customize">
|
||||||
<div class="user-admin">
|
<div class="user-admin">
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">User Management</div>
|
<div class="title">User Management</div>
|
||||||
|
@ -29,14 +30,14 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each users as |user|}}
|
{{#each users key="id" as |user|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="{{unless user.active 'inactive-user'}} {{if user.admin 'admin-user'}}">
|
<td class="{{unless user.active 'inactive-user'}} {{if user.admin 'admin-user'}}">
|
||||||
<div class="selector pull-left">
|
<div class="selector pull-left">
|
||||||
{{#if user.selected}}
|
{{#if user.me}}
|
||||||
<i class="material-icons checkbox" {{action 'toggleSelect' user}}>check_box</i>
|
|
||||||
{{else if user.me}}
|
|
||||||
<i class="material-icons color-gray">check_box_outline_blank</i>
|
<i class="material-icons color-gray">check_box_outline_blank</i>
|
||||||
|
{{else if user.selected}}
|
||||||
|
<i class="material-icons checkbox" {{action 'toggleSelect' user}}>check_box</i>
|
||||||
{{else}}
|
{{else}}
|
||||||
<i class="material-icons checkbox" {{action 'toggleSelect' user}}>check_box_outline_blank</i>
|
<i class="material-icons checkbox" {{action 'toggleSelect' user}}>check_box_outline_blank</i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -167,3 +168,4 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
{{#if isAuthProviderDocumize}}
|
{{#if isAuthProviderDocumize}}
|
||||||
|
<div class="page-customize">
|
||||||
|
<div class="add-user">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="title">Add user</div>
|
<div class="title">New User</div>
|
||||||
<div class="tip">New users receive an invitation email with a random password</div>
|
<div class="tip">Newly added users receive an invitation email with a random password</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<label>Firstname</label>
|
<label>Firstname</label>
|
||||||
|
@ -18,4 +20,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="regular-button button-blue" {{ action 'add' }}>Add</div>
|
<div class="regular-button button-blue" {{ action 'add' }}>Add</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
|
@ -169,11 +169,13 @@ func (m *middleware) Authorize(w http.ResponseWriter, r *http.Request, next http
|
||||||
Active bool `json:"active"`
|
Active bool `json:"active"`
|
||||||
Admin bool `json:"admin"`
|
Admin bool `json:"admin"`
|
||||||
Editor bool `json:"editor"`
|
Editor bool `json:"editor"`
|
||||||
|
ViewUsers bool `json:"viewUsers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
state.Active = u.Active
|
state.Active = u.Active
|
||||||
state.Admin = u.Admin
|
state.Admin = u.Admin
|
||||||
state.Editor = u.Editor
|
state.Editor = u.Editor
|
||||||
|
state.ViewUsers = u.ViewUsers
|
||||||
sb, err := json.Marshal(state)
|
sb, err := json.Marshal(state)
|
||||||
|
|
||||||
w.Header().Add("X-Documize-Status", string(sb))
|
w.Header().Add("X-Documize-Status", string(sb))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue