fixes bug (#809)
This commit is contained in:
parent
4a7936a51d
commit
3bdd551d40
@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"db_name": "PostgreSQL",
|
"db_name": "PostgreSQL",
|
||||||
"query": "\n UPDATE team_members\n SET \n is_owner = TRUE,\n accepted = TRUE,\n permissions = $1,\n organization_permissions = NULL,\n role = 'Inherited Owner'\n WHERE (id = $1)\n ",
|
"query": "\n UPDATE team_members\n SET \n is_owner = TRUE,\n accepted = TRUE,\n permissions = $2,\n organization_permissions = NULL,\n role = 'Inherited Owner'\n WHERE (id = $1)\n ",
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [],
|
"columns": [],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"Left": [
|
"Left": [
|
||||||
|
"Int8",
|
||||||
"Int8"
|
"Int8"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"nullable": []
|
"nullable": []
|
||||||
},
|
},
|
||||||
"hash": "f40153d1516fe93e4179c14d00e1667baa7bb9157f58a5017e710d09fd295eb0"
|
"hash": "dc64653d72645b76e42a1834124ce3f9225c5b6b8b941812167b3b7002bfdb2a"
|
||||||
}
|
}
|
||||||
@ -858,12 +858,13 @@ pub async fn organization_projects_remove(
|
|||||||
SET
|
SET
|
||||||
is_owner = TRUE,
|
is_owner = TRUE,
|
||||||
accepted = TRUE,
|
accepted = TRUE,
|
||||||
permissions = $1,
|
permissions = $2,
|
||||||
organization_permissions = NULL,
|
organization_permissions = NULL,
|
||||||
role = 'Inherited Owner'
|
role = 'Inherited Owner'
|
||||||
WHERE (id = $1)
|
WHERE (id = $1)
|
||||||
",
|
",
|
||||||
new_owner.id as database::models::ids::TeamMemberId
|
new_owner.id as database::models::ids::TeamMemberId,
|
||||||
|
ProjectPermissions::all().bits() as i64
|
||||||
)
|
)
|
||||||
.execute(&mut *transaction)
|
.execute(&mut *transaction)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
@ -459,6 +459,20 @@ async fn add_remove_organization_project_ownership_to_user() {
|
|||||||
.await;
|
.await;
|
||||||
assert_eq!(resp.status(), 400);
|
assert_eq!(resp.status(), 400);
|
||||||
|
|
||||||
|
// Set user's permissions within the project that it is a member of to none (for a later test)
|
||||||
|
let resp = test_env
|
||||||
|
.api
|
||||||
|
.edit_team_member(
|
||||||
|
alpha_team_id,
|
||||||
|
USER_USER_ID,
|
||||||
|
json!({
|
||||||
|
"project_permissions": 0,
|
||||||
|
}),
|
||||||
|
FRIEND_USER_PAT,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
assert_eq!(resp.status(), 204);
|
||||||
|
|
||||||
// Remove project from organization with a user that is an organization member, and a project member
|
// Remove project from organization with a user that is an organization member, and a project member
|
||||||
// This should succeed
|
// This should succeed
|
||||||
let resp = test_env
|
let resp = test_env
|
||||||
@ -487,6 +501,7 @@ async fn add_remove_organization_project_ownership_to_user() {
|
|||||||
|
|
||||||
// For each of alpha and beta, confirm:
|
// For each of alpha and beta, confirm:
|
||||||
// - There is one member of each project, the owner, USER_USER_ID
|
// - There is one member of each project, the owner, USER_USER_ID
|
||||||
|
// - In addition to being the owner, they have full permissions (even though they were set to none earlier)
|
||||||
// - They no longer have an attached organization
|
// - They no longer have an attached organization
|
||||||
for team_id in [alpha_team_id, beta_team_id] {
|
for team_id in [alpha_team_id, beta_team_id] {
|
||||||
let members = test_env
|
let members = test_env
|
||||||
@ -497,6 +512,10 @@ async fn add_remove_organization_project_ownership_to_user() {
|
|||||||
let user_member = members.iter().filter(|m| m.is_owner).collect::<Vec<_>>();
|
let user_member = members.iter().filter(|m| m.is_owner).collect::<Vec<_>>();
|
||||||
assert_eq!(user_member.len(), 1);
|
assert_eq!(user_member.len(), 1);
|
||||||
assert_eq!(user_member[0].user.id.to_string(), USER_USER_ID);
|
assert_eq!(user_member[0].user.id.to_string(), USER_USER_ID);
|
||||||
|
assert_eq!(
|
||||||
|
user_member[0].permissions.unwrap(),
|
||||||
|
ProjectPermissions::all()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for project_id in [alpha_project_id, beta_project_id] {
|
for project_id in [alpha_project_id, beta_project_id] {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user