blob: 690e789bfdd11973664c26eca94ef28d230a5a5d [file] [log] [blame]
// Copyright 2014 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "permission_broker/allow_group_tty_device_rule.h"
namespace permission_broker {
AllowGroupTtyDeviceRule::AllowGroupTtyDeviceRule(const std::string& group_name)
: TtySubsystemUdevRule("AllowGroupTtyDeviceRule"), group_name_(group_name) {
}
Rule::Result AllowGroupTtyDeviceRule::ProcessTtyDevice(udev_device* device) {
const std::string& device_gr_name = UdevRule::GetDevNodeGroupName(device);
return group_name_ == device_gr_name ? ALLOW : IGNORE;
}
} // namespace permission_broker