SAML; Dashboard
This commit is contained in:
35
app/controllers/dash/Groups.controller.js
Normal file
35
app/controllers/dash/Groups.controller.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const { Controller } = require('libflitter')
|
||||
|
||||
class GroupsController extends Controller {
|
||||
static get services() {
|
||||
return [...super.services, 'cobalt', 'models']
|
||||
}
|
||||
|
||||
async get_listing(req, res, next) {
|
||||
const Group = this.models.get('ldap:Group')
|
||||
const groups = await Group.find()
|
||||
const formatted = groups.map(x => {
|
||||
return {
|
||||
name: x.name,
|
||||
count: x.user_ids.length,
|
||||
}
|
||||
})
|
||||
|
||||
return this.cobalt.listing(req, res, {
|
||||
title: 'LDAP Groups', // TODO generalize this for SAML/OAuth2
|
||||
columns: [
|
||||
{
|
||||
name: 'Group Name',
|
||||
field: 'name',
|
||||
},
|
||||
{
|
||||
name: '# Users',
|
||||
field: 'count',
|
||||
},
|
||||
],
|
||||
data: formatted,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = GroupsController
|
||||
16
app/controllers/dash/Profile.controller.js
Normal file
16
app/controllers/dash/Profile.controller.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { Controller } = require('libflitter')
|
||||
|
||||
class ProfileController extends Controller {
|
||||
static get services() {
|
||||
return [...super.services, 'Vue']
|
||||
}
|
||||
|
||||
async get_page(req, res, next) {
|
||||
return res.page('dash:profile:main', {
|
||||
...this.Vue.data(),
|
||||
...this.Vue.session(req)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = ProfileController
|
||||
46
app/controllers/dash/SAML.controller.js
Normal file
46
app/controllers/dash/SAML.controller.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const { Controller } = require('libflitter')
|
||||
|
||||
class SAMLController extends Controller {
|
||||
static get services() {
|
||||
return [...super.services, 'cobalt', 'models']
|
||||
}
|
||||
|
||||
async get_sp_listing(req, res, next) {
|
||||
const ServiceProvider = this.models.get('saml:ServiceProvider')
|
||||
const service_providers = await ServiceProvider.find()
|
||||
const formatted = service_providers.map(x => {
|
||||
return {
|
||||
name: x.name,
|
||||
entity_id: x.entity_id,
|
||||
acs_url: x.acs_url,
|
||||
has_slo: !!x.slo_url,
|
||||
}
|
||||
})
|
||||
|
||||
return this.cobalt.listing(req, res, {
|
||||
title: 'SAML Service Providers',
|
||||
columns: [
|
||||
{
|
||||
name: 'Provider Name',
|
||||
field: 'name',
|
||||
},
|
||||
{
|
||||
name: 'Entity ID',
|
||||
field: 'entity_id',
|
||||
},
|
||||
{
|
||||
name: 'Has SLO?',
|
||||
field: 'has_slo',
|
||||
renderer: 'boolean',
|
||||
},
|
||||
{
|
||||
name: 'ACS URL',
|
||||
field: 'acs_url',
|
||||
},
|
||||
],
|
||||
data: formatted,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = SAMLController
|
||||
47
app/controllers/dash/Users.controller.js
Normal file
47
app/controllers/dash/Users.controller.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const { Controller } = require('libflitter')
|
||||
|
||||
class UsersController extends Controller {
|
||||
static get services() {
|
||||
return [...super.services, 'models', 'cobalt']
|
||||
}
|
||||
|
||||
async get_listing(req, res, next) {
|
||||
// Columns: Username, First, Last, E-Mail
|
||||
const User = this.models.get('auth:User')
|
||||
const users = await User.find()
|
||||
const formatted = users.map(x => {
|
||||
return {
|
||||
username: x.uid,
|
||||
first: x.first_name,
|
||||
last: x.last_name,
|
||||
email: x.email,
|
||||
}
|
||||
})
|
||||
|
||||
return this.cobalt.listing(req, res, {
|
||||
title: 'Users',
|
||||
columns: [
|
||||
{
|
||||
name: 'Username',
|
||||
field: 'username',
|
||||
},
|
||||
{
|
||||
name: 'First Name',
|
||||
field: 'first',
|
||||
},
|
||||
{
|
||||
name: 'Last Name',
|
||||
field: 'last',
|
||||
},
|
||||
{
|
||||
name: 'E-Mail Address',
|
||||
field: 'email',
|
||||
},
|
||||
],
|
||||
data: formatted,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = exports = UsersController
|
||||
Reference in New Issue
Block a user