Massacls Action
This is the development page for the Massacls action.
The Masaacls Action is a part of the PageAdminAction.
User view
After sending the data from the PageAdminAction, a form was created to input the needed acl data.If a field left empty, the value did'nt change
Read ACL:
|
Write ACL:
|
Comments ACL:
|
||
|
The Protocoll
write ACL updated for HeinrichHeine
write ACL updated for KurtTocholsky
The Code
After sending this form to Massacls the changes where made and a small protocol is shown:The sourcecode is the first draft and in an alpha-status.
It works, not more, documentation and some changes for translation etc. will following.
- <?php
- {
- //We show only a form without any data, so no security checks are possible.
- //First of all, put all the id_xxx=on into string for easier use
- $ids = '';
- //Perhaps it is usefull to use the same as in acls.php
- echo $this->FormOpen()
- ?>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top" style="padding-right: 20px">
- <strong>Read ACL:</strong><br />
- <textarea name="read_acl" rows="4" cols="20"></textarea>
- <td>
- <td valign="top" style="padding-right: 20px">
- <strong>Write ACL:</strong><br />
- <textarea name="write_acl" rows="4" cols="20"></textarea>
- <td>
- <td valign="top" style="padding-right: 20px">
- <strong>Comments ACL:</strong><br />
- <textarea name="comment_acl" rows="4" cols="20"></textarea>
- <td>
- </tr>
- <tr>
- <td colspan="3">
- <br />
- <input type="hidden" name="action" value="massacls"/>
- <input type="hidden" name="ids" value="<?php echo $ids;?>"/>
- <input type="submit" value="Store ACLs" style="width: 120px" accesskey="s" />
- <input type="button" value="Cancel" onclick="history.back();" style="width: 120px" />
- </td>
- </tr>
- <tr>
- <td colspan="3">
- <br /><h4>Syntax:</h4><br />
- * = Everyone<br />
- + = Registered users<br />
- Or enter individual user WikiNames, one per line<br />
- --------------------------------------<br />
- Note: Any of these items can be negated with a !<br />
- !* = No one<br />
- !+ = Anonymous users<br />
- !JohnDoe = JohnDoe will be denied access.<br />
- <br />
- <em>Be aware that the ACLs are tested in the order specified.</em>
- <br/ >So be sure to specify * on a separate line
- <br /><b>after</b> negating any users--not before.
- <br/ >Otherwise, the * everyone condition will always give access
- <br/ >before the list of users that should not have access is tested.
- <td>
- </tr>
- </table>
- <?php
- print($this->FormClose());
- }
- else if (isset($_POST['action']) && $this->IsAdmin($this->GetUser())) // we have to do the acl change action
- {
- function mySaveACL($page, $tag, $acl, $acls)
- {
- $posted = $_POST[$acl.'_acl'];
- //$default = $page->GetConfigValue('default_'.$acl.'_acl');
- if ($posted != $acls[$acl.'_acl'])
- {
- //if ($posted == $default)
- // $posted = '';
- $page->SaveACL($tag, $acl, $page->TrimACLs($posted));
- print ('<p>'.$acl.' ACL updated for <a href="'.$page->Href('',$tag, '').'">'.$tag.'</a></p>');
- }
- }
- if ($id != '')
- {
- $page = $this->LoadPageById($id);
- $tag = $page['tag'];
- $acls = $this->LoadAllACLs($tag,0);
- mySaveACL($this, $tag, 'read', $acls);
- mySaveACL($this, $tag, 'write', $acls);
- mySaveACL($this, $tag, 'comment', $acls);
- }
- }
- else
- print ('<p>What are you doing here?</a></p>');
- print ('<p><a href="'.$this->Href('','','').'">Seiten - Administration</a></p>');
- ?>
Feel free to make it secure and better!
CategoryDevelopmentActions