Skip to content
English
  • There are no suggestions because the search field is empty.

Disable FileCloud Users Who Have Never Logged In After 60 Days

Disable FileCloud Users Who Have Never Logged In After 60 Days

Original Question or Issue:

How to identify and disable FileCloud user accounts that:

  • Were created more than 60 days ago.
  • Have never logged in.
  • Are currently enabled.

Environment:

  • Product - FileCloud Server
  • Version - Any
  • Platform - Windows

Steps to Reproduce:


Error or Log Message:


Defect or Enhancement Number:


Cause:


Resolution or Workaround:

1. Open MongoDB Shell

Open mongosh on your MongoDB server.

mongosh

2. Identify the FileCloud Database

show databases

Select the FileCloud database:

use tonidoclouddb

Replace tonidoclouddb with the actual FileCloud database name.

3. Test the Query Using a 5-Minute Cutoff

const cutoff = new Date(Date.now() - 5 * 60 * 1000);  db.users.find(     {         createdon: { $lt: cutoff },         lastlogindate: "",         status: 1     },     {         _id: 0,         username: 1,         emailid: 1,         createdon: 1,         lastlogindate: 1,         status: 1     } )

4. Disable the Matching Test Users

const cutoff = new Date(Date.now() - 5 * 60 * 1000);  db.users.updateMany(     {         createdon: { $lt: cutoff },         lastlogindate: "",         status: 1     },     {         $set: { status: 2 }     } )

5. Change the Cutoff to 60 Days

const cutoff = new Date(Date.now() - 60 * 24 * 60 * 60 * 1000);

6. Check Users Matching the 60-Day Rule

const cutoff = new Date(Date.now() - 60 * 24 * 60 * 60 * 1000);  db.users.find(     {         createdon: { $lt: cutoff },         lastlogindate: "",         status: 1     },     {         _id: 0,         username: 1,         emailid: 1,         createdon: 1,         lastlogindate: 1,         status: 1     } )

7. Disable Users Who Have Never Logged In After 60 Days

const cutoff = new Date(Date.now() - 60 * 24 * 60 * 60 * 1000);  db.users.updateMany(     {         createdon: { $lt: cutoff },         lastlogindate: "",         status: 1     },     {         $set: { status: 2 }     } )

8. Verify the Disabled Users

db.users.find(     {         createdon: { $lt: cutoff },         lastlogindate: "",         status: 2     },     {         _id: 0,         username: 1,         emailid: 1,         createdon: 1,         lastlogindate: 1,         status: 1     } )

9. User Status Values

status: 0 = Guest status: 1 = Full / Enabled status: 2 = Disabled status: 3 = External

 

 


Notes: