예제 #1
0
        public static async Task <HttpResponseMessage> RolesDeleteByIdAsync(this ITestSession session,
                                                                            WebId roleId)
        {
            var query = new EastFive.Api.Azure.Resources.Queries.RoleQuery
            {
                Id = roleId,
            };
            var response = await session.DeleteAsync <EastFive.Api.Azure.Controllers.RoleController>(query);

            return(response);
        }
예제 #2
0
        public static async Task <TResult> RolesGetByActorAsync <TResult>(this ITestSession session,
                                                                          WebId actorId,
                                                                          Func <HttpResponseMessage, Func <EastFive.Api.Azure.Resources.Role[]>, TResult> callback)
        {
            var query = new EastFive.Api.Azure.Resources.Queries.RoleQuery
            {
                Actor = actorId,
            };
            var response = await session.GetAsync <EastFive.Api.Azure.Controllers.RoleController>(query);

            return(callback(response,
                            () => response.GetContentMultipart <EastFive.Api.Azure.Resources.Role>().ToArray()));
        }
예제 #3
0
        public static async Task <TResult> RolesPostAsync <TResult>(this ITestSession session,
                                                                    WebId actorId, string role,
                                                                    Func <HttpResponseMessage, EastFive.Api.Azure.Resources.Role, TResult> callback)
        {
            //Create the order via post
            var resource = new EastFive.Api.Azure.Resources.Role()
            {
                Id    = Guid.NewGuid(),
                Actor = actorId,
                Name  = role,
            };

            var response = await session.PostAsync <EastFive.Api.Azure.Controllers.RoleController>(resource);

            return(callback(response, resource));
        }
 /// <summary>
 /// Gets the location formatted as a string.
 /// </summary>
 /// <returns>The string format of the location.</returns>
 public override string ToString()
 {
     if (string.IsNullOrEmpty(ExtraInformation))
     {
         return(String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}_{3}_{4}",
                              SiteId.ToString(), WebId.ToString(), FileId.ToString(),
                              Convert.ToString(VersionId, CultureInfo.InvariantCulture),
                              Convert.ToString(Timestamp.Ticks, CultureInfo.InvariantCulture)));
     }
     else
     {
         return(String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}_{3}_{4}_{5}",
                              SiteId.ToString(), WebId.ToString(), FileId.ToString(),
                              Convert.ToString(VersionId, CultureInfo.InvariantCulture),
                              Convert.ToString(Timestamp.Ticks, CultureInfo.InvariantCulture),
                              ExtraInformation));
     }
 }
 public static WebId AreEqual(WebId expected, WebId actual)
 {
     expected.AssertEquals(actual);
     return(actual);
 }
예제 #6
0
 public override int GetHashCode()
 {
     return(WebId.GetHashCode() ^ ServerRelativeUrl.GetHashCode());
 }
예제 #7
0
 public override int GetHashCode()
 {
     return(WebId.GetHashCode() ^ ListId.GetHashCode());
 }
예제 #8
0
        private static bool PopulateRptWebGroups(EPMData epmData, SPWeb spWeb, SPSite spSite, StringBuilder errMsg)
        {
            Guard.ArgumentIsNotNull(epmData, nameof(epmData));
            Guard.ArgumentIsNotNull(spWeb, nameof(spWeb));
            Guard.ArgumentIsNotNull(spSite, nameof(spSite));
            Guard.ArgumentIsNotNull(errMsg, nameof(errMsg));

            var hasError = false;

            try
            {
                LogStatusLevel2Type3(PopulateRptWebGroupsId, StartBulkInsertRptWebGroups, epmData);

                var dataTable  = new DataTable();
                var dataColumn = new DataColumn(RptWebGroups)
                {
                    DataType = typeof(Guid)
                };
                dataTable.Columns.Add(dataColumn);
                dataColumn = new DataColumn(SiteId.ToUpper())
                {
                    DataType = typeof(Guid)
                };
                dataTable.Columns.Add(dataColumn);
                dataColumn = new DataColumn(WebId.ToUpper())
                {
                    DataType = typeof(Guid)
                };
                dataTable.Columns.Add(dataColumn);
                dataColumn = new DataColumn(GroupId)
                {
                    DataType = typeof(int)
                };
                dataTable.Columns.Add(dataColumn);
                dataColumn = new DataColumn(SecType)
                {
                    DataType = typeof(int)
                };
                dataTable.Columns.Add(dataColumn);

                foreach (SPRoleAssignment spRoleAssignment in spWeb.RoleAssignments)
                {
                    var type = spRoleAssignment.Member is SPGroup
                        ? 1
                        : 0;

                    var found = spRoleAssignment.RoleDefinitionBindings.Cast <SPRoleDefinition>()
                                .Any(def => (def.BasePermissions & SPBasePermissions.ViewListItems) == SPBasePermissions.ViewListItems);

                    if (found)
                    {
                        dataTable.Rows.Add(Guid.NewGuid(), spSite.ID, spWeb.ID, spRoleAssignment.Member.ID, type);
                    }
                }

                dataTable.Rows.Add(Guid.NewGuid(), spSite.ID, spWeb.ID, 999999, 1);

                using (var bulkCopy = new SqlBulkCopy(epmData.GetClientReportingConnection))
                {
                    bulkCopy.DestinationTableName = DboRptWebGroups;
                    bulkCopy.WriteToServer(dataTable);
                }

                LogStatusLevel2Type3(PopulateRptWebGroupsId, CompleteBulkInsertRptWebGroups, epmData);
            }
            catch (Exception exception)
            {
                hasError = true;
                errMsg.Append(exception.Message);
                LogStatusLevel2Type3(PopulateRptWebGroupsId, $"Error while Bulk insert dbo.RPTWEBGROUPS Error : {exception.Message}", epmData);
                Trace.WriteLine(exception);
            }
            return(hasError);
        }
예제 #9
0
 public override string ToString()
 {
     //return ListId.ToString() + ";" + FieldId.ToString() + ";" + _searchFields + ";" + MaxSearchResults +  ";" + EntityEditorRows + ";" + WebId.ToString();
     return(ListId.ToString() + ";" + WebId.ToString() + ";" + ItemId.ToString() + ";" + QueryBox.ToString());
 }
 public static async Task <TResult> AuthenticationRequestGetAsync <TResult>(this ITestSession session,
                                                                            WebId authenticationRequestId,
                                                                            Func <HttpResponseMessage, Func <EastFive.Azure.Auth.Session>, TResult> callback)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public override string ToString()
 {
     return(ListId.ToString() + ";" + FieldId.ToString() + ";" + _searchFields + ";" + MaxSearchResults + ";" + EntityEditorRows + ";" + WebId.ToString());
 }