Adjusted queries
Since this is becoming a kubernetes controller there is no need to keep track of which users are managed in lldap
This commit is contained in:
parent
31eb05d098
commit
28fe0e333d
|
@ -3,49 +3,7 @@ pub(crate) mod schema {}
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
#[derive(cynic::QueryFragment, Debug)]
|
||||||
#[cynic(graphql_type = "Query")]
|
#[cynic(graphql_type = "Query")]
|
||||||
pub struct GetUserAttributes {
|
pub struct ListUsers {
|
||||||
pub schema: Schema,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
|
||||||
pub struct Schema {
|
|
||||||
pub user_schema: AttributeList,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
|
||||||
pub struct AttributeList {
|
|
||||||
pub attributes: Vec<AttributeSchema>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
|
||||||
pub struct AttributeSchema {
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
|
||||||
#[cynic(graphql_type = "Mutation")]
|
|
||||||
pub struct CreateManagedUserAttribute {
|
|
||||||
#[arguments(attributeType: "INTEGER", isEditable: false, isList: false, isVisible: false, name: "managed")]
|
|
||||||
pub add_user_attribute: Success,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
|
||||||
pub struct Success {
|
|
||||||
pub ok: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::Enum, Clone, Copy, Debug)]
|
|
||||||
pub enum AttributeType {
|
|
||||||
String,
|
|
||||||
Integer,
|
|
||||||
JpegPhoto,
|
|
||||||
DateTime,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
|
||||||
#[cynic(graphql_type = "Query")]
|
|
||||||
pub struct ListManagedUsers {
|
|
||||||
#[arguments(filters: { eq: { field: "managed", value: "1" } })]
|
|
||||||
pub users: Vec<User>,
|
pub users: Vec<User>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +24,11 @@ pub struct DeleteUser {
|
||||||
pub delete_user: Success,
|
pub delete_user: Success,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(cynic::QueryFragment, Debug)]
|
||||||
|
pub struct Success {
|
||||||
|
pub ok: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(cynic::QueryVariables, Debug)]
|
#[derive(cynic::QueryVariables, Debug)]
|
||||||
pub struct CreateUserVariables<'a> {
|
pub struct CreateUserVariables<'a> {
|
||||||
pub id: &'a str,
|
pub id: &'a str,
|
||||||
|
@ -74,7 +37,7 @@ pub struct CreateUserVariables<'a> {
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
#[derive(cynic::QueryFragment, Debug)]
|
||||||
#[cynic(graphql_type = "Mutation", variables = "CreateUserVariables")]
|
#[cynic(graphql_type = "Mutation", variables = "CreateUserVariables")]
|
||||||
pub struct CreateUser {
|
pub struct CreateUser {
|
||||||
#[arguments(user: { attributes: { name: "managed", value: "1" }, email: $id, id: $id })]
|
#[arguments(user: { email: $id, id: $id })]
|
||||||
pub create_user: User,
|
pub create_user: User,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,22 +61,8 @@ mod tests {
|
||||||
use cynic::QueryBuilder;
|
use cynic::QueryBuilder;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn get_user_attributes_gql_output() {
|
fn list_users_gql_output() {
|
||||||
let operation = GetUserAttributes::build(());
|
let operation = ListUsers::build(());
|
||||||
|
|
||||||
insta::assert_snapshot!(operation.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn create_managed_user_attribute_gql_output() {
|
|
||||||
let operation = CreateManagedUserAttribute::build(());
|
|
||||||
|
|
||||||
insta::assert_snapshot!(operation.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn list_managed_users_gql_output() {
|
|
||||||
let operation = ListManagedUsers::build(());
|
|
||||||
|
|
||||||
insta::assert_snapshot!(operation.query);
|
insta::assert_snapshot!(operation.query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
source: queries/src/lib.rs
|
|
||||||
expression: operation.query
|
|
||||||
---
|
|
||||||
mutation CreateManagedUserAttribute {
|
|
||||||
addUserAttribute(attributeType: INTEGER, isEditable: false, isList: false, isVisible: false, name: "managed") {
|
|
||||||
ok
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
source: src/lib.rs
|
source: queries/src/lib.rs
|
||||||
assertion_line: 142
|
|
||||||
expression: operation.query
|
expression: operation.query
|
||||||
---
|
---
|
||||||
mutation CreateUser($id: String!) {
|
mutation CreateUser($id: String!) {
|
||||||
createUser(user: {attributes: [{name: "managed", value: ["1"]}], email: $id, id: $id}) {
|
createUser(user: {email: $id, id: $id}) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
source: src/lib.rs
|
|
||||||
expression: operation.query
|
|
||||||
---
|
|
||||||
query GetUserAttributes {
|
|
||||||
schema {
|
|
||||||
userSchema {
|
|
||||||
attributes {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
source: src/lib.rs
|
|
||||||
expression: operation.query
|
|
||||||
---
|
|
||||||
query ListManagedUsers {
|
|
||||||
users(filters: {eq: {field: "managed", value: "1"}}) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
source: queries/src/lib.rs
|
||||||
|
expression: operation.query
|
||||||
|
---
|
||||||
|
query ListUsers {
|
||||||
|
users {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user