feat: add canOperateReports and canFlagReportContent functions for report management
This commit is contained in:
@@ -113,6 +113,11 @@ bool canManageReports(const UserContext &user)
|
||||
return isAdmin(user) || hasPermission(user, "reports.manage");
|
||||
}
|
||||
|
||||
bool canOperateReports(const UserContext &user)
|
||||
{
|
||||
return !isAdmin(user) && canManageReports(user);
|
||||
}
|
||||
|
||||
bool isAdmin(const UserContext &user)
|
||||
{
|
||||
return hasRole(user, "admin") || hasPermission(user, "admin.manage");
|
||||
|
||||
@@ -23,6 +23,7 @@ std::optional<UserContext> authenticate(const drogon::HttpRequestPtr &request);
|
||||
bool hasRole(const UserContext &user, const std::string &role);
|
||||
bool hasPermission(const UserContext &user, const std::string &permission);
|
||||
bool canManageReports(const UserContext &user);
|
||||
bool canOperateReports(const UserContext &user);
|
||||
bool isAdmin(const UserContext &user);
|
||||
bool mustChangePassword(const UserContext &user);
|
||||
} // namespace visione::auth
|
||||
|
||||
Reference in New Issue
Block a user