Skip to content

Admin Management and Moderator Functions Sequence Diagrams

Mehmet Caglar Kurt edited this page Apr 7, 2025 · 9 revisions

Manage User Accounts

Diagram

image

Code

@startuml
actor Admin
participant ":Admin" as AdminObj
participant ":User" as UserObj
participant "System" as System

Admin -> AdminObj: manageAccounts()
AdminObj -> System: requestUserList()
alt Success
System --> AdminObj: returnUserList()
else System Error
System --> AdminObj: error("Database unavailable")
AdminObj --> Admin: showError("Failed to load users")
return
end

alt Create User
Admin -> AdminObj: createUser(username, email, password)
alt Valid Input
AdminObj -> UserObj: signUp(username, email, password)
alt Unique Username
UserObj -> System: saveUserData()
alt Success
System --> AdminObj: userCreated()
AdminObj --> Admin: showConfirmation("User created")
else Database Error
System --> AdminObj: error("Save failed")
AdminObj --> Admin: showError("Failed to create user")
end
else Duplicate Username
UserObj --> AdminObj: error("Username exists")
AdminObj --> Admin: showError("Username already taken")
end
else Invalid Input
AdminObj --> Admin: error("Invalid data")
AdminObj --> Admin: showError("Invalid user details")
end
else Edit User
Admin -> AdminObj: editUser(userID, newData)
alt User Exists
AdminObj -> UserObj: editProfile(newData)
UserObj -> System: updateUserData()
alt Success
System --> AdminObj: userUpdated()
AdminObj --> Admin: showConfirmation("User updated")
else Update Error
System --> AdminObj: error("Update failed")
AdminObj --> Admin: showError("Failed to update user")
end
else User Not Found
AdminObj --> Admin: error("User not found")
AdminObj --> Admin: showError("User does not exist")
end
else Delete User
Admin -> AdminObj: deleteUser(userID)
alt User Exists
AdminObj -> UserObj: deleteAccount()
UserObj -> System: removeUserData()
alt Success
System --> AdminObj: userDeleted()
AdminObj --> Admin: showConfirmation("User deleted")
else Delete Error
System --> AdminObj: error("Delete failed")
AdminObj --> Admin: showError("Failed to delete user")
end
else User Not Found
AdminObj --> Admin: error("User not found")
AdminObj --> Admin: showError("User does not exist")
end
end

@enduml

Review User Activity

Diagram

image

Code

@startuml
actor Admin
participant ":Admin" as AdminObj
participant "System" as System

Admin -> AdminObj: reviewUserActivity()
AdminObj -> System: requestActivityLogs(userID)

alt Logs Found and User Exists ' System performs lookup internally
    System --> AdminObj: returnActivityLogs(logData)
    AdminObj --> Admin: displayActivityLogs(logData)
else No Logs Found for User ' User exists, but has no log entries
    System --> AdminObj: error("No logs available")
    AdminObj --> Admin: showMessage("No activity logs found for this user") ' Use showMessage or similar for non-critical info
else User Not Found
    System --> AdminObj: error("User not found")
    AdminObj --> Admin: showError("Invalid user ID")
else System Error ' Optional: Catch other potential system failures
    System --> AdminObj: error("Failed to retrieve logs")
    AdminObj --> Admin: showError("An error occurred retrieving logs")
end

@enduml

Send Platform Notifications

Diagram

image

Code

@startuml
actor Admin
participant ":Admin" as AdminObj
participant "System" as System
participant ":Notification" as NotificationObj
participant ":User" as UserObj

