public Contracts.SmallGroupCluster GetSmallGroupCluster(int clusterID) { Contracts.SmallGroupClusterMapper mapper = new Contracts.SmallGroupClusterMapper(); GroupCluster cluster = new GroupCluster(clusterID); if (cluster.GroupClusterID == -1) throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid cluster ID"); if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, cluster.GroupClusterID, OperationType.View) == false) { bool groupLeader = false; // Check to see if they are a leader within this cluster Arena.Custom.SECC.Data.SmallGroup.GroupCollection gc = new Arena.Custom.SECC.Data.SmallGroup.GroupCollection(); gc.LoadByLeaderPersonID(ArenaContext.Current.Person.PersonID); foreach (Group group in gc) { if (group.Active && group.GroupClusterID == clusterID) { groupLeader = true; break; } } if (!groupLeader) { throw new Exception("Access denied."); } } return mapper.FromArena(cluster); }
public Contracts.SmallGroupCluster GetSmallGroupCluster(int clusterID) { Contracts.SmallGroupClusterMapper mapper = new Contracts.SmallGroupClusterMapper(); GroupCluster cluster = new GroupCluster(clusterID); if (cluster.GroupClusterID == -1) { throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid cluster ID"); } if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, cluster.GroupClusterID, OperationType.View) == false) { bool groupLeader = false; // Check to see if they are a leader within this cluster Arena.Custom.SECC.Data.SmallGroup.GroupCollection gc = new Arena.Custom.SECC.Data.SmallGroup.GroupCollection(); gc.LoadByLeaderPersonID(ArenaContext.Current.Person.PersonID); foreach (Group group in gc) { if (group.Active && group.GroupClusterID == clusterID) { groupLeader = true; break; } } if (!groupLeader) { throw new Exception("Access denied."); } } return(mapper.FromArena(cluster)); }
public Contracts.SmallGroupCluster GetSmallGroupCluster(int clusterID) { Contracts.SmallGroupClusterMapper mapper = new Contracts.SmallGroupClusterMapper(); GroupCluster cluster = new GroupCluster(clusterID); if (cluster.GroupClusterID == -1) throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid cluster ID"); if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, cluster.GroupClusterID, OperationType.View) == false) throw new Exception("Access denied."); return mapper.FromArena(cluster); }