mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove organization_id suffix from org_member roles in database (#13473)
Organization member's table is already scoped to an organization. Rolename should avoid having the org_id appended. Wipes all existing organization role assignments, which should not be used anyway.
This commit is contained in:
@@ -68,7 +68,7 @@ func TestExtractUserRoles(t *testing.T) {
|
||||
Roles: orgRoles,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
return user, append(roles, append(orgRoles, rbac.RoleMember(), rbac.RoleOrgMember(org.ID))...), token
|
||||
return user, append(roles, append(orgRoles, rbac.RoleMember(), rbac.ScopedRoleOrgMember(org.ID))...), token
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -89,7 +89,8 @@ func TestExtractUserRoles(t *testing.T) {
|
||||
|
||||
orgRoles := []string{}
|
||||
if i%2 == 0 {
|
||||
orgRoles = append(orgRoles, rbac.RoleOrgAdmin(organization.ID))
|
||||
orgRoles = append(orgRoles, rbac.RoleOrgAdmin())
|
||||
roles = append(roles, rbac.ScopedRoleOrgAdmin(organization.ID))
|
||||
}
|
||||
_, err = db.InsertOrganizationMember(context.Background(), database.InsertOrganizationMemberParams{
|
||||
OrganizationID: organization.ID,
|
||||
@@ -99,8 +100,7 @@ func TestExtractUserRoles(t *testing.T) {
|
||||
Roles: orgRoles,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
roles = append(roles, orgRoles...)
|
||||
roles = append(roles, rbac.RoleOrgMember(organization.ID))
|
||||
roles = append(roles, rbac.ScopedRoleOrgMember(organization.ID))
|
||||
}
|
||||
return user, roles, token
|
||||
},
|
||||
|
||||
@@ -152,7 +152,7 @@ func TestOrganizationParam(t *testing.T) {
|
||||
_ = dbgen.OrganizationMember(t, db, database.OrganizationMember{
|
||||
OrganizationID: organization.ID,
|
||||
UserID: user.ID,
|
||||
Roles: []string{rbac.RoleOrgMember(organization.ID)},
|
||||
Roles: []string{rbac.ScopedRoleOrgMember(organization.ID)},
|
||||
})
|
||||
_, err := db.UpdateUserRoles(ctx, database.UpdateUserRolesParams{
|
||||
ID: user.ID,
|
||||
|
||||
Reference in New Issue
Block a user