Admin -> AdminObj: sendPlatformNotifications()
AdminObj -> System: prepareNotification(message)
alt Valid Message
System -> NotificationObj: createNotification(message)
NotificationObj -> System: getAllUsers()
alt Success
System --> NotificationObj: returnUserList()
loop For each user
NotificationObj -> UserObj: receiveNotification(message)
alt Delivery Success
UserObj -> System: storeNotification()
System --> UserObj: notificationStored()
else Delivery Failure
UserObj --> NotificationObj: error("User unreachable")
end
end
NotificationObj --> AdminObj: notificationSent()
AdminObj --> Admin: showConfirmation("Notifications sent")
else User List Error
System --> NotificationObj: error("Failed to fetch users")
NotificationObj --> AdminObj: error("User list unavailable")
AdminObj --> Admin: showError("Failed to send notifications")
end
else Empty Message
System --> AdminObj: error("Message cannot be empty")
AdminObj --> Admin: showError("Invalid message")
end

@enduml

Access Analytics Dashboard

Diagram

image

Code

@startuml
actor Admin
participant ":Admin" as AdminObj
participant "System" as System

Admin -> AdminObj: accessAnalytics()
AdminObj -> System: requestAnalyticsData()
alt Success
System --> AdminObj: returnAnalyticsData()
AdminObj --> Admin: displayAnalyticsDashboard()
else Data Unavailable
System --> AdminObj: error("Analytics unavailable")
AdminObj --> Admin: showError("Failed to load analytics")
end

@enduml

Modify Platform Settings

Diagram

image

Code

@startuml
actor Admin
participant ":Admin" as AdminObj
participant "System" as System

Admin -> AdminObj: modifyPlatformSettings()
AdminObj -> System: requestCurrentSettings()
alt Success
System --> AdminObj: returnSettings()
Admin -> AdminObj: updateSettings(newSettings)
alt Valid Settings
AdminObj -> System: saveSettings(newSettings)
alt Success
System --> AdminObj: settingsUpdated()
AdminObj --> Admin: showConfirmation("Settings updated")
else Save Error
System --> AdminObj: error("Save failed")
AdminObj --> Admin: showError("Failed to update settings")
end
else Invalid Settings
AdminObj --> Admin: error("Invalid settings")
AdminObj --> Admin: showError("Settings not allowed")
end
else Fetch Error
System --> AdminObj: error("Settings unavailable")
AdminObj --> Admin: showError("Failed to load settings")
end

@enduml

Approve Custom Waste Category

Diagram

image

Code

@startuml
title Approve Custom Waste Category

actor Admin
participant ":AdminUI" as AdminUI <<boundary>>
participant ":CategoryService" as CategoryService <<control>>
participant ":WasteCategory" as WasteCategoryObj <<entity>>
participant ":NotificationService" as NotificationService <<control>>
participant ":UserNotifier" as UserNotifier <<control>> ' Represents mechanism to notify user

autonumber ' Optional: helps track steps

' Pre-condition: Admin has identified a pending category request (e.g., from a list)
' Let's assume the Admin gets the requestID and determines the score details off-diagram.

Admin -> AdminUI: Initiate Approval (requestID, score, unit, rationale)
AdminUI -> CategoryService: approveCustomCategory(requestID, score, unit, rationale)

alt Request Processing
    CategoryService -> WasteCategoryObj: findPendingByID(requestID)
    database DB
    WasteCategoryObj -> DB : fetch request data
    DB --> WasteCategoryObj : pending category data
    WasteCategoryObj --> CategoryService: Found(categoryInstance)

    opt Check if already approved or invalid state
         CategoryService --> AdminUI: failure("Request already processed or invalid")
         AdminUI --> Admin: showError("Cannot approve: Request state invalid.")
    else Request is valid and pending
        CategoryService -> WasteCategoryObj: applyApprovalDetails(score, unit, rationale)
        ' WasteCategoryObj internal state updated: isApproved=true, score, unit, rationale set

        CategoryService -> WasteCategoryObj: save()
        WasteCategoryObj -> DB: update category data (status=approved, score, unit...)
        alt Save Successful
            DB --> WasteCategoryObj: success
            WasteCategoryObj --> CategoryService: saveSuccess()

            CategoryService -> NotificationService: queueUserApprovalNotification(categoryInstance.getUserID(), categoryInstance.getName())
            NotificationService -> UserNotifier: sendApproval(userID, categoryName) ' Async notification to user

            CategoryService --> AdminUI: success("Category approved and saved.")
            AdminUI --> Admin: showConfirmation("Category '" + categoryInstance.getName() + "' approved.")
        else Save Failed
            DB --> WasteCategoryObj: error
             WasteCategoryObj --> CategoryService: saveFailure("Database error")
            CategoryService --> AdminUI: failure("Failed to save approved category.")
            AdminUI --> Admin: showError("Approval failed during save.")
        end
    end
