Page MenuHomePhorge
Authored By
aklapper
Jun 3 2023, 12:06
Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 3d8570b4f7..efebb42f48 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4622,6 +4622,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoryIdentity' => 'applications/repository/storage/PhabricatorRepositoryIdentity.php',
'PhabricatorRepositoryIdentityAssignTransaction' => 'applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php',
'PhabricatorRepositoryIdentityChangeWorker' => 'applications/repository/worker/PhabricatorRepositoryIdentityChangeWorker.php',
+ 'PhabricatorRepositoryIdentityEditCapability' => 'applications/repository/capability/PhabricatorRepositoryIdentityEditCapability.php',
'PhabricatorRepositoryIdentityEditEngine' => 'applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php',
'PhabricatorRepositoryIdentityFerretEngine' => 'applications/repository/search/PhabricatorRepositoryIdentityFerretEngine.php',
'PhabricatorRepositoryIdentityPHIDType' => 'applications/repository/phid/PhabricatorRepositoryIdentityPHIDType.php',
@@ -11313,6 +11314,7 @@ phutil_register_library_map(array(
),
'PhabricatorRepositoryIdentityAssignTransaction' => 'PhabricatorRepositoryIdentityTransactionType',
'PhabricatorRepositoryIdentityChangeWorker' => 'PhabricatorWorker',
+ 'PhabricatorRepositoryIdentityEditCapability' => 'PhabricatorPolicyCapability',
'PhabricatorRepositoryIdentityEditEngine' => 'PhabricatorEditEngine',
'PhabricatorRepositoryIdentityFerretEngine' => 'PhabricatorFerretEngine',
'PhabricatorRepositoryIdentityPHIDType' => 'PhabricatorPHIDType',
diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
index e0e74486da..fc349c8896 100644
--- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
+++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
@@ -183,6 +183,9 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
DiffusionCreateRepositoriesCapability::CAPABILITY => array(
'default' => PhabricatorPolicies::POLICY_ADMIN,
),
+ PhabricatorRepositoryIdentityEditCapability::CAPABILITY => array(
+ 'default' => PhabricatorPolicies::POLICY_USER,
+ ),
);
}
diff --git a/src/applications/repository/capability/PhabricatorRepositoryIdentityEditCapability.php b/src/applications/repository/capability/PhabricatorRepositoryIdentityEditCapability.php
new file mode 100644
index 0000000000..aa53163e70
--- /dev/null
+++ b/src/applications/repository/capability/PhabricatorRepositoryIdentityEditCapability.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorRepositoryIdentityEditCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'repository.identity.create';
+
+ public function getCapabilityName() {
+ return pht('Can Create and Edit Identities');
+ }
+
+ public function describeCapabilityRejection() {
+ return pht('You do not have permission to create or edit identities.');
+ }
+
+}
diff --git a/src/applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php b/src/applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php
index 742e4a159f..20fc6313cc 100644
--- a/src/applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php
@@ -70,7 +70,8 @@ final class PhabricatorRepositoryIdentityEditEngine
}
protected function getCreateNewObjectPolicy() {
- return PhabricatorPolicies::POLICY_USER;
+ return $this->getApplication()->getPolicy(
+ PhabricatorRepositoryIdentityEditCapability::CAPABILITY);
}
protected function buildCustomEditFields($object) {

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
206487
Default Alt Text
T15443 (3 KB)

Event Timeline