-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New command: Revoke Sign-in Sessions
- Loading branch information
Showing
3 changed files
with
11 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import Global from '/docs/cmd/_global.mdx'; | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
# entra user session revoke | ||
|
||
|
@@ -30,7 +28,7 @@ m365 entra user session revoke [options] | |
|
||
:::info | ||
|
||
The user with at least User Administrator role can revoke sign-in sessions of other users. | ||
To use this command you must be either **User Administrator** or **Global Administrator**. | ||
|
||
::: | ||
|
||
|
@@ -64,42 +62,4 @@ m365 entra user session revoke --userName [email protected] --for | |
|
||
## Response | ||
|
||
<Tabs> | ||
<TabItem value="JSON"> | ||
|
||
```json | ||
{ | ||
"value": true | ||
} | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="Text"> | ||
|
||
```text | ||
value: true | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="CSV"> | ||
|
||
```csv | ||
value | ||
1 | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="Markdown"> | ||
|
||
```md | ||
# entra user session revoke --userName "[email protected]" --force "true" | ||
|
||
Date: 1/5/2025 | ||
|
||
Property | Value | ||
---------|------- | ||
value | true | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
The command won't return a response on success. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,14 @@ import { CommandError } from '../../../../Command.js'; | |
import { z } from 'zod'; | ||
import { CommandInfo } from '../../../../cli/CommandInfo.js'; | ||
import { cli } from '../../../../cli/cli.js'; | ||
import { formatting } from '../../../../utils/formatting.js'; | ||
|
||
describe(commands.USER_SESSION_REVOKE, () => { | ||
const userId = 'abcd1234-de71-4623-b4af-96380a352509'; | ||
const userName = '[email protected]'; | ||
|
||
let log: string[]; | ||
let logger: Logger; | ||
let loggerLogSpy: sinon.SinonSpy; | ||
let promptIssued: boolean; | ||
let commandInfo: CommandInfo; | ||
let commandOptionsSchema: z.ZodTypeAny; | ||
|
@@ -53,7 +53,6 @@ describe(commands.USER_SESSION_REVOKE, () => { | |
return false; | ||
}); | ||
promptIssued = false; | ||
loggerLogSpy = sinon.spy(logger, 'log'); | ||
}); | ||
|
||
afterEach(() => { | ||
|
@@ -119,8 +118,8 @@ describe(commands.USER_SESSION_REVOKE, () => { | |
}); | ||
|
||
it('revokes all sign-in sessions for a user specified by userId without prompting for confirmation', async () => { | ||
sinon.stub(request, 'post').callsFake(async (opts) => { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/users('${userId}')/revokeSignInSessions`) { | ||
const postStub = sinon.stub(request, 'post').callsFake(async (opts) => { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/users('${formatting.encodeQueryParameter(userId)}')/revokeSignInSessions`) { | ||
return { | ||
value: true | ||
}; | ||
|
@@ -131,12 +130,12 @@ describe(commands.USER_SESSION_REVOKE, () => { | |
|
||
const parsedSchema = commandOptionsSchema.safeParse({ userId: userId, force: true, verbose: true }); | ||
await command.action(logger, { options: parsedSchema.data }); | ||
assert(loggerLogSpy.calledOnceWith({ value: true })); | ||
assert(postStub.calledOnce); | ||
}); | ||
|
||
it('revokes all sign-in sessions for a user specified by UPN while prompting for confirmation', async () => { | ||
const postRequestStub = sinon.stub(request, 'post').callsFake(async (opts) => { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/users('${userName}')/revokeSignInSessions`) { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/users('${formatting.encodeQueryParameter(userName)}')/revokeSignInSessions`) { | ||
return { | ||
value: true | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters