i18n - docs translations (#21923)
Created by Github action <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21923?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Co-authored-by: github-actions <github-actions@twenty.com>
This commit is contained in:
committed by
GitHub
parent
fa6d1394af
commit
82f6597dc3
@@ -50,6 +50,119 @@ export default defineRole({
|
||||
});
|
||||
```
|
||||
|
||||
## Satır düzeyi güvenlik
|
||||
|
||||
Nesne ve alan izinleri, bir rolün *hangi nesnelere ve alanlara* erişebileceğine karar verir. **Satır düzeyi
|
||||
izin koşulları** daha da ileri gider ve bir rolün *hangi kayıtları* görebileceğini ve bunlar üzerinde işlem yapabileceğini belirler — örneğin, her harici kullanıcının yalnızca kendi kayıtlarını gördüğü self servis bir rol gibi.
|
||||
|
||||
Rolde `rowLevelPermissionPredicates` ile koşulları tanımlayın. Manifestin geri kalanında olduğu gibi,
|
||||
her koşul kendi `universalIdentifier` değerini taşır ve bir nesneyi ve bir alanı onların
|
||||
`universalIdentifier` değerleriyle belirtir; ayrıca bir `operand` ve (isteğe bağlı olarak) sorgu zamanında değeri enjekte edilen bir workspaceMember alanı içerir — böylece "kaydın sahibi ilişkisinin **geçerli çalışma alanı üyesi olduğunu**" ifade edebilirsiniz:
|
||||
|
||||
```ts src/roles/partner-role.ts
|
||||
import {
|
||||
defineRole,
|
||||
RowLevelPermissionPredicateOperand,
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
||||
} from 'twenty-sdk/define';
|
||||
|
||||
import { ACCOUNT_OWNER_FIELD_UNIVERSAL_IDENTIFIER } from '../fields/account-owner.field';
|
||||
|
||||
export default defineRole({
|
||||
universalIdentifier: 'c3c1dc2e-1a08-4de5-abb7-2139b3d99343',
|
||||
label: 'Partner',
|
||||
description: 'External partner — sees only its own records',
|
||||
canBeAssignedToUsers: true,
|
||||
objectPermissions: [
|
||||
{
|
||||
objectUniversalIdentifier:
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.company.universalIdentifier,
|
||||
canReadObjectRecords: true,
|
||||
canUpdateObjectRecords: true,
|
||||
},
|
||||
],
|
||||
rowLevelPermissionPredicates: [
|
||||
{
|
||||
universalIdentifier: 'd0f0c1a2-3b4c-4d5e-8f60-111111111111',
|
||||
objectUniversalIdentifier:
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.company.universalIdentifier,
|
||||
fieldUniversalIdentifier: ACCOUNT_OWNER_FIELD_UNIVERSAL_IDENTIFIER,
|
||||
operand: RowLevelPermissionPredicateOperand.IS,
|
||||
workspaceMemberFieldUniversalIdentifier:
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember.fields.id
|
||||
.universalIdentifier,
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
Koşullar manifest ile birlikte geldiği için, her kurulum ve yükseltmede rolle birlikte oluşturulur, güncellenir ve kaldırılır — senkronu korumak için ayrı bir kurulum sonrası adım yoktur.
|
||||
|
||||
### Koşulları gruplarla birleştirme
|
||||
|
||||
Varsayılan olarak bir rolün koşulları `AND` ile birleştirilir. Bunların bazılarını `OR` ile birleştirmek (veya
|
||||
mantığı iç içe yerleştirmek) için bir `rowLevelPermissionPredicateGroups` girdisi bildirin ve her koşulu buna
|
||||
`predicateGroupUniversalIdentifier` aracılığıyla yönlendirin. Bu rol, bir iş ortağının ya **sahibi olduğu** ya da **irtibat kişisi** olduğu bir Opportunity'yi görmesine izin verir:
|
||||
|
||||
```ts src/roles/partner-opportunities-role.ts
|
||||
import {
|
||||
defineRole,
|
||||
RowLevelPermissionPredicateGroupLogicalOperator,
|
||||
RowLevelPermissionPredicateOperand,
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
||||
} from 'twenty-sdk/define';
|
||||
|
||||
const OPPORTUNITY = STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity;
|
||||
const CURRENT_MEMBER =
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember.fields.id
|
||||
.universalIdentifier;
|
||||
|
||||
export default defineRole({
|
||||
universalIdentifier: 'b2a1c0d9-8e7f-4a6b-9c5d-222222222222',
|
||||
label: 'Partner (opportunities)',
|
||||
canBeAssignedToUsers: true,
|
||||
objectPermissions: [
|
||||
{
|
||||
objectUniversalIdentifier: OPPORTUNITY.universalIdentifier,
|
||||
canReadObjectRecords: true,
|
||||
},
|
||||
],
|
||||
rowLevelPermissionPredicateGroups: [
|
||||
{
|
||||
universalIdentifier: 'c3b2a1d0-9f8e-4b7a-8d6c-333333333333',
|
||||
objectUniversalIdentifier: OPPORTUNITY.universalIdentifier,
|
||||
logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator.OR,
|
||||
},
|
||||
],
|
||||
rowLevelPermissionPredicates: [
|
||||
{
|
||||
universalIdentifier: 'd4c3b2a1-0e9f-4c8b-9e7d-444444444444',
|
||||
objectUniversalIdentifier: OPPORTUNITY.universalIdentifier,
|
||||
fieldUniversalIdentifier: OPPORTUNITY.fields.owner.universalIdentifier,
|
||||
operand: RowLevelPermissionPredicateOperand.IS,
|
||||
workspaceMemberFieldUniversalIdentifier: CURRENT_MEMBER,
|
||||
predicateGroupUniversalIdentifier: 'c3b2a1d0-9f8e-4b7a-8d6c-333333333333',
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'e5d4c3b2-1f0e-4d9c-8f8e-555555555555',
|
||||
objectUniversalIdentifier: OPPORTUNITY.universalIdentifier,
|
||||
fieldUniversalIdentifier:
|
||||
OPPORTUNITY.fields.pointOfContact.universalIdentifier,
|
||||
operand: RowLevelPermissionPredicateOperand.IS,
|
||||
workspaceMemberFieldUniversalIdentifier: CURRENT_MEMBER,
|
||||
predicateGroupUniversalIdentifier: 'c3b2a1d0-9f8e-4b7a-8d6c-333333333333',
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
Notlar:
|
||||
|
||||
* Her koşula ve gruba kararlı bir `universalIdentifier` (herhangi bir uuid) verin — bu, yükseltmeler boyunca varlığı
|
||||
anahtarlamaya yarar ve koşullar gruplara bu anahtar üzerinden başvurur.
|
||||
* Koşullar, uygulamanıza ait nesnelere ve alanlara veya Twenty'nin standart nesnelerine başvurabilir.
|
||||
* Satır düzeyi güvenlik, bunu içeren planlardaki çalışma alanları için uygulanır; koşullar diğer planlarda da yine senkronize edilir, yalnızca uygulanmaz.
|
||||
|
||||
## Varsayılan fonksiyon rolü
|
||||
|
||||
Yeni bir uygulama iskeleti oluşturduğunuzda, CLI `defineApplicationRole()` ile bildirilen varsayılan bir rol dosyası oluşturur:
|
||||
|
||||
Reference in New Issue
Block a user