Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
427 lines (284 sloc) 8.72 KB
# -*- coding: utf-8 -*-
# Copyright (c) 2007-2012 by Enrique Pérez Arnaud <enriquepablo@gmail.com>
#
# This file is part of nlproject.
#
# The nlproject is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The nlproject is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with any part of the nlproject.
# If not, see <http://www.gnu.org/licenses/>.
person are thing.
content are thing.
document are content.
image are content.
context are thing.
john isa person.
sue isa person.
pete isa person.
mary isa person.
doc1 isa document.
doc2 isa document.
img1 isa image.
img2 isa image.
ctx1 isa context.
ctx2 isa context.
a person can content_action (exists) what a content.
a person can view (content_action).
a person can edit (content_action).
a person can owns (content_action).
a thing can located (exists) in a context.
if:
Thing1 [located in Context1] D1;
Context1 [located in Context2] D2;
then:
Thing1 [located in Context2] until D1, D2.
doc1 [located in ctx1] onwards.
ctx1 [located in ctx2] onwards.
extend.
doc1 [located in ctx2]?
doc1 \[located in ctx2\] since [0-9]+ onwards.
a person can wants (exists) that a person, do a content_action.
a person can is_allowed (exists) to a content_action.
if:
Person1 [wants that Person1, do [Content_action1]];
Person1 [is_allowed to [Content_action1]];
then:
Person1 [Content_action1].
sue [wants that sue, do [view what doc1]].
sue [is_allowed to [view what doc1]].
extend.
sue [view what doc1]?
sue \[view what doc1\] at [0-9]+.
a person can may (exists)
what a verb,
where a context.
if:
Person1 [wants that Person1, do [Content_actionVerb1 what Content1]];
Person1 [may what Content_actionVerb1, where Context1];
Content1 [located in Context1];
then:
Person1 [Content_actionVerb1 what Content1].
mary [wants that mary, do [view what doc1]].
mary [may what view, where ctx1].
a person can wf_action (content_action).
a person can publish (wf_action).
a person can hide (wf_action).
status are thing.
public isa status.
private isa status.
workflow are thing.
a workflow can is_assigned (exists)
to a noun,
in a context.
transition are thing.
a thing can has (exists) what a thing.
a transition can executed (exists)
by a verb,
fro_m a status,
to a status.
role are thing.
manager isa role.
editor isa role.
visitor isa role.
permission are thing.
basic_perm isa permission.
edit_perm isa permission.
manage_perm isa permission.
a verb can is_protected (exists)
by a permission,
in a context,
for a status.
if:
Person1 [wants that Person1, do [Content_actionVerb1 what Content1]] at I1;
Content1 [located in Context1] D1;
Content1 [has what Status1] D2;
Person1 [has what Role1] D3;
Role1 [has what Permission1] D4;
Content_actionVerb1 [is_protected by Permission1, in Context1, for Status1] D5;
I1 during D1, D2, D3, D4, D5;
then:
Person1 [Content_actionVerb1 what Content1] at I1.
if:
Person1 [Wf_actionVerb1 what Content1(ContentNoun1)] at I1;
Workflow1 [is_assigned to ContentNoun1, in Context1] D1;
Workflow1 [has what Transition1] D2;
Transition1 [executed by Wf_actionVerb1, fro_m Status1, to Status2] D3;
Content1 [has what Status1] D4;
I1 during D1, D2, D3, D4;
then:
finish D4 at I1;
Content1 [has what Status2] since I1 until D1, D2, D3.
manager [has what manage_perm] onwards.
manager [has what edit_perm] onwards.
manager [has what basic_perm] onwards.
editor [has what edit_perm] onwards.
editor [has what basic_perm] onwards.
visitor [has what basic_perm] onwards.
publish [is_protected by manage_perm, in ctx1, for private] onwards.
hide [is_protected by edit_perm, in ctx1, for public] onwards.
edit [is_protected by edit_perm, in ctx1, for private] onwards.
edit [is_protected by manage_perm, in ctx1, for public] onwards.
view [is_protected by edit_perm, in ctx1, for private] onwards.
view [is_protected by basic_perm, in ctx1, for public] onwards.
wf1 isa workflow.
hide_tr isa transition.
wf1 [has what hide_tr] onwards.
publish_tr isa transition.
wf1 [has what publish_tr] onwards.
hide_tr [executed by hide, fro_m public, to private] onwards.
publish_tr [executed by publish, fro_m private, to public] onwards.
wf1 [is_assigned to document, in ctx1] onwards.
john [has what manager] onwards.
mary [has what editor] onwards.
pete [has what visitor] onwards.
doc1 [has what private] onwards.
pete [wants that pete, do [publish what doc1]].
extend.
pete [publish what doc1]?
False.
doc1 [has what Status1] D1?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
john [publish what doc1]?
john \[publish what doc1\] at [0-9]+.
doc1 [has what public]?
doc1 \[has what public\] since [0-9]+ onwards.
doc1 [has what public] now?
doc1 \[has what public\] since [0-9]+ onwards.
doc1 [has what public] at I1?
doc1 \[has what public\] since [0-9]+ onwards.
doc1 [has what public] D1?
doc1 \[has what public\] since [0-9]+ onwards.
now.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
pete [wants that pete, do [view what doc1]].
extend.
pete [view what doc1] now?
pete \[view what doc1\] at [0-9]+.
john [wants that john, do [hide what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what private\] since [0-9]+ onwards.
pete [wants that pete, do [view what doc1]].
extend.
pete [view what doc1] now?
False.
john [wants that john, do [publish what doc1]].
extend.
now.
doc1 [has what Status1]?
doc1 \[has what public\] since [0-9]+ onwards.
pete [wants that pete, do [view what doc1]].
extend.
pete [view what doc1] now?
pete \[view what doc1\] at [0-9]+.