I must be blind - remove members from a permission point? 
Posted: 02 June 2007 09:23 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

Hi… I am feeling really blind right now.  How do I remove a member from a permission point? I don’t see a template in the docs for it, only for approval.  Thankfully I don’t *need* to right now but it’d make me more comfortable if I had the template ready to go. =)

Me, needing tech support.  I should have used a pseudonym.

Profile
 
 
Posted: 02 June 2007 09:36 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  694
Joined  2004-03-30

The approval forms should also double as deny forms. It should be all about the checking and unchecking of boxes.

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 02 June 2007 09:41 PM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

I thought as much so looked at member list figuring I wanted to remove people that already had access. but there’s no delete checkbox code there.  What’s the magic, please?  I see how I can list only people with permission to a point, but not how to add a checkbox to thusly remove them from said point.

Profile
 
 
Posted: 02 June 2007 09:43 PM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

Also - approval form deletion I wasn’t quite following the docs.  Adding that code doesn’t add a delete checkbox, and not checking someone in the list then submitting just leaves them in the list.

Profile
 
 
Posted: 02 June 2007 09:45 PM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

Nevermind reply 3, I had the delete checkbox outside of the member names container.  Still having the problem removing members from a point.

Profile
 
 
Posted: 02 June 2007 10:18 PM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

Ok, I just can’t figure this out.  I’ve tried this:

{exp:permission:assign_form name="friends"  form_name="grant_friends" form_id="grant_friends" return="{dem_group}/grant_friends"}
<h2>
The following knuckleheads will be approved for {label}.
</
h2>
{members}
{if approved}
<input type="checkbox" name="approve[]" value="{member_id}" /> {screen_name} delete  delete <input type="checkbox" name="delete" value="yes" />: {approved}<br />
{/if}
{
/members}
<input type="submit" />
{/exp:permission:assign_form}

I was kind of guessing here.  {approved} doesn’t work and it ignores {ir approved} and shows all members in my EE.  I stole the checkbox code from the member approval form and checking it does nothing when submitting the form.

I also tried this trick with the member list and nothing.

So - what I really want/need to be able to do is to list everything that is currently approved to a particular permission point, with a checkbox next to their names and a submit button at the bottom.  Checking the box and hitting the submit button would remove their permission to that point.  They’d then, of course, no longer show up in this list when then form is visited again.

Something like:

___
Members with current access to Friends:

Bob [ ]
Jane [ ]
Harry [ ]
Harriet [ ]

Check all [ ]
Submit
___

I’m just not seeing how to realize this.

And yea, I realize a lot isn’t in the docs - I was making things up, I admit it. =) Just trying to find something that worked.

Profile
 
 
Posted: 03 June 2007 01:31 PM   [ Ignore ]   [ # 6 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

Lisa, I’m sorry I don’t have an answer for you. Permission is still rather new, and I haven’t had much of a chance to play with it. So, if there is help, it probably needs to come from Mitchell himself smile

 Signature 

Ingmar Greil

Profile
 
 
Posted: 03 June 2007 01:38 PM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

I expect my answers within 30 seconds, Sundays included. =)

Profile
 
 
Posted: 03 June 2007 01:45 PM   [ Ignore ]   [ # 8 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

Well, it’s a shame we can’t all live up to your standards tongue laugh

 Signature 

Ingmar Greil

Profile
 
 
Posted: 03 June 2007 02:13 PM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

If only the world behaved as I expect it to....

Profile
 
 
Posted: 08 June 2007 03:50 PM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  18
Joined  2007-06-08

In order to get the functionality you are looking for, you’ll have to modify the code.  In mod.permission.php, find the function assign() and change it to the code below (ive denoted my edits with ‘drch edit’ and there are 2 of them). 

To use it, do the same as you would with approve[], but instead use delete[] (with the square brackets).

function assign()
    
{
        
global $DB$FNS$IN$LANG$LOC$PREFS$REGX$SESS;
        
        
// -------------------------------------------
        //    Logged in?
        // -------------------------------------------
        
        
if ( $SESS->userdata['member_id'== )
        
{
            
return $this->_fetch_error$LANG->line('not_logged_in'), $IN->GBL('template') );
        
}
        
        
// -------------------------------------------
        //  Permission id
        // -------------------------------------------
        
        
if ( ! $this->permission_id $IN->GBL('permission_id') )
        
{
            
return $this->_fetch_error$LANG->line('no_permission_id'), $IN->GBL('template') );
        
}
        
        
// -------------------------------------------
        //  Check Form Hash
        // -------------------------------------------
        
        
if ( $PREFS->ini('secure_forms') == 'y' )
        
{
            $query 
$DB->query("SELECT COUNT(*) AS count FROM exp_security_hashes WHERE hash='".$DB->escape_str($_POST['XID'])."' AND ip_address = '".$IN->IP."' AND date > UNIX_TIMESTAMP()-7200");
        
            if (
$query->row['count'== 0)
            
{
                
return $this->_fetch_error$LANG->line('not_authorized'), $IN->GBL('template') );
            
}
                                
            $DB
->query("DELETE FROM exp_security_hashes WHERE (hash='".$DB->escape_str($_POST['XID'])."' AND ip_address = '".$IN->IP."') OR date < UNIX_TIMESTAMP()-7200");
        
}
        
        
// -------------------------------------------
        //  Prepare approves
        // -------------------------------------------
        
        
$_POST        $REGX->xss_clean$_POST );
        
        
$approves    = array();
        
        if ( 
$IN->GBL'approve''POST' ) )
        
