You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreID/app/models/saml/ServiceProvider.model.js

35 lines
837 B

const { Model } = require('flitter-orm')
class ServiceProviderModel extends Model {
static get services() {
return [...super.services, 'models']
}
static get schema() {
return {
name: String,
entity_id: String,
acs_url: String,
active: { type: Boolean, default: true },
slo_url: String,
}
}
async application() {
const Application = this.models.get('Application')
return Application.findOne({ active: true, saml_service_provider_ids: this.id })
}
to_api() {
return {
id: this.id,
name: this.name,
entity_id: this.entity_id,
acs_url: this.acs_url,
slo_url: this.slo_url,
}
}
}
module.exports = exports = ServiceProviderModel