else Request Not Found
    WasteCategoryObj --> CategoryService: NotFound()
    CategoryService --> AdminUI: failure("Pending request not found.")
    AdminUI --> Admin: showError("Invalid Request ID.")
end

@enduml

Manage Group Challenges

Diagram

image

Code

@startuml
actor Admin
participant ":Admin" as AdminObj
participant ":Challenge" as ChallengeObj
participant "System" as System

Admin -> AdminObj: manageGroupChallenges()
AdminObj -> System: requestChallengeList()
alt Success
System --> AdminObj: returnChallengeList()
else Fetch Error
System --> AdminObj: error("Challenges unavailable")
AdminObj --> Admin: showError("Failed to load challenges")
return
end

alt Create Challenge
Admin -> AdminObj: createChallenge(challengeDetails)
alt Valid Details
AdminObj -> ChallengeObj: initialize(challengeDetails)
ChallengeObj -> System: saveChallengeData()
alt Success
System --> AdminObj: challengeCreated()
AdminObj --> Admin: showConfirmation("Challenge created")
else Save Error
System --> AdminObj: error("Save failed")
AdminObj --> Admin: showError("Failed to create challenge")
end
else Invalid Details
AdminObj --> Admin: error("Invalid challenge data")
AdminObj --> Admin: showError("Invalid challenge details")
end
else Edit Challenge
Admin -> AdminObj: editChallenge(challengeID, newDetails)
alt Challenge Exists
AdminObj -> ChallengeObj: updateDetails(newDetails)
ChallengeObj -> System: updateChallengeData()
alt Success
System --> AdminObj: challengeUpdated()
AdminObj --> Admin: showConfirmation("Challenge updated")
else Update Error
System --> AdminObj: error("Update failed")
AdminObj --> Admin: showError("Failed to update challenge")
end
else Challenge Not Found
AdminObj --> Admin: error("Challenge not found")
AdminObj --> Admin: showError("Challenge does not exist")
end
else Delete Challenge
Admin -> AdminObj: deleteChallenge(challengeID)
alt Challenge Exists
AdminObj -> ChallengeObj: remove()
ChallengeObj -> System: deleteChallengeData()
alt Success
System --> AdminObj: challengeDeleted()
AdminObj --> Admin: showConfirmation("Challenge deleted")
else Delete Error
System --> AdminObj: error("Delete failed")
AdminObj --> Admin: showError("Failed to delete challenge")
end
else Challenge Not Found
AdminObj --> Admin: error("Challenge not found")
AdminObj --> Admin: showError("Challenge does not exist")
end
end

@enduml

Award Challenge Points

Diagram

image

Code

@startuml
title Award Challenge Points

actor Admin
participant ":AdminUI" as AdminUI <<boundary>>
participant ":CompletionService" as CompletionService <<control>>
participant ":ChallengeService" as ChallengeService <<control>>
participant ":ScoreService" as ScoreService <<control>>
participant ":ChallengeCompletion" as ChallengeCompletion <<entity>>
participant ":Challenge" as Challenge <<entity>>
participant ":User" as User <<entity>>
database DB <<entity>>

autonumber

