18 lines
478 B
Go
18 lines
478 B
Go
package permissions
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
func (c *Checker) getOverride(ctx context.Context, channelID, targetType, targetID string) (allow, deny int64, err error) {
|
|
err = c.db.QueryRowContext(ctx, `
|
|
SELECT allow_bitflags, deny_bitflags FROM channel_overrides
|
|
WHERE channel_id = $1 AND target_type = $2 AND target_id = $3
|
|
`, channelID, targetType, targetID).Scan(&allow, &deny)
|
|
if err == sql.ErrNoRows {
|
|
return 0, 0, nil
|
|
}
|
|
return allow, deny, err
|
|
}
|