-
Notifications
You must be signed in to change notification settings - Fork 5
/
Policy.cs
40 lines (33 loc) · 1.2 KB
/
Policy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.TeamFoundation.Framework.Server;
using Microsoft.TeamFoundation.Git.Server;
using System.Collections.Generic;
namespace GitPushFilter
{
internal class Policy
{
public Policy()
{
this.Rules = new List<Rule>();
}
public string CollectionName { get; set; }
public string ProjectName { get; set; }
public string RepositoryName { get; set; }
public List<Rule> Rules { get; private set; }
public bool AppliesTo(string collectionName, string projectName, string repositoryName)
{
// exact match
return (collectionName.SameAs(this.CollectionName)
&& projectName.SameAs(this.ProjectName)
&& repositoryName.SameAs(this.RepositoryName));
}
public List<Validation> CheckRules(TeamFoundationRequestContext requestContext, PushNotification pushNotification, TfsGitRepository repository)
{
var res = new List<Validation>();
foreach (var rule in this.Rules)
{
res.Add(rule.CheckRule(requestContext, pushNotification, repository));
}//for
return res;
}
}
}