profile.flags
diff --git a/locale/en/translations.suml b/locale/en/translations.suml
index 65bcdb48..b6c0632e 100644
--- a/locale/en/translations.suml
+++ b/locale/en/translations.suml
@@ -429,7 +429,7 @@ admin:
user:
user: 'User'
email: 'Email'
- roles: 'Role'
+ roles: 'Permissions'
profiles: 'Profiles'
confirmRole: 'Are you sure you want to switch @%username%''s role to "%role%"?'
diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml
index 67e37453..259f768b 100644
--- a/locale/pl/translations.suml
+++ b/locale/pl/translations.suml
@@ -990,7 +990,7 @@ admin:
user:
user: 'Użytkownicze'
email: 'Email'
- roles: 'Rola'
+ roles: 'Uprawnienia'
profiles: 'Profile'
confirmRole: 'Czy na pewno chcesz zmienić rolę osoby @%username% na "%role%"?'
diff --git a/migrations/015-permissions.sql b/migrations/015-permissions.sql
new file mode 100644
index 00000000..6fd53f03
--- /dev/null
+++ b/migrations/015-permissions.sql
@@ -0,0 +1,9 @@
+-- Up
+
+UPDATE users SET roles = '*' WHERE roles = 'admin';
+UPDATE users SET roles = '' WHERE roles = 'user';
+
+-- Down
+
+UPDATE users SET roles = 'admin' WHERE roles = '*';
+UPDATE users SET roles = 'user' WHERE roles = '';
diff --git a/plugins/auth.js b/plugins/auth.js
index cb682dfa..f2c5c861 100644
--- a/plugins/auth.js
+++ b/plugins/auth.js
@@ -1,5 +1,6 @@
import Vue from 'vue';
-import t from "../src/translator";
+import config from '../data/config.suml';
+import {isGranted} from "../src/helpers";
export default ({app, store}) => {
const token = app.$cookies.get('token');
@@ -11,7 +12,7 @@ export default ({app, store}) => {
}
Vue.prototype.$user = _ => store.state.user;
- Vue.prototype.$admin = _ => {
- return store.state.user && store.state.user.authenticated && store.state.user.roles === 'admin';
- };
+ Vue.prototype.$isGranted = (area) => {
+ return store.state.user && store.state.user.authenticated && isGranted(store.state.user, config.locale, area);
+ }
}
diff --git a/routes/admin.vue b/routes/admin.vue
index 3d8886f9..b64b3494 100644
--- a/routes/admin.vue
+++ b/routes/admin.vue
@@ -1,20 +1,34 @@
-
+
admin.header
-
+
Users
- ({{stats.users.overall}}, {{stats.users.admins}} admins)
+ ({{stats.users.overall}} overall, {{stats.users.admins}} admins, {{visibleUsers.length}} visible)
|