mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3745] Doc review updates (#4316)
* [ADF-3745] Updated compatibility page based on feedback * [ADF-3745] Renamed node perm directive and fixed broken links * [ADF-3745] Updated version index with Check allowable op directive * [ADF-3745] Reviewed other files affected by node perm directive name change
This commit is contained in:
committed by
Eugenio Romano
parent
40d78a11c0
commit
e318f3607a
@@ -56,12 +56,12 @@ for more information about installing and using the source code.
|
||||
| Name | Description | Source link |
|
||||
| ---- | ----------- | ----------- |
|
||||
| [Context menu directive](context-menu.directive.md) | Adds a context menu to a component. | [Source](../../lib/core/context-menu/context-menu.directive.ts) |
|
||||
| [Check allowable operation directive](check-allowable-operation.directive.md) | Selectively disables an HTML element or Angular component. | [Source](../../lib/core/directives/check-allowable-operation.directive.ts) |
|
||||
| [Highlight directive](highlight.directive.md) | Adds highlighting to selected sections of an HTML element's content. | [Source](../../lib/core/directives/highlight.directive.ts) |
|
||||
| [Logout directive](logout.directive.md) | Logs the user out when the decorated element is clicked. | [Source](../../lib/core/directives/logout.directive.ts) |
|
||||
| [Node delete directive](node-delete.directive.md) | Deletes multiple files and folders. | [Source](../../lib/core/directives/node-delete.directive.ts) |
|
||||
| [Node download directive](node-download.directive.md) | Allows folders and/or files to be downloaded, with multiple nodes packed as a '.ZIP' archive. | [Source](../../lib/core/directives/node-download.directive.ts) |
|
||||
| [Node favorite directive](node-favorite.directive.md) | Selectively toggles nodes as favorites. | [Source](../../lib/core/directives/node-favorite.directive.ts) |
|
||||
| [Node permission directive](node-permission.directive.md) | Selectively disables an HTML element or Angular component. | [Source](../../lib/core/directives/node-permission.directive.ts) |
|
||||
| [Node restore directive](node-restore.directive.md) | Restores deleted nodes to their original location. | [Source](../../lib/core/directives/node-restore.directive.ts) |
|
||||
| [Upload directive](upload.directive.md) | Uploads content in response to file drag and drop. | [Source](../../lib/core/directives/upload.directive.ts) |
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
---
|
||||
Title: Node Permission directive
|
||||
Title: Check Allowable Operation directive
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-20
|
||||
Last reviewed: 2019-02-13
|
||||
---
|
||||
|
||||
# [Node Permission directive](../../lib/core/directives/node-permission.directive.ts "Defined in node-permission.directive.ts")
|
||||
# [Check Allowable Operation directive](../../lib/core/directives/check-allowable-operation.directive.ts "Defined in check-allowable-operation.directive.ts")
|
||||
|
||||
Selectively disables an HTML element or Angular component.
|
||||
|
||||
@@ -17,7 +17,7 @@ Selectively disables an HTML element or Angular component.
|
||||
- [Details](#details)
|
||||
- [HTML element example](#html-element-example)
|
||||
- [Angular component example](#angular-component-example)
|
||||
- [Implementing the NodePermissionSubject interface](#implementing-the-nodepermissionsubject-interface)
|
||||
- [Implementing the NodeAllowableOperationSubject interface](#implementing-the-nodeallowableoperationsubject-interface)
|
||||
- [Defining your component as an EXTENDIBLE_COMPONENT parent component](#defining-your-component-as-an-extendible_component-parent-component)
|
||||
|
||||
## Basic Usage
|
||||
@@ -47,7 +47,7 @@ Selectively disables an HTML element or Angular component.
|
||||
|
||||
## Details
|
||||
|
||||
The [Node Permission directive](../core/node-permission.directive.md) lets you disable an HTML element or Angular component
|
||||
The [Check Allowable Operation Directive](../core/check-allowable-operation.directive.md) lets you disable an HTML element or Angular component
|
||||
by taking a collection of [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md) instances and checking their permissions.
|
||||
|
||||
The decorated element will be disabled if:
|
||||
@@ -59,8 +59,7 @@ The decorated element will be disabled if:
|
||||
|
||||
A typical use case is to bind a [Document List](../content-services/document-list.component.md)
|
||||
selection property to a toolbar button. In the following example, the "Delete" button should
|
||||
be disabled if no selection is present or if user does not have permission to delete at least one
|
||||
node in the selection:
|
||||
be disabled if no selection is present or if user does not have permission to delete at least one node in the selection:
|
||||
|
||||
```html
|
||||
<adf-toolbar title="toolbar example">
|
||||
@@ -81,7 +80,7 @@ one or more documents that they have permission to delete.
|
||||
|
||||
### Angular component example
|
||||
|
||||
You can add the directive to any Angular component that implements the [`NodePermissionSubject`](../../lib/core/directives/node-permission.directive.ts)
|
||||
You can add the directive to any Angular component that implements the [`NodeAllowableOperationSubject`](../../lib/core/directives/check-allowable-operation.directive.ts)
|
||||
interface (the [Upload Drag Area component](../content-services/upload-drag-area.component.md),
|
||||
for example). You can also use it in much the same way as you would with an HTML element:
|
||||
|
||||
@@ -96,21 +95,21 @@ for example). You can also use it in much the same way as you would with an HTML
|
||||
```
|
||||
|
||||
To enable your own component to work with this directive, you need to implement the
|
||||
[`NodePermissionSubject`](../../lib/core/directives/node-permission.directive.ts) interface and also define it as an
|
||||
[`NodeAllowableOperationSubject`](../../lib/core/directives/check-allowable-operation.directive.ts) interface and also define it as an
|
||||
[`EXTENDIBLE_COMPONENT`](../../lib/core/interface/injection.tokens.ts)
|
||||
parent component,
|
||||
as described in the following sections.
|
||||
|
||||
### Implementing the NodePermissionSubject interface
|
||||
### Implementing the NodeAllowableOperationSubject interface
|
||||
|
||||
The component must implement the [`NodePermissionSubject`](../../lib/core/directives/node-permission.directive.ts) interface which means it must have a
|
||||
The component must implement the [`NodeAllowableOperationSubject`](../../lib/core/directives/check-allowable-operation.directive.ts) interface which means it must have a
|
||||
boolean `disabled` property. This is the property that will be set by the directive:
|
||||
|
||||
```js
|
||||
import { NodePermissionSubject } from '@alfresco/adf-core';
|
||||
|
||||
@Component({...})
|
||||
export class UploadDragAreaComponent implements NodePermissionSubject {
|
||||
export class UploadDragAreaComponent implements NodeAllowableOperationSubject {
|
||||
public disabled: boolean = false;
|
||||
}
|
||||
```
|
||||
@@ -134,8 +133,7 @@ import { EXTENDIBLE_COMPONENT } from '@alfresco/adf-core';
|
||||
{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadDragAreaComponent)}
|
||||
]
|
||||
})
|
||||
export class UploadDragAreaComponent implements NodePermissionSubject { ... }
|
||||
export class UploadDragAreaComponent implements NodeAllowableOperationSubject { ... }
|
||||
```
|
||||
|
||||
**Note:** the usage of **viewProviders** (instead of **providers**) is very important, especially
|
||||
if you want to use this directive on a transcluded component.
|
||||
**Note:** the usage of **viewProviders** (instead of **providers**) is very important, especially if you want to use this directive on a transcluded component.
|
@@ -2,7 +2,7 @@
|
||||
Title: Content service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
Last reviewed: 2019-02-13
|
||||
---
|
||||
|
||||
# [Content service](../../lib/core/services/content.service.ts "Defined in content.service.ts")
|
||||
@@ -56,14 +56,10 @@ Accesses app-generated data objects via URLs and file downloads.
|
||||
Gets content for the given node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Content data
|
||||
- **hasAllowableOperations**(node: `any`): `boolean`<br/>
|
||||
Checks if the node has the properties allowableOperations
|
||||
- _node:_ `any` - Node to check allowableOperations
|
||||
- **Returns** `boolean` - True if the node has the property, false otherwise
|
||||
- **hasAllowableOperations**(node: `Node`, permission: [`AllowableOperationsEnum`](../../lib/core/models/allowable-operations.enum.ts)`|string`): `boolean`<br/>
|
||||
- **hasAllowableOperations**(node: `Node`, allowableOperation: [`AllowableOperationsEnum`](../../lib/core/models/allowable-operations.enum.ts)`|string`): `boolean`<br/>
|
||||
Checks if the user has permissions on that node
|
||||
- _node:_ `Node` - Node to check allowableOperations
|
||||
- _permission:_ [`AllowableOperationsEnum`](../../lib/core/models/allowable-operations.enum.ts)`|string` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
|
||||
- _allowableOperation:_ [`AllowableOperationsEnum`](../../lib/core/models/allowable-operations.enum.ts)`|string` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
|
||||
- **Returns** `boolean` - True if the user has the required permissions, false otherwise
|
||||
|
||||
## Details
|
||||
|
Reference in New Issue
Block a user