Skip to content

Commit 3b5d80f

Browse files
committed
#325 - Including wrapper class name for the SecurityTrimmedControl
1 parent d6c8194 commit 3b5d80f

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

docs/documentation/docs/controls/SecurityTrimmedControl.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ The `SecurityTrimmedControl` can be configured with the following properties:
6767
| level | PermissionLevel | yes | Specify where to check the user permissions: current site or list / remote site or list. |
6868
| remoteSiteUrl | string | no | The URL of the remote site. Required when you want to check permissions on remote site or list. |
6969
| relativeLibOrListUrl | string | no | The relative URL of the list or library. Required when you want to check permissions on remote list. |
70+
| folderPath | string | no | Specify the name of a folder to check the user permissions against. Will be overridden if itemId is present. |
71+
| itemId | number | no | Specify the ID of the item to check the user permissions against. Takes precedence over folder. |
72+
| className | string | no | Specify the className to be used on the parent element. |
7073

7174
The `PermissionLevel` enum has the following values:
7275

src/controls/securityTrimmedControl/ISecurityTrimmedControlProps.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ export interface ISecurityTrimmedControlProps {
3333
* Optional. Specify the ID of the item to check the user permissions against. Takes precedence over folder.
3434
*/
3535
itemId?: number;
36+
/**
37+
* Optional. Specify the className to be used on the parent element.
38+
*/
39+
className?: string;
3640
}

src/controls/securityTrimmedControl/SecurityTrimmedControl.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,10 @@ export class SecurityTrimmedControl extends React.Component<ISecurityTrimmedCont
193193
* Default React render method
194194
*/
195195
public render(): React.ReactElement<ISecurityTrimmedControlProps> {
196+
const { className } = this.props;
196197
return (
197198
this.state.allowRender ? (
198-
<div>{this.props.children}</div>
199+
<div className={className ? className : ""}>{this.props.children}</div>
199200
) : null
200201
);
201202
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
510510
<div className="ms-Grid-col ms-lg10 ms-xl8 ms-xlPush2 ms-lgPush1">
511511
<span className="ms-font-xl">Controls testing</span>
512512

513-
<SecurityTrimmedControl context={this.props.context} level={PermissionLevel.currentWeb} permissions={[SPPermission.viewListItems]}>
513+
<SecurityTrimmedControl context={this.props.context} level={PermissionLevel.currentWeb} permissions={[SPPermission.viewListItems]} className={"TestingClass"}>
514514
<p>You have permissions to view list items.</p>
515515
</SecurityTrimmedControl>
516516

0 commit comments

Comments
 (0)