Index: openacs-4/packages/acs-subsite/www/permissions/grant-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/Attic/grant-2-oracle.xql,v diff -u -N --- openacs-4/packages/acs-subsite/www/permissions/grant-2-oracle.xql 30 Apr 2001 22:02:48 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - - - oracle8.1.6 - - - - - begin - acs_permission.grant_permission(:object_id, :party_id, :privilege); - end; - - - - - - Index: openacs-4/packages/acs-subsite/www/permissions/grant-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/Attic/grant-2-postgresql.xql,v diff -u -N --- openacs-4/packages/acs-subsite/www/permissions/grant-2-postgresql.xql 30 Apr 2001 22:02:48 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ - - - - postgresql7.1 - - - - - select acs_permission__grant_permission(:object_id, :party_id, :privilege) - - - - - - Index: openacs-4/packages/acs-subsite/www/permissions/grant-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/Attic/grant-2.tcl,v diff -u -N --- openacs-4/packages/acs-subsite/www/permissions/grant-2.tcl 17 May 2003 10:02:04 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,23 +0,0 @@ -# packages/acs-core-ui/www/acs_object/permissions/grant-2.tcl - -ad_page_contract { - - @author rhs@mit.edu - @creation-date 2000-08-20 - @cvs-id $Id: grant-2.tcl,v 1.3 2003/05/17 10:02:04 jeffd Exp $ -} { - object_id:integer,notnull - party_id:integer,notnull - privilege - {application_url ""} -} - -ad_require_permission $object_id admin - -db_exec_plsql grant { - begin - acs_permission.grant_permission(:object_id, :party_id, :privilege); - end; -} - -ad_returnredirect "one?[export_vars {object_id application_url}]" Index: openacs-4/packages/acs-subsite/www/permissions/grant-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/Attic/grant-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/permissions/grant-oracle.xql 17 May 2003 10:02:04 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/permissions/grant-oracle.xql 29 Sep 2003 14:53:37 -0000 1.3 @@ -5,21 +5,27 @@ - select acs_object.name(:object_id) from dual + select acs_object.name(:object_id) - - + - - select p.party_id, - acs_object.name(p.party_id) || nvl2(p.email, ' ('||p.email||')', '') as name - from parties p - order by upper(acs_object.name(p.party_id)) + select privilege, child_privilege + from acs_privilege_hierarchy + + + + + select acs_permission.grant_permission(:object_id, :party_id, :privilege) + + + select acs_permission.revoke_permission(:object_id, :party_id, :privilege) + + Index: openacs-4/packages/acs-subsite/www/permissions/grant-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/Attic/grant-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/www/permissions/grant-postgresql.xql 17 May 2003 10:02:04 -0000 1.3 +++ openacs-4/packages/acs-subsite/www/permissions/grant-postgresql.xql 29 Sep 2003 14:53:37 -0000 1.4 @@ -1,5 +1,4 @@ - postgresql7.1 @@ -9,17 +8,25 @@ - - + - - select p.party_id, - acs_object__name(p.party_id)|| coalesce(' ('||p.email||')', '') as name - from parties p - order by upper(acs_object__name(p.party_id)) + select p.privilege, tree_level(h.tree_sortkey) as level + from acs_privileges p + left join acs_privilege_hierarchy_index h on p.privilege=h.privilege + order by h.tree_sortkey + + + + + select acs_permission__grant_permission(:object_id, :party_id, :privilege) + + + select acs_permission__revoke_permission(:object_id, :party_id, :privilege) + + Index: openacs-4/packages/acs-subsite/www/permissions/grant.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/grant.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/www/permissions/grant.adp 29 Sep 2003 14:53:37 -0000 1.1 @@ -0,0 +1,64 @@ + +@title@ +@context@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Grant:   + + + @first_tr;noquote@ + + + + + + +
    + @mu_privileges.privilege@ +
+ +
 on @name@ to:  + + +
+
+
  + +
+ +
+ +

+ +

+ +Notes: +
+Privileges higher in the hierarchy imply all the privileges below, e.g. when you grant admin, then read, write etc. are implied automatically. +
+When you leave a checkbox empty here then that privilege will be revoked from the party you choose in case it has been granted to that party before. Index: openacs-4/packages/acs-subsite/www/permissions/grant.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/grant.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-subsite/www/permissions/grant.tcl 17 May 2003 10:02:04 -0000 1.4 +++ openacs-4/packages/acs-subsite/www/permissions/grant.tcl 29 Sep 2003 14:53:37 -0000 1.5 @@ -2,53 +2,179 @@ ad_page_contract { - @author rhs@mit.edu - @creation-date 2000-08-20 - @cvs-id $Id$ + @author rhs@mit.edu + @creation-date 2000-08-20 + @cvs-id $Id$ } { - object_id:integer,notnull - {application_url ""} + object_id:integer,notnull + privileges:multiple,optional + {application_url ""} } ad_require_permission $object_id admin # The object name is used in various localized messages below set name [db_string name {select acs_object.name(:object_id) from dual}] -doc_body_append "[ad_header "[_ acs-subsite.lt_Grant_Permission_on_n]"] +set title [_ acs-subsite.lt_Grant_Permission_on_n] -

[_ acs-subsite.lt_Grant_Permission_on_n]

+set context [list [list one?[export_url_vars object_id] "[_ acs-subsite.Permissions_for_name]"] [_ acs-subsite.Grant]] -[ad_context_bar [list ./?[export_url_vars object_id] "[_ acs-subsite.Permissions_for_name]"] "[_ acs-subsite.Grant]"] -
-
-[export_vars -form {application_url object_id}] +set existing_privs [list] +set hierarchy [list] +set maxlevel 1 - - -[_ acs-subsite.on] $name [_ acs-subsite.to] - +for { set i 0 } { $i < $maxlevel } { incr i } { + append first_tr "   " +} - +form create grant -
+element create grant object_id \ + -widget hidden \ + -value $object_id -[ad_footer] -" +element create grant application_url \ + -widget hidden \ + -value $application_url \ + -optional + +element create grant party_id \ + -widget party_search \ + -datatype party_search \ + -optional + + +if { [form is_valid grant] } { + # A valid submission, grant and revoke accordingly. + + form get_values grant + + if { ![info exists privileges] } { + # no privilege was selected + set privileges [list] + } + + # loop through all privileges, grant checked and revoke un-checked + # (assuming that there are not too many privs in total, otherwise + # this would be slow) + foreach privilege $existing_privs { + if { [lsearch $privileges $privilege] > -1 } { + db_exec_plsql grant { } + } else { + db_exec_plsql revoke { } + } + } + + ad_returnredirect "one?[export_url_vars object_id]" +} + Index: openacs-4/packages/acs-subsite/www/permissions/grant.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/grant.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/permissions/grant.xql 30 Apr 2001 22:02:48 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/permissions/grant.xql 29 Sep 2003 14:53:37 -0000 1.2 @@ -1,7 +1,7 @@ - + select privilege