feat(db): resource db access
Build Docker Image / build-nightly (push) Successful in 1m56s
Details
Build Docker Image / build-nightly (push) Successful in 1m56s
Details
This commit is contained in:
parent
4395458a7c
commit
72f4df12ad
|
@ -98,7 +98,7 @@ impl OAuthDatabase {
|
||||||
|
|
||||||
/// Issue a master token.
|
/// Issue a master token.
|
||||||
/// Applicant: master
|
/// Applicant: master
|
||||||
pub async fn trusted_issue_master_token(&mut self, description: &String) -> Result<crate::oauth_types::oauth_access::OAuthMasterDBAccess, tokio_postgres::Error> {
|
pub async fn trusted_issue_master_db_token(&mut self, description: &String) -> Result<crate::oauth_types::oauth_access::OAuthMasterDBAccess, tokio_postgres::Error> {
|
||||||
// TEST: functionality
|
// TEST: functionality
|
||||||
let access = crate::oauth_types::oauth_access::OAuthMasterDBAccess::create(description);
|
let access = crate::oauth_types::oauth_access::OAuthMasterDBAccess::create(description);
|
||||||
let hashed = crate::oauth_types::oauth_access::OAuthHashedMasterDBAccess::from(&access);
|
let hashed = crate::oauth_types::oauth_access::OAuthHashedMasterDBAccess::from(&access);
|
||||||
|
@ -107,6 +107,13 @@ impl OAuthDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: other type of db tokens
|
// TODO: other type of db tokens
|
||||||
|
pub async fn trusted_issue_resource_db_token(&mut self, resource_id: &Uuid, description: &String) -> Result<crate::oauth_types::oauth_access::OAuthResourceDBAccess, tokio_postgres::Error> {
|
||||||
|
// TEST: functionality
|
||||||
|
let access = crate::oauth_types::oauth_access::OAuthResourceDBAccess::create(resource_id, description);
|
||||||
|
let hashed = crate::oauth_types::oauth_access::OAuthHashedResourceDBAccess::from(&access);
|
||||||
|
self.psql_execute("insert into ResourceDBAccess(resource_db_id, resource_id, resource_db_token, resource_db_desc) values ($1, $2, $3, $4)", &[&hashed.resource_db_id, &hashed.resource_id, &hashed.resource_db_token, &hashed.resource_db_desc]).await?;
|
||||||
|
Ok(access)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue