jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => General => Topic started by: carin on 03.08.2014 00:23:42

Title: How to set default Access Level for front end uploads?
Post by: carin on 03.08.2014 00:23:42
I dont want to let the uploader choose the ACL, hence I hide the Access field in the upload form. Therefore I need to set a default Access to all uploads.

Thanks.
Title: Re: How to set default Access Level for front end uploads?
Post by: ColinM on 03.08.2014 10:12:27
Carin
Good idea.  I have been requesting that Access Levels propagate from parent category to child category, and from category to download.  Think this will be done.  Propagating Access Levels is more important than propagating Permissions.

See article http://www.jdownloads.net/documentations/item/controlled-access-to-categories-and-downloads about using access levels

Colin
Title: Re: How to set default Access Level for front end uploads?
Post by: carin on 14.01.2015 00:26:45
Any progress on setting a default value for the access level?
Title: Re: How to set default Access Level for front end uploads?
Post by: ColinM on 14.01.2015 01:44:16
Carin
There is a way to set all access levels to a particular type.
See http://www.jdownloads.net/documentations/item/rapidly-setting-view-access-levels-of-multiple-categories-and-downloads

Also if a user does not change the Access field then the access level will be set to the level of the Parent Category.  I assume you have modified the code to prevent the Access field being shown.  If you revisit the code it should be possible to modify it to make the field unchangeable.  Then jDownloads should automatically set it.

If you let me know where you changed the code I will see what I can do (Arno is concentrating on bug fixing).

Thanks

Colin
Title: Re: How to set default Access Level for front end uploads?
Post by: carin on 23.01.2015 23:09:16
Thanks!

The batch process does not solve the problem becasue I cannot do that every time a user uploads something which is every 5 minutes.

"access level will be set to the level of the Parent Category"
==> that does not help because these two need to be different in my site setup

I really need to be able to set a default Access to all uploads.
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 24.01.2015 01:06:07
QuoteI really need to be able to set a default Access to all uploads.
In this case should we add a new option.
Maybe can we add it for the moment as hidden option? It is current not a good moment to add again some text in the language files.
But we can easy add the required field in the database. So you could create the default value via phpmyadmin. Could you life with this a few weeks?  ;)

Falls du in den letzten Stunden auf die Version 3.2.24 upgedatet hast, bitte noch einmal neu downloaden und installieren. Mir war leider ein schwerwiegender Tippfehler unterlaufen.  :-\
Title: Re: How to set default Access Level for front end uploads?
Post by: carin on 24.01.2015 01:23:20
QuoteSo you could create the default value via phpmyadmin
Yes. Would work for me.

Danke für den 3.2.24 Hinweis.
Title: Re: How to set default Access Level for front end uploads?
Post by: ColinM on 24.01.2015 04:31:58
@Arno
Do you see this as just having a default access set in Config or set per user group?  Logic could be say something like below

If (Access Level Field in input form is NOT blank) then use
ElseIf ((Access field not blank in current highest ranking user group setting) AND (is valid access level)) then use
ElseIf ((Access field not blank in Config setting) AND (is valid access level)) then use
Else use Parent Access.

Could be accompanied by a switch which said to show/not show access field in create upload form.

Just a thought
Colin
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 25.01.2015 13:41:56
Quote from: ColinM on 24.01.2015 04:31:58
@Arno
Do you see this as just having a default access set in Config or set per user group?  Logic could be say something like below

If (Access Level Field in input form is NOT blank) then use
ElseIf ((Access field not blank in current highest ranking user group setting) AND (is valid access level)) then use
ElseIf ((Access field not blank in Config setting) AND (is valid access level)) then use
Else use Parent Access.
Thanks for the input. You have right. To add here an extra option in the user groups settings seems to be the best solution.  ;)
Title: Re: How to set default Access Level for front end uploads?
Post by: carin on 02.02.2015 23:11:19
QuoteBut we can easy add the required field in the database. So you could create the default value via phpmyadmin.
Is that implemented in 3.2.24? Which column would I need to set for the default value? thx
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 03.02.2015 13:39:46
Hi carin,
the new data field will be exist in jD 3.2.25 (comes very soon).

[gelöscht durch Administrator]
Title: Re: How to set default Access Level for front end uploads?
Post by: carin on 03.02.2015 14:17:25
great, thanks
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 04.02.2015 11:13:50
Hi carin,
i have seen now that it is always use the 'access' from the parent category for a new 'Download'.
So it is not really required to use a special 'default' setting. Only when a 'Download' has not a parent category is this useful. 
Use you 'uncategorized' files?
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 04.02.2015 11:46:29
I will use it now in this way (and order):
When a new download is created in frontend:
1. is the 'access' value selectable in frontend form - he is used
2. is the 'access' value not selectable it is use the new default 'access' value
3. has the new download a parent category - the access from the parent category is used

