mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-06 06:53:42 +00:00
Added validateAccess method
This commit is contained in:
parent
e5f7012998
commit
10feb892b4
2 changed files with 23 additions and 0 deletions
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "DMRAccessControl.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
|
@ -109,3 +110,23 @@ bool DMRAccessControl::validateSrcId(unsigned int id)
|
|||
return std::find(m_prefixes.begin(), m_prefixes.end(), prefix) != m_prefixes.end();
|
||||
}
|
||||
}
|
||||
|
||||
bool DMRAccessControl::validateAccess (unsigned int src_id, unsigned int dst_id, unsigned int slot)
|
||||
{
|
||||
if (!DMRAccessControl::validateSrcId(src_id)) {
|
||||
LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", slot, src_id);
|
||||
return false;
|
||||
|
||||
}
|
||||
else if (DMRAccessControl::DstIdBlacklist(dst_id, slot)) {
|
||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", slot, dst_id);
|
||||
return false;
|
||||
}
|
||||
else if (!DMRAccessControl::DstIdWhitelist(dst_id, slot, true)) {
|
||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", slot, dst_id);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue