Implement OAuth2 server, link oauth:Client and auth::Oauth2Client, implement permission checks
This commit is contained in:
@@ -35,15 +35,23 @@ class ClientModel extends Model {
|
||||
return client
|
||||
}
|
||||
|
||||
async invoke() {
|
||||
this.last_invocation = new Date
|
||||
}
|
||||
|
||||
async user() {
|
||||
const User = this.models.get('auth:User')
|
||||
return User.findById(this.user_id)
|
||||
}
|
||||
|
||||
async application() {
|
||||
const Application = this.models.get('Application')
|
||||
return Application.findOne({ active: true, ldap_client_ids: this.id })
|
||||
}
|
||||
|
||||
async to_api() {
|
||||
const User = this.models.get('auth:User')
|
||||
const user = await User.findById(this.user_id)
|
||||
|
||||
const role_permissions = user.roles.map(x => this.configs.get('auth.roles')[x])
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user