Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Java)  1.26.2
AccessControl.java
Go to the documentation of this file.
1 // -----------------------------------------------------------------------
2 // MLPI - <AccessControl.java>
3 // -----------------------------------------------------------------------
4 // Copyright (c) 2012 Bosch Rexroth. All rights reserved.
5 // Redistribution and use in source and binary forms of this MLPI software
6 // (SW) provided to you, with or without modification, are permitted
7 // without prior approval provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code of SW must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form of SW must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // 3. User recognizes and acknowledges that it acquires no right,
17 // title or interest in or to any of the names or trademarks used in
18 // connection with the SW ("names") by virtue of this License and waives
19 // any right to or interest in the names. User recognizes and acknowledges
20 // that names of companies or names or products of companies displayed
21 // in the documentation of SW to indicate the interoperability of products
22 // with the SW are the names of their respective owners. The use of such
23 // names in the documentation of SW does not imply any sponsorship,
24 // approval, or endorsement by such companies of this product.
25 //
26 // 4. Modified code versions, i.e. any addition to or deletion from
27 // the substance or structure of the original code of the SW running
28 // the MLPI must be plainly marked as such and must not be misrepresented
29 // as being original SW.
30 //
31 // 5. The SW may only be used in connection with a Bosch Rexroth product.
32 //
33 // THIS INFORMATION IS PROVIDED BY BOSCH REXROTH CORPORATION "AS IS"
34 // AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING
35 // (BUT NOTLIMITED TO) ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
36 // FITNESS FOR ANY PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WHILE THE
37 // INFORMATION PROVIDED IS BELIEVED TO BE ACCURATE, IT MAY INCLUDE
38 // ERRORS OR INACCURACIES.
39 // SUBJECT TO COMPULSORY STATUTORY PROVISIONS OF THE GERMAN LAW AS
40 // THE APPLICABLE LAW FOR THIS LICENSE BOSCH REXROTH CORPORATION WILL
41 // NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM THE USE OF
42 // THE SOFTWARE DISTRIBUTED HEREUNDER, INCLUDING BUT NOT LIMITED TO
43 // DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, AND CONSEQUENTIAL DAMAGES.
44 // -----------------------------------------------------------------------
45 //
55 //
56 // -----------------------------------------------------------------------
57 package com.boschrexroth.mlpi;
58 
63 public class AccessControl extends MlpiComponent {
64  /*
65  * Constants
66  */
67  public static final int MLPI_MAX_USERNAME_LEN = 32;
68  public static final int MLPI_MAX_GROUPNAME_LEN = 32;
69  public static final int MLPI_MAX_INVALIDCHARS_LEN = 32;
70  public static final int MLPI_MAX_USER_DESCRIPTION_LEN = 128;
71  public static final int MLPI_MAX_GROUP_DESCRIPTION_LEN = 128;
72  public static final int MLPI_MAX_PERMISSION_LEN = 128;
73 
74  /*
75  * Enums
76  */
86  public static enum PersistenceType {
87  MLPI_USER_PERSISTENCE_TYPE_TEMPORARY (0),
88  MLPI_USER_PERSISTENCE_TYPE_PERMANENT (1);
89 
90  private int _code;
91  int getCode() { return _code; }
92  PersistenceType(int code) { this._code = code; }
93  static PersistenceType valueOf(int code) {
94  for (PersistenceType value : values()) {
95  if (code == value.getCode()) return value;
96  }
97  return null;
98  }
99  };
109  public static enum ExpirationTimeUnit {
110  MLPI_ACCESSCONTROL_EXPIRATION_UNIT_MINUTES (0),
111  MLPI_ACCESSCONTROL_EXPIRATION_DAYS (1);
112 
113  private int _code;
114  int getCode() { return _code; }
115  ExpirationTimeUnit(int code) { this._code = code; }
116  static ExpirationTimeUnit valueOf(int code) {
117  for (ExpirationTimeUnit value : values()) {
118  if (code == value.getCode()) return value;
119  }
120  return null;
121  }
122  };
123  /*
124  * Structs
125  */
126 
140  public static class UserInfo {
141  public long userId;
142  public String username;
143  public String description;
144  public PersistenceType persistenceType;
145  public boolean disabled;
146  }
147 
159  public static class ExpirationDetails {
160  public boolean enabled;
161  public long expirationTime;
162  public ExpirationTimeUnit expirationTimeUnit;
163  }
164 
181  public static class UserDetails {
182  public long userId;
183  public String username;
184  public String description;
185  public boolean disabled;
186  public boolean userExpirationEnabled;
187  public MlpiGlobal.DateAndTime userExpirationTime;
188  public ExpirationDetails sessionExpiration;
189  public PersistenceType persistenceType;
190  }
191 
192 
207  public static class PasswordPolicies {
208  public long minLength;
209  public long maxLength;
210  public long minUpperCase;
211  public long minLowerCase;
212  public long minNumerical;
213  public long minSpecial;
214  }
215 
230  public static class UserPolicies {
231  public long usernameMinLength;
232  public long usernameMaxLength;
233  public String usernameInvalidChars;
234  public long descriptionMinLength;
235  public long descriptionMaxLength;
236  public ExpirationDetails sessionExpirationSettings;
237  }
238 
251  public static class GroupInfo {
252  public long groupId;
253  public String groupName;
254  public String description;
255  public boolean disabled;
256  }
257 
271  public static class GroupPolicies {
272  public long groupNameMinLength;
273  public long groupNameMaxLength;
274  public String groupNameInvalidChars;
275  public long descriptionMinLength;
276  public long descriptionMaxLength;
277  }
278 
291  public static class GroupDetails {
292  public long groupId;
293  public String groupName;
294  public String description;
295  public boolean disabled;
296  }
297 
298  /*
299  * Methods
300  */
301 
305  AccessControl(MlpiHandle connection) {
306  super(connection);
307  }
308 
315  public native UserPolicies getUserPolicies();
316 
320  @Deprecated
322  return getUserPolicies();
323  }
324 
331  public native PasswordPolicies getPasswordPolicies();
332 
336  @Deprecated
338  return getPasswordPolicies();
339  }
340 
347  public native UserInfo[] getAllUserInfos();
348 
352  @Deprecated
354  return getAllUserInfos();
355  }
356 
364  public native void addUser(UserDetails userDetails, String tmpPassword);
365 
369  @Deprecated
370  public void AddUser(UserDetails userDetails, String tmpPassword) {
371  addUser(userDetails, tmpPassword);
372  }
373 
381  public native UserDetails getUser(String username);
382 
386  @Deprecated
387  public UserDetails GetUser(String username) {
388  return getUser(username);
389  }
390 
397  public native void setUser(UserDetails userDetails);
398 
402  @Deprecated
403  public void SetUser(UserDetails userDetails) {
404  setUser(userDetails);
405  }
406 
413  public native void deleteUser(String username);
414 
418  @Deprecated
419  public void DeleteUser(String username) {
420  deleteUser(username);
421  }
422 
431  public native void changePassword(String username, String oldPassword, String newPassword);
432 
436  @Deprecated
437  public void ChangePassword(String username, String oldPassword, String newPassword) {
438  changePassword(username, oldPassword, newPassword);
439  }
440 
447  public native GroupInfo[] getAllGroupInfos();
448 
452  @Deprecated
454  return getAllGroupInfos();
455  }
456 
464  public native String[] getAllGroupsOfUser(String username);
465 
469  @Deprecated
470  public String[] GetAllGroupsOfUser(String username) {
471  return getAllGroupsOfUser(username);
472  }
473 
481  public native String[] getAllUsersOfGroup(String groupName);
482 
486  @Deprecated
487  public String[] GetAllUsersOfGroup(String groupName) {
488  return getAllUsersOfGroup(groupName);
489  }
490 
498  public native void addUserToGroup(String groupName, String username);
499 
503  @Deprecated
504  public void AddUserToGroup(String groupName, String username) {
505  addUserToGroup(groupName, username);
506  }
507 
515  public native void removeUserFromGroup(String groupName, String username);
516 
520  @Deprecated
521  public void RemoveUserFromGroup(String groupName, String username) {
522  removeUserFromGroup(groupName, username);
523  }
524 
532  public native void setUsersOfGroup(String groupName, String[] usernames);
533 
537  @Deprecated
538  public void SetUsersOfGroup(String groupName, String[] usernames) {
539  setUsersOfGroup(groupName, usernames);
540  }
541 
549  public native void setGroupsOfUser(String username, String[] groupNames);
550 
554  @Deprecated
555  public void SetGroupsOfUser(String username, String[] groupNames) {
556  setGroupsOfUser(username, groupNames);
557  }
558 
565  public native GroupPolicies getGroupPolicies();
566 
570  @Deprecated
572  return getGroupPolicies();
573  }
574 
582  public native void resetPassword(String username, String newPassword);
583 
587  @Deprecated
588  public void ResetPassword(String username, String newPassword) {
589  resetPassword(username, newPassword);
590  }
591 
598  public native void addGroup(GroupDetails groupDetails);
599 
603  @Deprecated
604  public void AddGroup(GroupDetails groupDetails) {
605  addGroup(groupDetails);
606  }
607 
615  public native GroupDetails getGroup(String groupName);
616 
620  @Deprecated
621  public GroupDetails GetGroup(String groupName) {
622  return getGroup(groupName);
623  }
624 
631  public native void setGroup(GroupDetails groupDetails);
632 
636  @Deprecated
637  public void SetGroup(GroupDetails groupDetails) {
638  setGroup(groupDetails);
639  }
640 
647  public native void deleteGroup(String groupName);
648 
652  @Deprecated
653  public void DeleteGroup(String groupName) {
654  deleteGroup(groupName);
655  }
656 
663  public native String[] getAllPermissions();
664 
668  @Deprecated
669  public String[] GetAllPermissions() {
670  return getAllPermissions();
671  }
672 
680  public native void setPermissionsOfGroup(String groupName, String[] permissions);
681 
685  @Deprecated
686  public void SetPermissionsOfGroup(String groupName, String[] permissions) {
687  setPermissionsOfGroup(groupName, permissions);
688  }
689 
697  public native String[] getAllPermissionsOfGroup(String groupName);
698 
702  @Deprecated
703  public String[] GetAllPermissionsOfGroup(String groupName) {
704  return getAllPermissionsOfGroup(groupName);
705  }
706 
714  public native void setAuthorizedGroupsOfPermission(String permission, String[] groupNames);
715 
719  @Deprecated
720  public void SetAuthorizedGroupsOfPermission(String permission, String[] groupNames) {
721  setAuthorizedGroupsOfPermission(permission, groupNames);
722  }
723 
731  public native String[] getAllAuthorizedGroupsOfPermission(String permission);
732 
736  @Deprecated
737  public String[] GetAllAuthorizedGroupsOfPermission(String permission) {
738  return getAllAuthorizedGroupsOfPermission(permission);
739  }
740 
748  public native void addPermissionToGroup(String groupName, String permission);
749 
753  @Deprecated
754  public void AddPermissionToGroup(String groupName, String permission) {
755  addPermissionToGroup(groupName, permission);
756  }
757 
765  public native void removePermissionFromGroup(String groupName, String permission);
766 
770  @Deprecated
771  public void RemovePermissionFromGroup(String groupName, String permission) {
772  removePermissionFromGroup(groupName, permission);
773  }
774 
775 }
native void setGroup(GroupDetails groupDetails)
Empty class definition which defines global structures/classes.
Definition: MlpiGlobal.java:65
String[] GetAllUsersOfGroup(String groupName)
native void deleteGroup(String groupName)
void SetGroup(GroupDetails groupDetails)
void AddUser(UserDetails userDetails, String tmpPassword)
native GroupInfo[] getAllGroupInfos()
String[] GetAllGroupsOfUser(String username)
void ChangePassword(String username, String oldPassword, String newPassword)
native String[] getAllUsersOfGroup(String groupName)
native String[] getAllGroupsOfUser(String username)
void SetGroupsOfUser(String username, String[] groupNames)
This class is used to provide all basic information about a specific group.
native UserDetails getUser(String username)
native String[] getAllAuthorizedGroupsOfPermission(String permission)
Class definition of the AccessControlLib.
native GroupPolicies getGroupPolicies()
String[] GetAllPermissionsOfGroup(String groupName)
native void removePermissionFromGroup(String groupName, String permission)
native void resetPassword(String username, String newPassword)
GroupDetails GetGroup(String groupName)
String[] GetAllAuthorizedGroupsOfPermission(String permission)
native void addGroup(GroupDetails groupDetails)
This class is used to provide all basic information about a specific user.
void AddUserToGroup(String groupName, String username)
void SetUsersOfGroup(String groupName, String[] usernames)
This class is used to provide the policies to be applied to all users.
void AddPermissionToGroup(String groupName, String permission)
void SetPermissionsOfGroup(String groupName, String[] permissions)
void AddGroup(GroupDetails groupDetails)
This enumeration describes the possible units that the expiration time can have (i.e. days or minutes).
This enumeration describes the possible persistence type of a user.
void RemoveUserFromGroup(String groupName, String username)
void DeleteGroup(String groupName)
native void setUser(UserDetails userDetails)
void SetUser(UserDetails userDetails)
native void setAuthorizedGroupsOfPermission(String permission, String[] groupNames)
native void setUsersOfGroup(String groupName, String[] usernames)
native UserInfo[] getAllUserInfos()
This class defines information about the date and time.
void RemovePermissionFromGroup(String groupName, String permission)
This class is used to provide detailed information about a specific user.
UserDetails GetUser(String username)
native GroupDetails getGroup(String groupName)
This class is used to provide detailed information about the expiration settings applied to sessions ...
native void addUser(UserDetails userDetails, String tmpPassword)
native String[] getAllPermissionsOfGroup(String groupName)
native void setGroupsOfUser(String username, String[] groupNames)
native void addUserToGroup(String groupName, String username)
This class is used to provide the policies to be followed to define the user passwords.
native void setPermissionsOfGroup(String groupName, String[] permissions)
native void deleteUser(String username)
native void removeUserFromGroup(String groupName, String username)
native void addPermissionToGroup(String groupName, String permission)
native void changePassword(String username, String oldPassword, String newPassword)
native PasswordPolicies getPasswordPolicies()
native UserPolicies getUserPolicies()
void ResetPassword(String username, String newPassword)
This class is used to provide detailed information about a specific group.
This class is used to provide the policies to be applied to all groups.
void SetAuthorizedGroupsOfPermission(String permission, String[] groupNames)