' Pre-condition: Admin navigates to a view showing challenge completions needing award confirmation.
Admin -> AdminUI: View Pending Awards
AdminUI -> CompletionService: getPendingAwards()
CompletionService -> DB: find(ChallengeCompletion where status='pending_award')
DB --> CompletionService: List<completionData>
CompletionService --> AdminUI: displayPendingAwards(List<completionData>)

' Admin selects a specific completion event from the list to award points
Admin -> AdminUI: Confirm Award (completionID)
AdminUI -> CompletionService: confirmAward(completionID)

alt Process Award Confirmation
    CompletionService -> DB: findByID(ChallengeCompletion, completionID)
    DB --> CompletionService: completionData ' includes userID, challengeID, status

    alt [Completion Found and Status is 'pending_award']
        ' Get points defined for this challenge
        CompletionService -> ChallengeService: getChallengePoints(completionData.challengeID)
        ChallengeService -> DB: findByID(Challenge, completionData.challengeID)
        DB --> ChallengeService: challengeData ' includes pointsForCompletion
        ChallengeService --> CompletionService: pointsForCompletion

        ' Award the points via ScoreService
        CompletionService -> ScoreService: awardPointsForCompletion(completionData.userID, pointsForCompletion, completionData.challengeID)

        alt [Score Awarded Successfully]
             ' ScoreService internally finds User, updates score, saves to DB
             ScoreService -> DB: findUserByID(userID)
             DB --> ScoreService: userData
             ' ScoreService calculates new totalScore
             ScoreService -> DB: updateUserScore(userID, newTotalScore)
             DB --> ScoreService: userUpdateSuccess

             ' Mark the completion record as awarded
             CompletionService -> DB: updateStatus(ChallengeCompletion, completionID, 'awarded')
             DB --> CompletionService: completionUpdateSuccess

             CompletionService --> AdminUI: success("Points awarded successfully.")
             AdminUI --> Admin: showConfirmation("Points Awarded for Completion ID: " + completionID)

        else [Score Award Failed or Completion Update Failed]
             ' Handle potential errors during score update or marking completion
             ' (e.g., DB error, rollback logic might be needed)
             ScoreService --> CompletionService: awardFailure("Reason...")
             CompletionService --> AdminUI: failure("Failed to award points. Reason: ...")
             AdminUI --> Admin: showError("Award Failed. Reason: ...")
        end

    else [Completion Not Found or Status Not Pending]
         CompletionService --> AdminUI: failure("Completion not found or already processed.")
         AdminUI --> Admin: showError("Cannot award: Completion invalid or already awarded.")
    end
end

@enduml

Moderator Communicating with Violating Users

Diagram

communicating_violation

Code

@startuml
' Sequence Diagram for Communicate with Violating Users
actor Moderator
participant ":Moderator" as ModObj
participant "System" as System
participant ":User" as UserObj
participant ":Notification" as NotificationObj

Moderator -> ModObj: communicateWithViolatingUsers(userID, message)
ModObj -> System: getUser(userID)
alt User Exists
    System -> UserObj: retrieveUser(userID)
    UserObj --> System: userData
    System --> ModObj: returnUser(userData)
    ModObj -> NotificationObj: createCommunication(userID, moderatorID, message)
    NotificationObj -> System: storeMessage(communicationData)
    System --> NotificationObj: messageStored(true)
    NotificationObj -> UserObj: sendNotification(message)
    UserObj --> NotificationObj: notificationDelivered(true)
    NotificationObj --> ModObj: communicationSent(true)
    ModObj --> Moderator: showConfirmation("Message sent to user")
else User Not Found
    System --> ModObj: error("User not found")
    ModObj --> Moderator: showError("Invalid user ID")
end

alt User Responds
    UserObj -> NotificationObj: respondToModerator(response)
    NotificationObj -> System: storeResponse(responseData)
    System --> NotificationObj: responseStored(true)
    NotificationObj -> ModObj: deliverResponse(response)
    ModObj --> Moderator: displayUserResponse(response)
