public override bool HasPermission(UnqualifiedTopicName topic, TopicPermission permission) { if (!_sqlHelper.TopicExists(Namespace, topic.LocalName)) { // It might seem a little weird to return true if the topic doesn't exist, but // basically what we're saying is that there's no reason to deny read/edit return true; } if (permission == TopicPermission.Read) { return true; } else if (permission == TopicPermission.Edit) { return _sqlHelper.IsExistingTopicWritable(Namespace, topic.LocalName); } else { throw new ArgumentException("Unrecognized topic permission: " + permission.ToString()); } }
public override bool HasPermission(UnqualifiedTopicName topic, TopicPermission permission) { _hasPermissionCalled = true; MockTopic mockTopic = GetTopic(topic, ExistencePolicy.ExistingOnly); if (mockTopic == null) { return true; } if (permission == TopicPermission.Edit) { return mockTopic.Latest.CanWrite; } else if (permission == TopicPermission.Read) { return mockTopic.Latest.CanRead; } else { throw new ArgumentException("Unrecognized TopicPermission " + permission.ToString()); } }