createEnforceLogEntry creates a log entry for enforce events with subject, object, action, and domain extracted from rvals.
(rvals []interface{})
| 95 | |
| 96 | // createEnforceLogEntry creates a log entry for enforce events with subject, object, action, and domain extracted from rvals. |
| 97 | func (e *Enforcer) createEnforceLogEntry(rvals []interface{}) *log.LogEntry { |
| 98 | entry := &log.LogEntry{ |
| 99 | EventType: log.EventEnforce, |
| 100 | } |
| 101 | if len(rvals) > 0 { |
| 102 | if s, isString := rvals[0].(string); isString { |
| 103 | entry.Subject = s |
| 104 | } |
| 105 | } |
| 106 | if len(rvals) > 1 { |
| 107 | if o, isString := rvals[1].(string); isString { |
| 108 | entry.Object = o |
| 109 | } |
| 110 | } |
| 111 | if len(rvals) > 2 { |
| 112 | if a, isString := rvals[2].(string); isString { |
| 113 | entry.Action = a |
| 114 | } |
| 115 | } |
| 116 | if len(rvals) > 3 { |
| 117 | if d, isString := rvals[3].(string); isString { |
| 118 | entry.Domain = d |
| 119 | } |
| 120 | } |
| 121 | return entry |
| 122 | } |
| 123 | |
| 124 | // onLogBeforeEventInEnforce initializes logging for Enforce operation. |
| 125 | func (e *Enforcer) onLogBeforeEventInEnforce(rvals []interface{}) *log.LogEntry { |
no outgoing calls
no test coverage detected