Skip to content

Commit f12f836

Browse files
Merge pull request #197 from mdsol/feature/prohib-create
Allow prohibition operations to be created w tilde prefix
2 parents ebf4097 + d2da71d commit f12f836

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 4.0.7
4+
* Allow prohibition operations to be created without workaround.
5+
36
## 4.0.6
47
* Fallback to empty hash when extra_attributes are not set.
58

lib/policy_machine/policy_element.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ def allowed_assignee_classes
198198
# An operation in a policy machine.
199199
class Operation < PolicyElement
200200
def self.create(unique_identifier, policy_machine_uuid, pm_storage_adapter, extra_attributes = {}, prohibition = false)
201-
if unique_identifier =~ /^~/ && !prohibition
202-
raise ArgumentError, "A non-prohibition operation cannot start with '~'"
203-
end
204201
new_pe = new(unique_identifier, policy_machine_uuid, pm_storage_adapter, nil, extra_attributes)
205202
new_pe.stored_pe = pm_storage_adapter.add_operation(unique_identifier, policy_machine_uuid, extra_attributes)
206203
new_pe

lib/policy_machine/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class PolicyMachine
2-
VERSION = "4.0.6"
2+
VERSION = "4.0.7"
33
end

spec/support/shared_examples_policy_machine.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,6 @@
395395
end
396396

397397
describe 'Operations' do
398-
it 'does not allow an operation to start with a ~' do
399-
expect{policy_machine.create_operation('~apple')}.to raise_error(ArgumentError)
400-
expect{policy_machine.create_operation('apple~')}.not_to raise_error
401-
end
402-
403398
it 'can derive a prohibition from an operation and vice versa' do
404399
@op = policy_machine.create_operation('fly')
405400
expect(@op.prohibition).to be_prohibition

0 commit comments

Comments
 (0)