{
            
if ( is_array$_POST['approve') )
            
{
                
foreach ( $_POST['approve'as $val )
                
{
                    $approves[ $val ]    
$val;
                
}
            }
            
else
            
{
                $approves[ $val ]    
$_POST['approve'];
            
}
        }
        
        
//drch edit
        //prepare a list of member id's to delete
        
$deletes = array();
        if ( 
$IN->GBL'delete''POST' ) )
        
{
            
if ( is_array$_POST['delete') )
            
{
                
foreach ( $_POST['delete'as $val )
                
{
                    $deletes[ $val ]    
$val;
                
}
            }
            
else
            
{
                $deletes[ $val ]    
$_POST['delete'];
            
}
        }
        
//end drch
        
        // -------------------------------------------
        //  Let's get real id's out of the DB.
        // -------------------------------------------
        
        
$query    $DB->query"SELECT post_id, approved, member_id, email FROM exp_permission_posts WHERE permission_id = '$this->permission_id'" );
        
        
// -------------------------------------------
        //  Handle existing requests
        // -------------------------------------------
        
        
foreach ( $query->result as $row )
        
{
            
            
if ( in_array$row['member_id']$approves ) AND $row['approved'== 'n' )
            
{
                $DB
->query$DB->update_string'exp_permission_posts', array( 'approved' => 'y''edit_date' => $LOC->now ), array( 'post_id' => $row['post_id') ) );
            
}
            
//drch edit
            //if the member id is in deletes, remove from db.
            
elseif (in_array($row['member_id']$deletes)) 
                $DB
->query"DELETE FROM exp_permission_posts WHERE post_id = '".$row['post_id']."'" );    
            
}
            
//end drch
            
elseif ( ! in_array$row['member_id']$approves ) AND $row['approved'== 'y' )
            
{
                $DB
->query$DB->update_string'exp_permission_posts', array( 'approved' => 'n''edit_date' => $LOC->now ), array( 'post_id' => $row['post_id') ) );
            
}
            
            
unset( $approves[ $row['member_id'] ] );
        
}
        
        
// -------------------------------------------
        //  Approve additional
        // -------------------------------------------
        
        
foreach ( $approves as $member_id )
        
{
            $data                
$this->_data();
            
$data['member_id']    $member_id;
            
$data['approved']    'y';
            
$DB->query$DB->insert_string'exp_permission_posts'$data ) );
        
}
        
        
// -------------------------------------------
        //  Return
        // -------------------------------------------
        
        
$data['failure']    FALSE;
        
$data['success']    TRUE;
        
$data['message']    $LANG->line('member_approved');
        
        
        if ( 
$IN->GBL('template') )
        
{
            
if ( $body $this->_fetch_template$IN->GBL('template'), $data ) )
            
{
                
return $body;
            
}
            
else
            
{
                $FNS
->redirect$IN->GBL('RET') );
            
}
        }
        
elseif ( $IN->GBL('return') )
        
{
            $FNS
->redirect$IN->GBL('return') );
        
}
        
else
        
{
            $FNS
->redirect$IN->GBL('RET') );
        
}
    }
    
    
//    End assign

Profile
 
 
Posted: 08 June 2007 04:10 PM   [ Ignore ]   [ # 11 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

Will you be adding something like this in a future version? I don’t need it now or anytime in the foreseeable future, but I can definitely see the need to see members from a group and be able to remove them from such.

Profile
 
 
Posted: 09 June 2007 01:50 PM   [ Ignore ]   [ # 12 ]
Jr. Member
RankRank
Total Posts:  45
Joined  2005-04-24

Oh, and Daryl - thank you for the information about the hack.  I’m not going to hack this though, but it is appreciated. =)

Profile
 
 
Posted: 10 June 2007 01:42 AM   [ Ignore ]   [ # 13 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09
Lisa Wess - 08 June 2007 04:10 PM

Will you be adding something like this in a future version? I don’t need it now or anytime in the foreseeable future, but I can definitely see the need to see members from a group and be able to remove them from such.

Lisa, we might. Mitchell will be the final arbiter on this issue, of course, and he’s gone on a two-week honeymoon. So it’s just as well you don’t need it right now…

 Signature 

Ingmar Greil

Profile