Ignore:
Timestamp:
08/03/12 09:07:20 (12 years ago)
Author:
nanardon
Message:

Add ACL support to datarequest

If the forms contains a list of validators and user match it, permissions are
granted,
If global acl config grant '@VALIDATE' over 'request' object and user match it,
permissions are granted,
and if nothing match, permissions are checked over the pointed object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm

    r1071 r1091  
    487487=head2 list_requests 
    488488 
    489 List user request currently waiting in base 
     489list user request currently waiting in base 
    490490 
    491491=cut 
     
    500500    }); 
    501501    $sth->execute; 
     502    my @ids; 
     503    while (my $res = $sth->fetchrow_hashref) { 
     504        push(@ids, $res->{id}); 
     505    } 
     506 
     507    @ids 
     508} 
     509 
     510=head2 list_requests_by_submitter ($id) 
     511 
     512list user request currently waiting in base ask by user C<$id> 
     513 
     514=cut 
     515 
     516sub list_requests_by_submitter { 
     517    my ($self, $id) = @_; 
     518 
     519    my $sth = $self->db->prepare(q{ 
     520        select id from request 
     521        where done is null and user = ? 
     522        order by apply 
     523    }); 
     524    $sth->execute($id); 
     525    my @ids; 
     526    while (my $res = $sth->fetchrow_hashref) { 
     527        push(@ids, $res->{id}); 
     528    } 
     529 
     530    @ids 
     531} 
     532 
     533 
     534=head2 list_request_by_object ($otype, $id) 
     535 
     536Return the list of pending request for a specific object 
     537 
     538=cut 
     539 
     540sub list_request_by_object { 
     541    my ($self, $otype, $id) = @_; 
     542 
     543    my $sth = $self->db->prepare(q{ 
     544        select * from request join 
     545        accreq on request.name = accreq.name 
     546        join accreq_attributes on accreq_attributes.okey = accreq.ikey 
     547        where 
     548        request.applied is NULL and 
     549        accreq_attributes.attr = 'oType' and 
     550        accreq_attributes.value = ? 
     551        and request.object = ? 
     552        order by apply 
     553    }); 
     554    $sth->execute($otype, $id); 
    502555    my @ids; 
    503556    while (my $res = $sth->fetchrow_hashref) { 
Note: See TracChangeset for help on using the changeset viewer.