You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utility : Assign a role to user for certain time after that this will revoke after a day. (#1115)
* Utility : Assign a role to user for certain time after that this will revoke.
Utility : Assign a role to user for certain time after that this will revoke.
* Add readme.md file for the utility of AssignRoleToUserForADay
`AssignRoleToUserForADay.js` is a utility script designed to temporarily assign a role to a user for a single day. This can be useful for granting temporary permissions or access within an application.
5
+
6
+
## Features
7
+
- Assign a role to a user for 24 hours.
8
+
- Automatically revoke the role after the time period expires.
9
+
- Log actions for auditing purposes.
10
+
11
+
## Usage
12
+
1.**Import the script**:
13
+
```javascript
14
+
var assignRoleToUserForADay =require('./Utility/AssignRoleToUserForADay');
15
+
```
16
+
17
+
2.**Call the function**:
18
+
```javascript
19
+
assignRoleToUserForADay(userId, roleId)
20
+
.then(() => {
21
+
console.log('Role assigned successfully.');
22
+
})
23
+
.catch((error) => {
24
+
console.error('Error assigning role:', error);
25
+
});
26
+
```
27
+
28
+
## Parameters
29
+
-`userId` (String): The IDof the user to whom the role will be assigned.
30
+
-`roleId` (String): The IDof the role to be assigned.
31
+
32
+
## Example
33
+
```javascript
34
+
var assignRoleToUserForADay = require('./Utility/AssignRoleToUserForADay');
0 commit comments