Skip to content

Commit b620cda

Browse files
authored
Merge pull request #225 from Jemiiah/add-docstring-revoke-access
featl added comprehensive docstring to revoke_access function
2 parents 7b62d90 + 5d14f5a commit b620cda

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎contracts/course/course_access/src/functions/revoke_access.rs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,22 @@ use crate::error::{Error, handle_error};
88

99
const COURSE_ACCESS_REVOKE_EVENT: Symbol = symbol_short!("crsAcRvk");
1010

11-
/// Revoke access for a specific user from a course
11+
/// Revokes a user's access to a specific course and updates all related storage entries.
12+
///
13+
/// This function removes the course access entry for the specified user, updates the user's
14+
/// course list by removing the course, and updates the course's user list by removing the user.
15+
/// It also publishes an event to notify about the access revocation.
16+
///
17+
/// # Arguments
18+
///
19+
/// * `env` - The Soroban environment for accessing storage and publishing events.
20+
/// * `course_id` - The unique identifier of the course from which access is being revoked.
21+
/// * `user` - The address of the user whose access is being revoked.
22+
///
23+
/// # Returns
24+
///
25+
/// * `bool` - Returns `true` if the access was successfully revoked (entry existed and was removed),
26+
/// or `false` if no access entry was found for the user-course combination.
1227
pub fn course_access_revoke_access(env: Env, course_id: String, user: Address) -> bool {
1328
// Validate input parameters
1429
if course_id.is_empty() {

0 commit comments

Comments
 (0)