• Disable an input form (property group element) for any user

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #40408  by intel74
 
hi all
i'm using 6.3 community, please can anyone help my!!!
Is there a way to have a property group element enabled only for some user and disabled for others users??
I define an automation rule so after uploading a file automatically the system add a property group and a windows appear with some fields to fill (invoice number, date, note, etc). I'll an input field was ReadOnly for some users so i define the automation rule with 2 action, in this way:
1) AddPropertyGroupToWizard, to add property and to show the form to fill
2) ExecuteScripting for make an input field readonly=false/true based on ROLE

I've no error but input field was always readonly=true...
Code: Select all
import com.openkm.api.OKMPropertyGroup;
import com.openkm.api.OKMRepository;
import java.util.*;
import com.openkm.dao.DatabaseMetadataDAO;
import com.openkm.api.OKMPropertyGroup;
import com.openkm.bean.form.FormElement;
import com.openkm.bean.form.Input;
import com.openkm.bean.form.Select;
import com.openkm.bean.form.Option;
import com.openkm.util.PathUtils;
import com.openkm.util.FileUtils;
import com.openkm.api.OKMDocument;
 
String grpName = "okg:protocollo";
String path = OKMRepository.getInstance().getNodePath(null,uuid);
 
for (FormElement formElement : OKMPropertyGroup.getInstance().getProperties(null, path, grpName)) {
    if (formElement.getName().equals("okp:protocollo.registro")) {
        ((Input) formElement).setReadonly(false);
    }    
}
please help me
thanks a lot
 #40422  by jllort
 
This kind of feature is present on professional edition but still not in community version. You should do some changes in source code for it ( not trivial ), because the idea is set security in form element to disallow access on some users or roles ( is a dtd change, and also source code to take this changes in consideration )
 #40475  by intel74
 
thank you for your reply jllort,
if I understand, using the community version, the only way to allow the modification of some metadata to a user and other data to a different user is to use differents forms in a workflow...it's right?
I've to define a workflow with many step and states so, for example:
User1 upload a document, start workflow, and fill a form inserting some data.
Then i can use this inserted data to modify metadata document (from code using a transaction).
At this point, wordkflow goes is in another state and User2 is enabled to fill another form that I can use to set others metatada (from code using another transaction)
is right this reasoning?
thank you in advance
 #40485  by jllort
 
Yes is a way for doing it. The solution to you problem is set property group as readonly ( really it will be readonly only from user interface but not internally and you can change without limitation from workflow but not from user interface).

Take a look at http://www.openkm.com/dtd/property-groups-2.5.dtd and see the readonly attribute:
Code: Select all
<!ATTLIST property-group
	label CDATA #REQUIRED
	name CDATA #REQUIRED
	visible (true | false) "true"
	readonly (true | false) "false"
>
You can set:
Code: Select all
<property-group label="Consulting" name="okg:consulting" readonly="true">
    <input label="Code" type="text" name="okp:consulting.code" />
    <textarea label="Comment" name="okp:consulting.comment" />
</property-group>

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.