Is this okay for you?
Title: Re: How to set default Access Level for front end uploads?
Post by: ColinM on 04.02.2015 22:40:22
@Arno
I interpret the above as
if ('access' value selectable in frontend form AND is not "empty") then use value given value
else if ('access' value not selectable in frontend form) then use the new default 'access' value
  else the 'access' from the parent category

That is the Access selection pulldown in the upload form is not pre loaded with an access level but has as its first entry say either '-Select Access Level-'  or perhaps better '-Use Parent Access Level-'  as the first option so my "empty" above really means "Not first Option".

The description could be "Will use the Parent Category View Access Level (recommended) or you can select another one from the pull down list. "Access Level"

Colin
 
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 05.02.2015 00:19:55
QuoteI interpret the above as
if ('access' value selectable in frontend form AND is not "empty") then use value given value
else if ('access' value not selectable in frontend form) then use the new default 'access' value
  else the 'access' from the parent category

Not exactly. The access value has always a value (at minimum 1 for public access level).

See code:

...
         // check the access handling
         if ($user_rules->form_access == 0){
                // the access select field was not viewed so we use the default value for the case that we have not a parent category
                $this->access = (int)$user_rules->uploads_default_access_level;
         }
...
        if ($this->cat_id > 1){
            if ($isNew){
                // set access level value from parent
                $query = "SELECT * FROM #__jdownloads_categories WHERE id = '$this->cat_id'";
                $db->setQuery( $query );
                $parent_cat = $db->loadObject();
                $this->access = $parent_cat->access;
            }
        }
...   
Title: Re: How to set default Access Level for front end uploads?
Post by: tollyorg on 05.02.2015 01:01:10
this is great sir .. thanks :)  ;D
Title: Re: How to set default Access Level for front end uploads?
Post by: carin on 05.02.2015 01:03:14
Quote1. is the 'access' value selectable in frontend form - he is used
2. is the 'access' value not selectable it is use the new default 'access' value
3. has the new download a parent category - the access from the parent category is used

1. if the new default 'access' value is set, the field in the frontend form should hold that value on page load
2. agreed
3. but only if the new default 'access' value is NOT set! this is very important, because my parent categories have a different access level than the download files
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 05.02.2015 01:17:57
Quotebecause my parent categories have a different access level than the download files
I have thought about this already.  ;D
Title: Re: How to set default Access Level for front end uploads?
Post by: ColinM on 05.02.2015 13:56:00
@Arno
The word "empty" was deliberate.  I was seeing this from a user view in that all they see is the option shown initially in the Pull Down list.  Whilst I note what Carin suggests that the special Default, if set, should be shown as the top entry of the pulldown, I am thinking of how to explain things to a user.  Seeing the first option wording as being something like '-Use Parent Access Level-', suitably translated of course, defines the normal way for most people.  From your algorithm the new special default value is only used when the Access field is not shown.  In all other circumstances either the user positively selects an Access level from the pulldown or would leave it as the first entry.  The user does not need to know either the Parent Access level or the Special Default but there is no harm in including it and the special default value at the bottom of the pull down list.

Actually it may be better to refer to the special default value by something like 'user group settings default' as that also indicates where it is set up.

Just some thoughts

Colin
Title: Re: How to set default Access Level for front end uploads?
Post by: hiro201 on 06.02.2015 08:11:12
I have an issue with this too. Thanks for bringing this up.
Title: Re: How to set default Access Level for front end uploads?
Post by: Arno on 06.02.2015 13:51:39
Hi Guys,
It seems that it is not so easy to implement this new option (which has in the first moment a simple functionality).

Thanks Colin for your thoughts. I agree with you. But we can not create in this moment a new (special) Pull Down list for the access levels with more options (-Use Parent Access Level-).
So it is now only possible to define the new default value directly in the DB. But i want to change it in the next release 3.3.

I have it now in this way implemented:

The new default field value in the DB is now '0' as default (0=not set)

In the form:
the handling is now the same for both scenarios (access select list is viewed or not viewed):
   - if the new default 'access' value is set (>0), the field in the frontend form hold that value on page load
   - if the new default value not set, the access default value is 1 for public access (standard handling in Joomla)
   save process:
   - if the access level now > 1 we store this in the DB, otherwise we use the access level from parent category.
   (Please note that it is not so easy possible to check whether a level from '1' is really selected by the user, or is still the default setting)

My first tests was succesfully. But i think we must test again also the 'normal' Downloads save processes in backend. As we used the same source code also here.