Update react security grid (#490)

* Update to SPFx 1.4.1

* add missing semicolon to remove warnings

* remove fine not being used

* Update version and readme
This commit is contained in:
Joel Rodrigues 2018-04-27 16:19:09 +01:00 committed by Vesa Juvonen
parent 6a59355c8b
commit 934d1d92d1
13 changed files with 15536 additions and 69 deletions

View File

@ -1,6 +1,7 @@
# SPFX React Grid # SPFX React Grid
## Summary ## Summary
React-securitygrid is an SPFX webpart that uses React and Office-UI-Fabric to render a grid showing which users have access to which lists/libraries/folders/files on a Web as shown here: React-securitygrid is an SPFX webpart that uses React and Office-UI-Fabric to render a grid showing which users have access to which lists/libraries/folders/files on a Web as shown here:
![config panel](./src/images/MainDisplay.PNG) ![config panel](./src/images/MainDisplay.PNG)
@ -23,8 +24,6 @@ The user can change alternate between displaying user names and emails selectin
![Select Mode](./src/images/SelectDisplayModePopout.PNG) ![Select Mode](./src/images/SelectDisplayModePopout.PNG)
The the first configuration panel of the webpart is shown below: The the first configuration panel of the webpart is shown below:
![config panel](./src/images/Configuration.PNG) ![config panel](./src/images/Configuration.PNG)
@ -44,8 +43,6 @@ Display Settings
The Initial Title column width determines the initial width of the Title column(it can be resized). The Initial Title column width determines the initial width of the Title column(it can be resized).
The second configuarion pannel allows the owner to configure the List Settings The second configuarion pannel allows the owner to configure the List Settings
![List Confoguration panel](./src/images/ListConfiguration.PNG) ![List Confoguration panel](./src/images/ListConfiguration.PNG)
@ -62,21 +59,19 @@ The Include/Exclude Selected lists Toggle determines whether the lists selected
The admin can select lists and libraries below to have them included/excluded from the grid The admin can select lists and libraries below to have them included/excluded from the grid
## Notes ## Notes
This is a port of an Angular 1.3 SharePoint hosted App at https://github.com/russgove/SPSecurity. This is a port of an Angular 1.3 SharePoint hosted App at https://github.com/russgove/SPSecurity.
## Used SharePoint Framework Version ## Used SharePoint Framework Version
1.3.4
![version](https://img.shields.io/badge/version-1.4.1-green.svg)
## Applies to ## Applies to
* [SharePoint Framework Developer Preview](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview) * [SharePoint Framework Developer Preview](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
* [Office 365 developer tenant](http://dev.office.com/sharepoint/docs/spfx/set-up-your-developer-tenant) * [Office 365 developer tenant](http://dev.office.com/sharepoint/docs/spfx/set-up-your-developer-tenant)
## Prerequisites ## Prerequisites
> React, Office-UI-Fabric, sp-pnp-js, lodash > React, Office-UI-Fabric, sp-pnp-js, lodash
@ -91,10 +86,11 @@ Solution|Author(s)
Version|Date|Comments Version|Date|Comments
-------|----|-------- -------|----|--------
1.0|December 31, 2016|Initial version 1.0.0.1|April 25, 2018|Update to SPFx 1.4.1
1.0.0.0|December 31, 2016|Initial version
## Disclaimer ## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
--- ---
@ -105,7 +101,3 @@ Version|Date|Comments
- in the command line run: - in the command line run:
- `npm install` - `npm install`
- `gulp serve` - `gulp serve`

View File

@ -1,3 +1,4 @@
{ {
"$schema": "https://dev.office.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "temp/deploy" "deployCdnPath": "temp/deploy"
} }

View File

@ -1,4 +1,5 @@
{ {
"$schema": "https://dev.office.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./temp/deploy/", "workingDir": "./temp/deploy/",
"account": "<!-- STORAGE ACCOUNT NAME -->", "account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "spsecurity-webpart-3", "container": "spsecurity-webpart-3",

View File

@ -1,8 +1,9 @@
{ {
"$schema": "https://dev.office.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": { "solution": {
"name": "spsecurity-webpart-3-client-side-solution", "name": "spsecurity-webpart-3-client-side-solution",
"id": "788271fb-ee9b-40df-8381-eb3dc70d1982", "id": "788271fb-ee9b-40df-8381-eb3dc70d1982",
"version": "1.0.0.0" "version": "1.0.0.1"
}, },
"paths": { "paths": {
"zippedPackage": "solution/spsecurity-webpart-3.sppkg" "zippedPackage": "solution/spsecurity-webpart-3.sppkg"

View File

@ -1,4 +1,5 @@
{ {
"$schema": "https://dev.office.com/json-schemas/core-build/serve.schema.json",
"port": 4321, "port": 4321,
"initialPage": "https://localhost:5432/workbench", "initialPage": "https://localhost:5432/workbench",
"https": true, "https": true,

View File

@ -1,4 +1,5 @@
{ {
"$schema": "https://dev.office.com/json-schemas/core-build/tslint.schema.json",
// Display errors as warnings // Display errors as warnings
"displayAsWarning": true, "displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules // The TSLint task may have been configured with several custom lint rules
@ -28,8 +29,7 @@
"no-shadowed-variable": true, "no-shadowed-variable": true,
"no-switch-case-fall-through": true, "no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true, "no-unnecessary-semicolons": true,
"no-unused-expression": false, "no-unused-expression": true,
"no-unused-imports": true,
"no-use-before-declare": true, "no-use-before-declare": true,
"no-with-statement": true, "no-with-statement": true,
"semicolon": true, "semicolon": true,
@ -39,11 +39,7 @@
"use-named-parameter": true, "use-named-parameter": true,
"valid-typeof": true, "valid-typeof": true,
"variable-name": false, "variable-name": false,
"whitespace": false, "whitespace": false
"no-debugger":false,
"no-unused-variable": false,
"max-line-lenth": false
} }
} }
} }

View File

@ -1,3 +1,4 @@
{ {
"$schema": "https://dev.office.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->" "cdnBasePath": "<!-- PATH TO CDN -->"
} }

View File

@ -2,5 +2,6 @@
const gulp = require('gulp'); const gulp = require('gulp');
const build = require('@microsoft/sp-build-web'); const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
build.initialize(gulp); build.initialize(gulp);

15489
samples/react-securitygrid/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,11 @@
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"dependencies": { "dependencies": {
"@microsoft/sp-build-web": "^1.3.4", "@microsoft/sp-build-web": "~1.4.1",
"@microsoft/sp-client-base": "~1.0.0", "@microsoft/sp-core-library": "~1.4.1",
"@microsoft/sp-core-library": "^1.3.4", "@microsoft/sp-module-interfaces": "~1.4.1",
"@microsoft/sp-module-interfaces": "^1.3.4", "@microsoft/sp-webpart-base": "~1.4.1",
"@microsoft/sp-webpart-base": "^1.3.4", "@microsoft/sp-webpart-workbench": "~1.4.1",
"@microsoft/sp-webpart-workbench": "^1.3.4",
"@pnp/spfx-property-controls": "1.0.0", "@pnp/spfx-property-controls": "1.0.0",
"@types/react": "15.0.38", "@types/react": "15.0.38",
"@types/react-addons-shallow-compare": "0.14.17", "@types/react-addons-shallow-compare": "0.14.17",
@ -26,9 +25,9 @@
"sp-pnp-js": "^3.0.1" "sp-pnp-js": "^3.0.1"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "^1.3.4", "@microsoft/sp-build-web": "~1.4.1",
"@microsoft/sp-module-interfaces": "^1.3.4", "@microsoft/sp-module-interfaces": "~1.4.1",
"@microsoft/sp-webpart-workbench": "^1.3.4", "@microsoft/sp-webpart-workbench": "~1.4.1",
"@types/chai": ">=3.4.34 <3.6.0", "@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0", "@types/mocha": ">=2.2.33 <2.6.0",
"gulp": "~3.9.1" "gulp": "~3.9.1"

View File

@ -178,7 +178,7 @@ export class Helpers {
let selectedRoleAssignments: SPRoleAssignment[] = []; let selectedRoleAssignments: SPRoleAssignment[] = [];
for (const roleAssignment of securableObject.roleAssignments) { for (const roleAssignment of securableObject.roleAssignments) {
let group: SPSiteGroup = find(groups, (g) => { return g.id === roleAssignment.principalId }); let group: SPSiteGroup = find(groups, (g) => { return g.id === roleAssignment.principalId; });
if (group) { if (group) {
if (this.userIsInGroup(user.id, group.id, groups)) { if (this.userIsInGroup(user.id, group.id, groups)) {
selectedRoleAssignments.push(roleAssignment); selectedRoleAssignments.push(roleAssignment);
@ -262,7 +262,7 @@ export default class SPSecurityService {
for (let roleAssignmentObject of listItem.RoleAssignments) { for (let roleAssignmentObject of listItem.RoleAssignments) {
let roleAssignment: SPRoleAssignment = { let roleAssignment: SPRoleAssignment = {
roleDefinitionIds: roleAssignmentObject.RoleDefinitionBindings.map((rdb) => { return rdb.Id }), roleDefinitionIds: roleAssignmentObject.RoleDefinitionBindings.map((rdb) => { return rdb.Id; }),
principalId: roleAssignmentObject.PrincipalId principalId: roleAssignmentObject.PrincipalId
}; };
// if (roleAssignmentObject.Member.UserId) { // if (roleAssignmentObject.Member.UserId) {
@ -410,7 +410,7 @@ export default class SPSecurityService {
mylist.roleAssignments = listObject.RoleAssignments.map((roleAssignmentObject) => { mylist.roleAssignments = listObject.RoleAssignments.map((roleAssignmentObject) => {
let roleAssignment: SPRoleAssignment = { let roleAssignment: SPRoleAssignment = {
roleDefinitionIds: roleAssignmentObject.RoleDefinitionBindings.map((rdb) => { return rdb.Id }), roleDefinitionIds: roleAssignmentObject.RoleDefinitionBindings.map((rdb) => { return rdb.Id; }),
principalId: roleAssignmentObject.PrincipalId principalId: roleAssignmentObject.PrincipalId
}; };
return roleAssignment; return roleAssignment;

View File

@ -1,24 +0,0 @@
@import 'node_modules/office-ui-fabric-react/dist/sass/Fabric.scss';
//*Set the Header are to 140px so it can hold the rotated headers
.SPFXSecurityGrid .ms-DetailsHeader { //* when adjusting line hieight also need to adjust second parameter to transform:translate below
height: 140px;
white-space: nowrap;
}
//*Set the wrappers around the headers to display at 45degree angles
.ms-DetailsHeader-cell.rotatedColumnHeader{
transform: translate(25px,40px ) //*Change second parameter when adjusting line height
rotate(315deg);
padding-bottom: 90px;
width: 36px !important;
}
.ms-DetailsHeader-cell{
vertical-align: bottom;
}
.ms-DetailsHeader-cell span {
overflow: visible;
}
.ms-List-cell:nth-child(even) .ms-DetailsRow {
background: #EEE;
}

View File

@ -7,10 +7,19 @@
"declaration": true, "declaration": true,
"sourceMap": true, "sourceMap": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [ "types": [
"es6-promise", "es6-promise",
"es6-collections",
"webpack-env" "webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
] ]
} }
} }