21
ajaxbr
Re: Adding the group permission feature to your module
  • 2004/3/14 22:39

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


I know that ByteHoard can do exactly that, you can set "disk quota" for users. So I'll check how it does that and report back soon.

22
ajaxbr
Re: Adding the group permission feature to your module
  • 2004/3/14 23:03

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


There...
Remember that everything shown in this post is under Bytehoard team copyrights.

First off, they have a function to find out how many bytes a given directory with all its files and subdirectories has:

From users.inc.php,

function dirsize($dir) {
$dh opendir($dir);
   
$size 0;
   while ((
$file readdir($dh)) !== FALSE)
       if (
$file != "." and $file != "..") {
           
$path $dir."/".$file;
           if (
is_dir($path))
               
$size += dirsize($path);
          elseif (
is_file($path))
               
$size += filesize($path);
      }
   
closedir($dh);
  return 
$size;
}


Then they have a simple "user space used" function. It's important to plan the module's directory structure to allow this kind of check.
function userspaceused_bh($username) {
global 
$dbconfig$config;
$dir $config['ufileroot'].$username;
return 
dirsize($dir);
}


ByteHoard is under the GPL and has many interesting features, I believe it could both contribute to and benefit from a nice relationship with XOOPS. Oh, and their source files are pretty neat in my non-programmer opinion

23
ajaxbr
Re: Adding the group permission feature to your module
  • 2004/3/14 23:13

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


And from files.inc.php, again under Bytehoard team copyright:

function upload_bh($uploadf$destpath$fsize) {

global 
$config$tplvars$dbconfig$lang;
if ((
$fsize+userspaceused_bh($_SESSION['username']))>userlimit_bh($_SESSION['username'])) {
    return 
"You do not have enough free space";
}
# Get file's new path
$filepath $config['ufileroot'].$destpath;
# Do move
$didmove move_uploaded_file($uploadf$filepath);
# Check for error
if ($didmove === FALSE) {die($lang['cant_save_uploaded'].":<p>".$filepath);}
# CHMOD it right
@chmod($filepath0600);
acl_add($destpath$_SESSION['username']);
return 
0;
}


24
Brad
Re: Adding the group permission feature to your module
  • 2004/3/15 1:36

  • Brad

  • Not too shy to talk

  • Posts: 150

  • Since: 2003/12/4


Keep in mind that I was just using the "quota" field as a specific example of the generic issue.

Perhaps in addition to the "checkRight" method on the groupperm object, there could also be a "getValue" or "getPermission" method that would retrieve the value of the permission as opposed to a yes/no.

In the specific example I was talking about, the module would get the quota permission and then deny or allow it. This as opposed to the permission object saying yes or no.

Brad

25
jegelstaff
Re: Adding the group permission feature to your module

Hello, this is a great, great feature! I have used it to very easily add several permissions to a module I'm working on.

I have a question/request about access to the forms created by XoopsGroupPermForm.

I would like it to work like this:

1. a user is a member of a group that has module admin rights for the module where I have used this form.
2. that user logs in, goes to the admin menu, all they get is the admin section for the module their group has admin rights for.
3. that user goes into the admin section for the module, and goes to the permission form XoopsGroupPermForm creates.
4. user happily updates form and changes permissions, because after all, their group has module administrator rights.

What seems to happen is this:
1, 2, and 3 happen okay, but for 4...
user clicks on the submit button in the group permission form and they are told they don't have permission to access that area! But they are a module administrator!!

Why this seems to be happening, I think, is that the user needs to be a member of a group that has *at least one* system admin right. It can be smilies, it doesn't have to be anything fancy like modules, or blocks, or groups. As long as they have any system admin right, then forms made by XoopsGroupPermForm can be updated by them.

But if they don't have any system administrator rights, then they can't update the form.

Please modify XoopsGroupPermForm so that users can complete forms it creates as long as they are module admins for the module the form is in.

Thanks a million, XOOPS is great!

--Julian

26
Anonymous
Re: Adding the group permission feature to your module
  • 2005/3/31 18:03

  • Anonymous

  • Posts: 0

  • Since:


Hi folks,

I'm a Xoops-newbie and had everything up and running pretty fast. Great!

Now there's just one thing bothering me: In the MyAdd-Module, would there be an easy way of switching the "add new ad"-link on and off, depending on the users group? For example: All Admins and Members of a new group "Ad-Publishers" can post ads, all others can not.

The line in the code where that link is printed, goes:

$xoopsTpl->assign('add_annonce'"<a href='addannonces.php?cid=$cid'>"._CLA_ADDANNONCE2."</a>");


Would there be a easy way of doing this? As XOOPS fits my needs perfectly otherwise, I maybe don't have to go to deep into the code. (And if I do hav to, where should I start?)

Thanks a million!

dushan

27
briforge
Re: Adding the group permission feature to your module
  • 2005/5/26 18:47

  • briforge

  • Just popping in

  • Posts: 14

  • Since: 2004/6/25


I'm a xoops-newbie and am a bit confused. I have the basics up and running. Now I've added a module (Mantis for bug tracking) and I would like to set up a group that has permission to this module. Is the instructions in the first post how I would do that? Where do I get those .php files he listed?

I'm running XOOPS 2.0.7.

28
Codyko
Re: Adding the group permission feature to your module
  • 2005/11/1 3:59

  • Codyko

  • Just popping in

  • Posts: 22

  • Since: 2005/8/5 7


Hi,

I am developing a clinic module which has the current basic functions:
1. Patient Profile
2. Medications
3. Appointment
4. Consulatation

Actions like add,remove, edit could be done on the these functional areas.For security reason, I want to apply group permissions to the module.

As stated in the first post, the "list of items that we will be setting permissions to" should be retrieved in DB.
However, in my case, I don't need permissions setting on individual record of each function type; For example, I want to control who can add/remove patients' profile but no control on individual profile.

So do i need to create an EXTRA table storing the function type ( ie func1 => "Patient Profile", func2 = "Medications") and then apply group permission just like what's stated in the first post?

Any idea is welcome! Thank You!

Cody

29
Codyko
Re: Adding the group permission feature to your module
  • 2005/11/4 3:26

  • Codyko

  • Just popping in

  • Posts: 22

  • Since: 2005/8/5 7


Hi!

>>>>>I am developing a clinic module which has the current basic functions:

I found the answers by myself that I should use a array to store the elements in $item_list since the functional areas of my clinic module is somewhat logical , containing no ids in database tables:

$item_list = array('1' => _AM_XCLINIC_ALLABOUTPATIENT,
'2' => _AM_XCLINIC_ALLABOUTMEDICINE,
'3' => _AM_XCLINIC_DIAGNOSIS_RECORDS,
'4' => _AM_XCLINIC_APPOINTMENTS
);

Thanks!

Regards
Cody

Login

Who's Online

189 user(s) are online (125 user(s) are browsing Support Forums)


Members: 0


Guests: 189


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits