Page 1 of 1

Need the change the security for the particular user like remove write or delete or read access

PostPosted:Wed Nov 30, 2022 11:35 am
by nishant8900
Hi,

I have tried the change the security like to remove read, write or delete access to the particular user.
and need to assign new role to the existing user.

I have tried this code:
Code: Select all
import java.util.*;
import com.openkm.bean.Permission;
import com.openkm.api.OKMAuth;

try {
    String nodePath = "6aaa9bc3-e0d2-4240-9c17-29769fecad0f";
    Map<String, Integer> grantUsers = new HashMap<>();
    Map<String, Integer> revokeUsers = new HashMap<>();
    Map<String, Integer> grantRoles = new HashMap<>();

    grantRoles.put("ROLE_USER", Permission.READ );	
    Map<String, Integer> revokeRoles = new HashMap<>();
    OKMAuth.getInstance().changeSecurity(null, nodePath, grantUsers, revokeUsers, grantRoles, revokeRoles, false);
} catch (Exception e) {
    print(e);
}
and i'm getting this kind of error:
bsh.ParseException: Parse error at line 7, column 24. Encountered: ,

kindly helps me to resolve this issue.

Thanks.

Re: Need the change the security for the particular user like remove write or delete or read access

PostPosted:Mon Dec 05, 2022 12:45 pm
by jllort
Beanshell does not allow generics in this version ( I suppose you are testing from there ).

Transform your code as:
Code: Select all
Map grantUsers = new HashMap();