/* * Copyright (C) Alibaba Cloud Computing * All rights reserved. * * 版权所有 (C)阿里云计算有限公司 */ using System; namespace Aliyun.OSS { /// /// 定义了可以被授权的一组OSS用户。 /// public sealed class GroupGrantee : IGrantee { private readonly string _identifier; /// /// 获取被授权者的标识。 /// /// /// 不支持set操作,否则会抛出。 /// public string Identifier { get { return _identifier; } set { throw new NotSupportedException(); } } private static readonly GroupGrantee _allUsers = new GroupGrantee("http://oss.service.aliyun.com/acl/group/ALL_USERS"); /// /// 表示为OSS的指定匿名访问的权限。 /// 任何用户都可以根据被授予的权限进行访问。 /// public static GroupGrantee AllUsers { get { return _allUsers; } } /// /// 设置授权者标识 /// /// 授权者标识 private GroupGrantee(string identifier) { _identifier = identifier; } /// /// 判断两个是否相等 /// /// 需要判断的另一个 /// public override bool Equals(object obj) { var grantee = obj as GroupGrantee; if (grantee == null) return false; return grantee.Identifier == Identifier; } /// /// 获取hash code值 /// /// hash code值 public override int GetHashCode() { return ("[GroupGrantee ID=" + Identifier + "]").GetHashCode(); } } }