Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
delete delete button from project rows
Thiago Araujo da Silva7c0041362874
diff --git a/backend/src/services/identity/identity-org-dal.ts b/backend/src/services/identity/identity-org-dal.tsindex 00f2e47b7c..202d17d035 100644--- a/backend/src/services/identity/identity-org-dal.ts+++ b/backend/src/services/identity/identity-org-dal.ts@@ -755,9 +755,10 @@ export const identityOrgDALFactory = (db: TDbClient) => {.leftJoin(TableName.MembershipRole, `${TableName.MembershipRole}.membershipId`, `${TableName.Membership}.id`).leftJoin(TableName.Role, `${TableName.MembershipRole}.customRoleId`, `${TableName.Role}.id`).where(applyScopeFilter)- .groupBy(`${TableName.Membership}.id`, `${TableName.Identity}.name`)+ .groupBy(`${TableName.Membership}.id`, `${TableName.Identity}.name`, `${TableName.Membership}.lastLoginTime`).select(`${TableName.Membership}.id`).select(db.ref("name").withSchema(TableName.Identity).as("identityName"))+ .select(db.ref("lastLoginTime").withSchema(TableName.Membership).as("lastLoginSort")).select<{ id: string; identityName: string; roleSort: string; total_count: string }>(db.raw(`MIN(COALESCE(??, ??)) as "roleSort"`, [`${TableName.Role}.slug`, `${TableName.MembershipRole}.role`]))@@ -780,6 +781,10 @@ export const identityOrgDALFactory = (db: TDbClient) => {if (orderBy === OrgIdentityOrderBy.Role) {void searchedMemberships.orderBy("roleSort", orderDirection);+ } else if (orderBy === OrgIdentityOrderBy.LastLogin) {+ // Rely on Postgres default null ordering: DESC surfaces never-used identities first,+ // ASC pushes them to the bottom.+ void searchedMemberships.orderBy("lastLoginSort", orderDirection);} else {void searchedMemberships.orderBy("identityName", orderDirection);}@@ -924,6 +929,8 @@ export const identityOrgDALFactory = (db: TDbClient) => {if (orderBy === OrgIdentityOrderBy.Role) {void query.orderBy("searchedMemberships.roleSort", orderDirection);+ } else if (orderBy === OrgIdentityOrderBy.LastLogin) {+ void query.orderBy("searchedMemberships.lastLoginSort", orderDirection);} else {void query.orderBy("searchedMemberships.identityName", orderDirection);}diff --git a/backend/src/services/identity/identity-types.ts b/backend/src/services/identity/identity-types.tsindex 02845da0fd..bd34b6c05d 100644--- a/backend/src/services/identity/identity-types.ts+++ b/backend/src/services/identity/identity-types.ts@@ -48,7 +48,8 @@ export type TListOrgIdentitiesByOrgIdDTO = {export enum OrgIdentityOrderBy {Name = "name",- Role = "role"+ Role = "role",+ LastLogin = "lastLogin"}export type TSearchOrgIdentitiesByOrgIdDAL = {diff --git a/frontend/src/hooks/api/organization/types.ts b/frontend/src/hooks/api/organization/types.tsindex 97286ab044..44e2f6e96a 100644--- a/frontend/src/hooks/api/organization/types.ts+++ b/frontend/src/hooks/api/organization/types.ts@@ -171,7 +171,8 @@ export type TOrgIdentitiesList = {export enum OrgIdentityOrderBy {Name = "name",- Role = "role"+ Role = "role",+ LastLogin = "lastLogin"}export enum OrgMembershipStatus {diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsxindex a0b2e8b3f3..400497b23a 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx@@ -200,7 +200,10 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {}setOrderBy(column);- setOrderDirection(OrderByDirection.ASC);+ // Last-used reads more naturally newest-first; other columns start ascending.+ setOrderDirection(+ column === OrgIdentityOrderBy.LastLogin ? OrderByDirection.DESC : OrderByDirection.ASC+ );};const handleChangeRole = async ({ identityId, role }: { identityId: string; role: string }) => {@@ -358,7 +361,21 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {)}/></TableHead>- <TableHead className={isSubOrganization ? "w-1/5" : "w-1/4"}>Last Used</TableHead>+ <TableHead+ className={twMerge("cursor-pointer", isSubOrganization ? "w-1/5" : "w-1/4")}+ onClick={() => handleSort(OrgIdentityOrderBy.LastLogin)}+ >+ Last Used+ <ChevronDownIcon+ className={twMerge(+ "transition-transform",+ orderBy === OrgIdentityOrderBy.LastLogin &&+ orderDirection === OrderByDirection.DESC &&+ "rotate-180",+ orderBy !== OrgIdentityOrderBy.LastLogin && "opacity-30"+ )}+ />+ </TableHead>{isSubOrganization && <TableHead className="w-1/5">Managed By</TableHead>}<TableHead className="w-5" /></TableRow>@@ -659,29 +676,31 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {</DropdownMenuItem>)}</OrgPermissionCan>- <OrgPermissionCan- I={OrgPermissionIdentityActions.Delete}- a={OrgPermissionSubjects.Identity}- >- {(isAllowed) => (- <DropdownMenuItem- variant="danger"- onClick={(e) => {- e.stopPropagation();- handlePopUpOpen("deleteIdentity", {- identityId: id,- name- });- }}- isDisabled={!isAllowed}- >- <TrashIcon />- {isSubOrgIdentity- ? "Delete Machine Identity"- : "Remove From Sub-Organization"}- </DropdownMenuItem>- )}- </OrgPermissionCan>+ {!isProjectScoped && (+ <OrgPermissionCan+ I={OrgPermissionIdentityActions.Delete}+ a={OrgPermissionSubjects.Identity}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ onClick={(e) => {+ e.stopPropagation();+ handlePopUpOpen("deleteIdentity", {+ identityId: id,+ name+ });+ }}+ isDisabled={!isAllowed}+ >+ <TrashIcon />+ {isSubOrgIdentity+ ? "Delete Machine Identity"+ : "Remove From Sub-Organization"}+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ )}</DropdownMenuContent></DropdownMenu></TableCell>