end

@enduml

Warn and Suspend Users

Image

Code:

@startuml
' Sequence Diagram for Warn/Suspend Users
actor Moderator
participant ":Moderator" as ModObj
participant "System" as System
participant ":User" as UserObj

Moderator -> ModObj: warnUsers(userID, reason)
ModObj -> System: getUser(userID)
alt User Exists
    System -> UserObj: retrieveUser(userID)
    UserObj --> System: userData
    System --> ModObj: returnUser(userData)
    ModObj -> System: sendWarning(userID, reason)
    System --> ModObj: warningSent(true)
    ModObj --> Moderator: showConfirmation("User warned")
else User Not Found
    System --> ModObj: error("User not found")
    ModObj --> Moderator: showError("Invalid user ID")
end

Moderator -> ModObj: suspendUsers(userID, duration, reason)
ModObj -> System: getUser(userID)
alt User Exists
    System -> UserObj: retrieveUser(userID)
    UserObj --> System: userData
    System --> ModObj: returnUser(userData)
    ModObj -> System: suspendUser(userID, duration, reason)
    System --> ModObj: suspensionApplied(true)
    ModObj --> Moderator: showConfirmation("User suspended")
else User Not Found
    System --> ModObj: error("User not found")
    ModObj --> Moderator: showError("Invalid user ID")
end

@enduml

Reviewed Flagged Content

Diagram

Image

Code

@startuml
' Sequence Diagram for Review Flagged Content
actor Moderator
participant ":Moderator" as ModObj
participant "System" as System
participant "Content" as ContentObj

Moderator -> ModObj: reviewFlaggedContent(contentID)
ModObj -> System: getFlaggedContent(contentID)
alt Content Exists
    System -> ContentObj: retrieveContentDetails(contentID)
    ContentObj --> System: contentDetails
    System --> ModObj: returnContent(contentDetails)
    ModObj --> Moderator: displayContent(contentDetails)
    Moderator -> ModObj: makeDecision(decision)
    ModObj -> System: updateContentStatus(contentID, decision)
    System --> ModObj: statusUpdated(true)
    ModObj --> Moderator: showConfirmation("Content reviewed")
else Content Not Found
    System --> ModObj: error("Content not found")
    ModObj --> Moderator: showError("Invalid content ID")
end

@enduml

Escelate Issues to Admin

Diagram

Image

Code

@startuml
' Sequence Diagram for Escalate Issues to Admin
actor Moderator
participant ":Moderator" as ModObj
participant "System" as System
participant ":Admin" as AdminObj

Moderator -> ModObj: escalateIssues(issueID, notes)
ModObj -> System: getIssue(issueID)
alt Issue Exists
    System --> ModObj: issueDetails
    ModObj -> System: forwardToAdmin(issueID, notes)
    System -> AdminObj: notifyAdmin(issueID, notes)
    AdminObj --> System: issueReceived(true)
    System --> ModObj: escalationSent(true)
    ModObj --> Moderator: showConfirmation("Issue escalated to Admin")
else Issue Not Found
    System --> ModObj: error("Issue not found")
    ModObj --> Moderator: showError("Invalid issue ID")
end

@enduml```

Labs

Team Members

Weekly Reports

Ahmet Okta
Barathan Aslan
Berke Kartal
Mehmet Çağlar Kurt
Mehmet Emin Atak
Muhammet Berkay Keskin
Mustafa Taha Söylemez
Nilsu Tüysüz
Selman Akman
Ömer Faruk Bayram

Meetings

Milestones

Templates

Research on Git

Projects

Project Resources

Software Design Diagrams

Documentation(Manuals & Research Doc)

CMPE352 Archive

Projects

Project Resources

Software Design Diagrams

Documentation(Manuals & Research Doc)



Documentation(Individual Contributions and/or Milestone Report)

Individual Contributions

Meeting Notes

Clone this wiki locally