/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 (C)阿里云计算有限公司
*/
using System;
namespace Aliyun.OSS
{
///
/// 访问控制的授权信息。
///
public class Grant {
///
/// 获取被授权者信息。
///
public IGrantee Grantee { get; private set; }
///
/// 获取被授权的权限。
///
public Permission Permission { get; private set; }
///
/// 构造一个新的实体。
///
/// 被授权者。目前只支持。
/// 权限。
public Grant(IGrantee grantee, Permission permission)
{
if (grantee == null)
throw new ArgumentNullException("grantee");
Grantee = grantee;
Permission = permission;
}
///
/// 判断两个是否相等
///
/// 需要比较的
///
public override bool Equals(Object obj)
{
var g = obj as Grant;
if (g == null)
return false;
return Grantee.Identifier== g.Grantee.Identifier &&
Permission == g.Permission;
}
///
/// 获取HashCode值
///
/// hash code值
public override int GetHashCode()
{
return (Grantee.Identifier + ":" + Permission).GetHashCode();
}
}
}