access

You are currently browsing articles tagged access.

Since I work in a k12 environment, I needed to make a plugin that removed “Public” as an option when users post content. I didn’t take me long to locate the file engine/lib/access.php as the file that controls these functions.

I hacked the core code and indeed it functioned as I wanted it to. Hacks to the core are undesireable because it complicates upgrading, so I wanted to create an override. I worked many hours trying to create a hack of the core access.php, but I was unsuccessful. I just couldn’t figure out how to write a start.php that would function. Finally, I had a break through, but it had nothing to do with overriding engine/lib/access.php.

Diego Andrés Ramírez Aragón and Jens von der Heydt suggested that the key to this may reside in the views directory. I knew how to write an override of elgg views. First I created the initial directories for the plugin:

nopublic/
nopublic/views

To find the rest of the pathway, I had to find where the access file was in the views directory and mirror it. Since it was in

views/default/input/access.php

I created

nopublic/views/default/input/

Next I opened created a copy of the original access.php, made my hacks and inserted it plugins’s input folder.

$class = $vars['class'];
if (!$class) $class = “input-access”;

if (!is_array($vars['options']))
{
$vars['options'] = array();
$vars['options'] = get_write_access_array();
}

if (is_array($vars['options']) && sizeof($vars['options']) > 0) {

?>

was changed to:

$class = $vars['class'];
if (!$class) $class = “input-access”;

if (!is_array($vars['options']))
{
$vars['options'] = array();
$vars['options'] = get_write_access_array();
unset($vars['options'][2]);
}

if (is_array($vars['options']) && sizeof($vars['options']) > 0) {

?>

The start.php requires no hooks. Simply initialize and register the plugin:

<?php
function nopublic_init() {

}

register_elgg_event_handler(’init’,’system’,’nopublic_init’);
?>

I put that in my plugin directory, along with an manifest.xml file so now I had:

nopublic/start.php
nopublic/manifest.xml
nopublic/views/default/input/access.php

That disables the public access option–the basic nopublic plugin. There are many directories in the views folder that can be overridden this easily.

Clearly, there is much to explore with views overrides. I look forward to learning more about the manifestations of each file. They provide important customization options beyond themes.

I’d like to hear how others are using views overrides!

Tags: , , , ,

By request, I have written another access plugin. This one eliminates the “private” and “logged in users” options leaving only “public.”

That’s all it does. Not much else to say but download here.

Tags: , , ,

I plan on using Elgg in a K12 environment, particularly my fifth graders. In order to do this in a manner that complies with our school policies and culture, I had to make some changes. Since the Elgg environment is unmoderated, I had to remove all public access to content.

Elgg’s “Walled Garden” does part of the job in that it disables public registration, but any content that users created had the option of public access which would be visible to individuals not logged in.

I created a plugin with a view override that removes this option. Now users have the choice of private or logged in users (along with any friends’ collections) when setting the access to content.

Still, access to the site could be had by RSS feeds and OpenDD. I’m not sure how big an issue this is, but I’d like to be able to do it. Dave Tosh suggested, I created an override of owners’ block eliminating those options. I believe access to these can be had unless I delete the rss and opendd views from the core. That will work, but I wonder if I could create an override of those views that disables them. I plan on looking into this.

No links to subscribe to feeds

I combined my initial plugin, with Marcus Povey’s “Walled Garden.” With “Higher Walls,” not only is registration disabled, but so is public access. Links to RSS and OpenDD feeds are also disabled.

Another issue remains. If access to content is restricted to logged in users, then the Latest Activity on the default main page will remain as a header with nothing below it. I used Customindex plugin to change the mainpage to a login page by pasting:

$form_body = “<p><label>” . elgg_echo(’username’) . “<br />” . elgg_view(’input/text’, array(’internalname’ => ‘username’, ‘class’ => ‘login-textarea’)) . “</label><br />”;
$form_body .= “<label>” . elgg_echo(’password’) . “<br />” . elgg_view(’input/password’, array(’internalname’ => ‘password’, ‘class’ => ‘login-textarea’)) . “</label><br />”;
$form_body .= elgg_view(’input/submit’, array(’value’ => elgg_echo(’login’))) . “</p>”;
$form_body .= “<p>” . elgg_echo(”) . “</a>  <a href=\”". $vars['url'] .”account/forgotten_password.php\”>” . elgg_echo(’user:password:lost’) . “</a></p>”;
echo elgg_view(’input/form’, array(’body’ => $form_body, ‘action’ => “”. $vars['url'] .”action/login”));

into customindex/views/default/customindex/content.php.

Further modifications could be done on the custom index, but this certainly serves the purpose. It is comparable to what one would encounter in a password protected WordPressMU blog.

Now I am convinced that Elgg can be modified to work within the K12 environment. Higher Walls and removing rss and opendd views directories restricts access to the community very effectively. A better solution would disabling rss and opendd through the plugin rather than deleting core files.

Now that these matters appear worked out, I plan to focus more on Elgg in terms of pedagogy. Nonetheless, I will tweak “Higher Walls” over time.

Download

Thanks to:

  • Marcus Povey
  • Boris Glumpler
  • Jens von der Heydt
  • Diego Andrés Ramírez Aragón

Tags: , , , , ,