mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
This commit is contained in:
commit
682b5f81e0
@ -30,379 +30,385 @@
|
||||
<PermissionConfiguration>
|
||||
<APIVersion></APIVersion>
|
||||
<!--Permission Tree Name-->
|
||||
<Permission>
|
||||
<name>Device Management</name>
|
||||
<path>/device-mgt</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Admin Permissions -->
|
||||
<Permission>
|
||||
<name>Device Management Admin</name>
|
||||
<path>/device-mgt/admin</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Devices</name>
|
||||
<path>/device-mgt/admin/devices</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Device related APIs -->
|
||||
<Permission>
|
||||
<name>List devices</name>
|
||||
<path>/device-mgt/admin/devices/List</path>
|
||||
<url>/devices</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Search devices</name>
|
||||
<path>/device-mgt/admin/devices/Search</path>
|
||||
<url>/devices/search-devices</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device</name>
|
||||
<path>/device-mgt/admin/devices/View</path>
|
||||
<url>/devices/*/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device applications</name>
|
||||
<path>/device-mgt/admin/devices/View-Applications</path>
|
||||
<url>/devices/*/*/applications</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device effective-policy</name>
|
||||
<path>/device-mgt/admin/devices/View-Active-Policy</path>
|
||||
<url>/devices/*/*/effective-policy</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View devices feature</name>
|
||||
<path>/device-mgt/admin/devices/View-Features</path>
|
||||
<url>/devices/*/*/features</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device operations</name>
|
||||
<path>/device-mgt/admin/devices/View-Operations</path>
|
||||
<url>/devices/*/*/operations</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View Compliance Data</name>
|
||||
<path>/device-mgt/admin/devices/View-Compliance-Data</path>
|
||||
<url>/devices/*/*/compliance-data</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>List all devices</name>
|
||||
<path>/device-mgt/admin/devices/Admin-View</path>
|
||||
<url>/admin/devices</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device types</name>
|
||||
<path>/device-mgt/admin/devices/Admin-DeviceType-View</path>
|
||||
<url>/admin/device-types</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of Device related APIs -->
|
||||
<Permission>
|
||||
<name>Policies</name>
|
||||
<path>/device-mgt/admin/policies</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Policy related APIs -->
|
||||
<Permission>
|
||||
<name>List policies</name>
|
||||
<path>/device-mgt/admin/policies/List</path>
|
||||
<url>/policies</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add Policy</name>
|
||||
<path>/device-mgt/admin/policies/Add</path>
|
||||
<url>/policies</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Activate policy</name>
|
||||
<path>/device-mgt/admin/policies/Activate-Policy</path>
|
||||
<url>/policies/activate-policy</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Deactivate Policy</name>
|
||||
<path>/device-mgt/admin/policies/Deactivate-Policy</path>
|
||||
<url>/policies/deactivate-policy</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove Policy</name>
|
||||
<path>/device-mgt/admin/policies/Remove</path>
|
||||
<url>/policies/remove-policy</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View Policy</name>
|
||||
<path>/device-mgt/admin/policies/View</path>
|
||||
<url>/policies/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update Policy</name>
|
||||
<path>/device-mgt/admin/policies/Update</path>
|
||||
<url>/policies/*</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update Policy</name>
|
||||
<path>/device-mgt/admin/policies/Update</path>
|
||||
<url>/policies/apply-changes</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update Policy</name>
|
||||
<path>/device-mgt/admin/policies/Change-Priority</path>
|
||||
<url>/policies/priorities</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Policy related APIs -->
|
||||
<Permission>
|
||||
<name>Notifications</name>
|
||||
<path>/device-mgt/admin/notifications</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Notification related APIs -->
|
||||
<Permission>
|
||||
<name>View notifications</name>
|
||||
<path>/device-mgt/admin/notifications/View</path>
|
||||
<url>/notifications</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Mark checked notifications</name>
|
||||
<path>/device-mgt/admin/notifications/View</path>
|
||||
<url>/notifications/*/mark-checked</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Notification related APIs -->
|
||||
<Permission>
|
||||
<name>Users</name>
|
||||
<path>/device-mgt/admin/users</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- User related APIs -->
|
||||
<Permission>
|
||||
<name>List users</name>
|
||||
<path>/device-mgt/admin/users/List</path>
|
||||
<url>/users</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add user</name>
|
||||
<path>/device-mgt/admin/users/Add</path>
|
||||
<url>/users</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>List users</name>
|
||||
<path>/device-mgt/admin/users/Search</path>
|
||||
<url>/users/search/usernames</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove user</name>
|
||||
<path>/device-mgt/admin/users/Remove</path>
|
||||
<url>/users/*</url>
|
||||
<method>DELETE</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View user</name>
|
||||
<path>/device-mgt/admin/users/View</path>
|
||||
<url>/users/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update user</name>
|
||||
<path>/device-mgt/admin/users/Update</path>
|
||||
<url>/users/*</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update user credentials</name>
|
||||
<path>/device-mgt/admin/users/Change-Password</path>
|
||||
<url>/users/*/credentials</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View assigned role</name>
|
||||
<path>/device-mgt/admin/roles/Assigned-Roles</path>
|
||||
<url>/users/*/roles</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Change any user credentials</name>
|
||||
<path>/device-mgt/admin/users/Change-Password-Any</path>
|
||||
<url>/admin/users/*/credentials</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Send invitation mail</name>
|
||||
<path>/device-mgt/admin/users/Send-invitations</path>
|
||||
<url>/users/send-invitation</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<!-- End of User related APIs -->
|
||||
<Permission>
|
||||
<name>Roles</name>
|
||||
<path>/device-mgt/admin/roles</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Role related APIs -->
|
||||
<Permission>
|
||||
<name>List roles</name>
|
||||
<path>/device-mgt/admin/roles/List</path>
|
||||
<url>/roles</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add role</name>
|
||||
<path>/device-mgt/admin/roles/Add</path>
|
||||
<url>/roles</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove role</name>
|
||||
<path>/device-mgt/admin/roles/Remove</path>
|
||||
<url>/roles/*</url>
|
||||
<method>DELETE</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View role</name>
|
||||
<path>/device-mgt/admin/roles/View</path>
|
||||
<url>/roles/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update role</name>
|
||||
<path>/device-mgt/admin/roles/Update</path>
|
||||
<url>/roles/*</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View role permissions</name>
|
||||
<path>/device-mgt/admin/roles/View-Permission</path>
|
||||
<url>/roles/*/permissions</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add Users to role</name>
|
||||
<path>/device-mgt/admin/roles/Add-Users</path>
|
||||
<url>/roles/*/users</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Role related APIs -->
|
||||
<Permission>
|
||||
<name>Configurations</name>
|
||||
<path>/device-mgt/admin/general-configs</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Configuration related APIs -->
|
||||
<Permission>
|
||||
<name>View configuration</name>
|
||||
<path>/device-mgt/admin/general-configuration/View</path>
|
||||
<url>/configuration</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update configuration</name>
|
||||
<path>/device-mgt/admin/general-configuration/Update</path>
|
||||
<url>/configuration</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Configuration related APIs -->
|
||||
<Permission>
|
||||
<name>Activities</name>
|
||||
<path>/device-mgt/admin/activities</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Activity related APIs -->
|
||||
<Permission>
|
||||
<name>View Activities</name>
|
||||
<path>/device-mgt/admin/activities/View</path>
|
||||
<url>/activities</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View Activity Details</name>
|
||||
<path>/device-mgt/admin/activities/View</path>
|
||||
<url>/activities/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of Activity related APIs -->
|
||||
<Permission>
|
||||
<name>Applications</name>
|
||||
<path>/device-mgt/admin/applications</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Application related APIs -->
|
||||
<Permission>
|
||||
<name>Install Applications</name>
|
||||
<path>/device-mgt/admin/application/Install</path>
|
||||
<url>/admin/applications/install-application</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Uninstall-Applications</name>
|
||||
<path>/device-mgt/admin/application/Uninstall</path>
|
||||
<url>/admin/applications/uninstall-application</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<!-- End of Application related APIs -->
|
||||
<!-- End of Admin Permissions -->
|
||||
<!-- User Permissions -->
|
||||
<Permission>
|
||||
<name>Device Management User</name>
|
||||
<path>/device-mgt/user</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Devices</name>
|
||||
<path>/device-mgt/user/devices</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Policies</name>
|
||||
<path>/device-mgt/user/policies</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Notifications</name>
|
||||
<path>/device-mgt/user/notifications</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Operations</name>
|
||||
<path>/device-mgt/user/operations</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of User Permissions -->
|
||||
<Permission>
|
||||
<name>Device Management</name>
|
||||
<path>/device-mgt</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Admin Permissions -->
|
||||
<Permission>
|
||||
<name>Device Management Admin</name>
|
||||
<path>/device-mgt/admin</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Devices</name>
|
||||
<path>/device-mgt/admin/devices</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Device related APIs -->
|
||||
<Permission>
|
||||
<name>List devices</name>
|
||||
<path>/device-mgt/admin/devices/List</path>
|
||||
<url>/devices</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Search devices</name>
|
||||
<path>/device-mgt/admin/devices/Search</path>
|
||||
<url>/devices/search-devices</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device</name>
|
||||
<path>/device-mgt/admin/devices/View</path>
|
||||
<url>/devices/*/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device info</name>
|
||||
<path>/device-mgt/admin/devices/View</path>
|
||||
<url>/devices/*/*/info</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device applications</name>
|
||||
<path>/device-mgt/admin/devices/View-Applications</path>
|
||||
<url>/devices/*/*/applications</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device effective-policy</name>
|
||||
<path>/device-mgt/admin/devices/View-Active-Policy</path>
|
||||
<url>/devices/*/*/effective-policy</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View devices feature</name>
|
||||
<path>/device-mgt/admin/devices/View-Features</path>
|
||||
<url>/devices/*/*/features</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device operations</name>
|
||||
<path>/device-mgt/admin/devices/View-Operations</path>
|
||||
<url>/devices/*/*/operations</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View Compliance Data</name>
|
||||
<path>/device-mgt/admin/devices/View-Compliance-Data</path>
|
||||
<url>/devices/*/*/compliance-data</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>List all devices</name>
|
||||
<path>/device-mgt/admin/devices/Admin-View</path>
|
||||
<url>/admin/devices</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View device types</name>
|
||||
<path>/device-mgt/admin/devices/Admin-DeviceType-View</path>
|
||||
<url>/admin/device-types</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of Device related APIs -->
|
||||
<Permission>
|
||||
<name>Policies</name>
|
||||
<path>/device-mgt/admin/policies</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Policy related APIs -->
|
||||
<Permission>
|
||||
<name>List policies</name>
|
||||
<path>/device-mgt/admin/policies/List</path>
|
||||
<url>/policies</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add Policy</name>
|
||||
<path>/device-mgt/admin/policies/Add</path>
|
||||
<url>/policies</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Activate policy</name>
|
||||
<path>/device-mgt/admin/policies/Activate-Policy</path>
|
||||
<url>/policies/activate-policy</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Deactivate Policy</name>
|
||||
<path>/device-mgt/admin/policies/Deactivate-Policy</path>
|
||||
<url>/policies/deactivate-policy</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove Policy</name>
|
||||
<path>/device-mgt/admin/policies/Remove</path>
|
||||
<url>/policies/remove-policy</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View Policy</name>
|
||||
<path>/device-mgt/admin/policies/View</path>
|
||||
<url>/policies/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update Policy</name>
|
||||
<path>/device-mgt/admin/policies/Update</path>
|
||||
<url>/policies/*</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update Policy</name>
|
||||
<path>/device-mgt/admin/policies/Update</path>
|
||||
<url>/policies/apply-changes</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update Policy</name>
|
||||
<path>/device-mgt/admin/policies/Change-Priority</path>
|
||||
<url>/policies/priorities</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Policy related APIs -->
|
||||
<Permission>
|
||||
<name>Notifications</name>
|
||||
<path>/device-mgt/admin/notifications</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Notification related APIs -->
|
||||
<Permission>
|
||||
<name>View notifications</name>
|
||||
<path>/device-mgt/admin/notifications/View</path>
|
||||
<url>/notifications</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Mark checked notifications</name>
|
||||
<path>/device-mgt/admin/notifications/View</path>
|
||||
<url>/notifications/*/mark-checked</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Notification related APIs -->
|
||||
<Permission>
|
||||
<name>Users</name>
|
||||
<path>/device-mgt/admin/users</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- User related APIs -->
|
||||
<Permission>
|
||||
<name>List users</name>
|
||||
<path>/device-mgt/admin/users/List</path>
|
||||
<url>/users</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add user</name>
|
||||
<path>/device-mgt/admin/users/Add</path>
|
||||
<url>/users</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>List users</name>
|
||||
<path>/device-mgt/admin/users/Search</path>
|
||||
<url>/users/search/usernames</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove user</name>
|
||||
<path>/device-mgt/admin/users/Remove</path>
|
||||
<url>/users/*</url>
|
||||
<method>DELETE</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View user</name>
|
||||
<path>/device-mgt/admin/users/View</path>
|
||||
<url>/users/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update user</name>
|
||||
<path>/device-mgt/admin/users/Update</path>
|
||||
<url>/users/*</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update user credentials</name>
|
||||
<path>/device-mgt/admin/users/Change-Password</path>
|
||||
<url>/users/*/credentials</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View assigned role</name>
|
||||
<path>/device-mgt/admin/roles/Assigned-Roles</path>
|
||||
<url>/users/*/roles</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Change any user credentials</name>
|
||||
<path>/device-mgt/admin/users/Change-Password-Any</path>
|
||||
<url>/admin/users/*/credentials</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Send invitation mail</name>
|
||||
<path>/device-mgt/admin/users/Send-invitations</path>
|
||||
<url>/users/send-invitation</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<!-- End of User related APIs -->
|
||||
<Permission>
|
||||
<name>Roles</name>
|
||||
<path>/device-mgt/admin/roles</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Role related APIs -->
|
||||
<Permission>
|
||||
<name>List roles</name>
|
||||
<path>/device-mgt/admin/roles/List</path>
|
||||
<url>/roles</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add role</name>
|
||||
<path>/device-mgt/admin/roles/Add</path>
|
||||
<url>/roles</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove role</name>
|
||||
<path>/device-mgt/admin/roles/Remove</path>
|
||||
<url>/roles/*</url>
|
||||
<method>DELETE</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View role</name>
|
||||
<path>/device-mgt/admin/roles/View</path>
|
||||
<url>/roles/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update role</name>
|
||||
<path>/device-mgt/admin/roles/Update</path>
|
||||
<url>/roles/*</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View role permissions</name>
|
||||
<path>/device-mgt/admin/roles/View-Permission</path>
|
||||
<url>/roles/*/permissions</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Add Users to role</name>
|
||||
<path>/device-mgt/admin/roles/Add-Users</path>
|
||||
<url>/roles/*/users</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Role related APIs -->
|
||||
<Permission>
|
||||
<name>Configurations</name>
|
||||
<path>/device-mgt/admin/general-configs</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Configuration related APIs -->
|
||||
<Permission>
|
||||
<name>View configuration</name>
|
||||
<path>/device-mgt/admin/general-configuration/View</path>
|
||||
<url>/configuration</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Update configuration</name>
|
||||
<path>/device-mgt/admin/general-configuration/Update</path>
|
||||
<url>/configuration</url>
|
||||
<method>PUT</method>
|
||||
</Permission>
|
||||
<!-- End of Configuration related APIs -->
|
||||
<Permission>
|
||||
<name>Activities</name>
|
||||
<path>/device-mgt/admin/activities</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Activity related APIs -->
|
||||
<Permission>
|
||||
<name>View Activities</name>
|
||||
<path>/device-mgt/admin/activities/View</path>
|
||||
<url>/activities</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>View Activity Details</name>
|
||||
<path>/device-mgt/admin/activities/View</path>
|
||||
<url>/activities/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of Activity related APIs -->
|
||||
<Permission>
|
||||
<name>Applications</name>
|
||||
<path>/device-mgt/admin/applications</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- Application related APIs -->
|
||||
<Permission>
|
||||
<name>Install Applications</name>
|
||||
<path>/device-mgt/admin/application/Install</path>
|
||||
<url>/admin/applications/install-application</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Uninstall-Applications</name>
|
||||
<path>/device-mgt/admin/application/Uninstall</path>
|
||||
<url>/admin/applications/uninstall-application</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<!-- End of Application related APIs -->
|
||||
<!-- End of Admin Permissions -->
|
||||
<!-- User Permissions -->
|
||||
<Permission>
|
||||
<name>Device Management User</name>
|
||||
<path>/device-mgt/user</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Devices</name>
|
||||
<path>/device-mgt/user/devices</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Policies</name>
|
||||
<path>/device-mgt/user/policies</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Notifications</name>
|
||||
<path>/device-mgt/user/notifications</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>User Operations</name>
|
||||
<path>/device-mgt/user/operations</path>
|
||||
<url>/</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of User Permissions -->
|
||||
<!--End of Permission Tree-->
|
||||
</PermissionConfiguration>
|
||||
|
||||
@ -20,11 +20,13 @@ package org.wso2.carbon.device.mgt.core.notification.mgt.dao;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
||||
import org.wso2.carbon.device.mgt.common.IllegalTransactionStateException;
|
||||
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.UnsupportedDatabaseEngineException;
|
||||
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
|
||||
import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl.NotificationDAOImpl;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl.*;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@ -39,21 +41,48 @@ import java.util.List;
|
||||
public class NotificationManagementDAOFactory {
|
||||
|
||||
private static DataSource dataSource;
|
||||
private static String databaseEngine;
|
||||
private static final Log log = LogFactory.getLog(NotificationManagementDAOFactory.class);
|
||||
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
|
||||
|
||||
public static NotificationDAO getNotificationDAO() {
|
||||
return new NotificationDAOImpl();
|
||||
if (databaseEngine != null) {
|
||||
switch (databaseEngine) {
|
||||
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_ORACLE:
|
||||
return new OracleNotificationDAOImpl();
|
||||
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MSSQL:
|
||||
return new SQLServerNotificationDAOImpl();
|
||||
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
||||
return new PostgreSQLNotificationDAOImpl();
|
||||
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_H2:
|
||||
case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MYSQL:
|
||||
return new GenericNotificationDAOImpl();
|
||||
default:
|
||||
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Database engine has not initialized properly.");
|
||||
}
|
||||
|
||||
public static void init(DataSourceConfig config) {
|
||||
dataSource = resolveDataSource(config);
|
||||
try {
|
||||
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
||||
} catch (SQLException e) {
|
||||
log.error("Error occurred while retrieving config.datasource connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void init(DataSource dtSource) {
|
||||
dataSource = dtSource;
|
||||
try {
|
||||
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
||||
} catch (SQLException e) {
|
||||
log.error("Error occurred while retrieving config.datasource connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void beginTransaction() throws TransactionManagementException {
|
||||
Connection conn = currentConnection.get();
|
||||
if (conn != null) {
|
||||
|
||||
@ -35,7 +35,7 @@ import java.util.List;
|
||||
/**
|
||||
* Implementation of NotificationDAO which includes the methods to do CRUD operations on notification.
|
||||
*/
|
||||
public class NotificationDAOImpl implements NotificationDAO {
|
||||
public abstract class AbstractNotificationDAOImpl implements NotificationDAO {
|
||||
|
||||
@Override
|
||||
public int addNotification(int deviceId, int tenantId,
|
||||
@ -87,7 +87,7 @@ public class NotificationDAOImpl implements NotificationDAO {
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
notification = this.getNotification(rs);
|
||||
notification = NotificationDAOUtil.getNotification(rs);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
@ -165,7 +165,7 @@ public class NotificationDAOImpl implements NotificationDAO {
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(this.getNotification(rs));
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
@ -176,45 +176,6 @@ public class NotificationDAOImpl implements NotificationDAO {
|
||||
return notifications;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws NotificationManagementException {
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql =
|
||||
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " LIMIT ?,?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setInt(2, tenantId);
|
||||
int paramIdx = 3;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(this.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all notifications", e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getNotificationCount(int tenantId) throws NotificationManagementException {
|
||||
int notificationCount = 0;
|
||||
@ -277,7 +238,7 @@ public class NotificationDAOImpl implements NotificationDAO {
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(this.getNotification(rs));
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
@ -322,59 +283,4 @@ public class NotificationDAOImpl implements NotificationDAO {
|
||||
}
|
||||
return notificationCountByStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||
NotificationManagementException{
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||
"AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " LIMIT ?,?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, status.toString());
|
||||
stmt.setInt(3, tenantId);
|
||||
|
||||
int paramIdx = 4;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(this.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all " +
|
||||
"notifications by status : " + status, e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
|
||||
}
|
||||
|
||||
private Notification getNotification(ResultSet rs) throws SQLException {
|
||||
Notification notification = new Notification();
|
||||
notification.setNotificationId(rs.getInt("NOTIFICATION_ID"));
|
||||
notification.setOperationId(rs.getInt("OPERATION_ID"));
|
||||
notification.setDescription(rs.getString("DESCRIPTION"));
|
||||
notification.setStatus(rs.getString("STATUS"));
|
||||
return notification;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class holds the generic implementation of NotificationDAO which can be used to support ANSI db syntax.
|
||||
*/
|
||||
public class GenericNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||
|
||||
@Override
|
||||
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||
NotificationManagementException {
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql =
|
||||
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " LIMIT ?,?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setInt(2, tenantId);
|
||||
int paramIdx = 3;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all notifications", e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||
NotificationManagementException{
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||
"AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " LIMIT ?,?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, status.toString());
|
||||
stmt.setInt(3, tenantId);
|
||||
|
||||
int paramIdx = 4;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all " +
|
||||
"notifications by status : " + status, e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class holds the Oracle implementation of NotificationDAO which can be used to support Oracle db syntax.
|
||||
*/
|
||||
public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||
|
||||
@Override
|
||||
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||
NotificationManagementException {
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql =
|
||||
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " WHERE OFFSET >= ? AND ROWNUM <= ?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setInt(2, tenantId);
|
||||
int paramIdx = 3;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all notifications", e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||
NotificationManagementException{
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||
"AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " OFFSET >= ? AND ROWNUM <= ?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, status.toString());
|
||||
stmt.setInt(3, tenantId);
|
||||
|
||||
int paramIdx = 4;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all " +
|
||||
"notifications by status : " + status, e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class holds the implementation of NotificationDAO which can be used to support PostgreSQL db syntax.
|
||||
*/
|
||||
public class PostgreSQLNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||
|
||||
@Override
|
||||
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||
NotificationManagementException {
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql =
|
||||
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " LIMIT ? OFFSET ?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setInt(2, tenantId);
|
||||
int paramIdx = 3;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getRowCount());
|
||||
stmt.setInt(paramIdx, request.getStartIndex());
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all notifications", e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||
NotificationManagementException{
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||
"AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " LIMIT ? OFFSET ?";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, status.toString());
|
||||
stmt.setInt(3, tenantId);
|
||||
|
||||
int paramIdx = 4;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getRowCount());
|
||||
stmt.setInt(paramIdx, request.getStartIndex());
|
||||
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all " +
|
||||
"notifications by status : " + status, e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class holds the implementation of NotificationDAO which can be used to support SQLServer db syntax.
|
||||
*/
|
||||
public class SQLServerNotificationDAOImpl extends AbstractNotificationDAOImpl {
|
||||
|
||||
@Override
|
||||
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws
|
||||
NotificationManagementException {
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql =
|
||||
"SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
|
||||
" d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
|
||||
"NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setInt(2, tenantId);
|
||||
int paramIdx = 3;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all notifications", e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Notification> getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
|
||||
NotificationManagementException{
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Notification> notifications = null;
|
||||
try {
|
||||
conn = NotificationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
|
||||
" n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
|
||||
"DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
|
||||
"OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
|
||||
"TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
|
||||
"AND TENANT_ID = ?";
|
||||
|
||||
sql = sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
|
||||
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, status.toString());
|
||||
stmt.setInt(3, tenantId);
|
||||
|
||||
int paramIdx = 4;
|
||||
|
||||
stmt.setInt(paramIdx++, request.getStartIndex());
|
||||
stmt.setInt(paramIdx, request.getRowCount());
|
||||
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
notifications = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
notifications.add(NotificationDAOUtil.getNotification(rs));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new NotificationManagementException(
|
||||
"Error occurred while retrieving information of all " +
|
||||
"notifications by status : " + status, e);
|
||||
} finally {
|
||||
NotificationDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.core.notification.mgt.dao.util;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.CarbonContext;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
||||
import org.wso2.carbon.user.api.UserStoreException;
|
||||
@ -123,4 +124,13 @@ public class NotificationDAOUtil {
|
||||
throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Notification getNotification(ResultSet rs) throws SQLException {
|
||||
Notification notification = new Notification();
|
||||
notification.setNotificationId(rs.getInt("NOTIFICATION_ID"));
|
||||
notification.setOperationId(rs.getInt("OPERATION_ID"));
|
||||
notification.setDescription(rs.getString("DESCRIPTION"));
|
||||
notification.setStatus(rs.getString("STATUS"));
|
||||
return notification;
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ public class PostgreSQLOperationDAOImpl extends GenericOperationDAOImpl {
|
||||
List<Operation> operations = new ArrayList<Operation>();
|
||||
try {
|
||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
||||
"OPERATION_CODE, om.STATUS FROM DM_OPERATION o " +
|
||||
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
|
||||
"o.OPERATION_CODE, om.STATUS FROM DM_OPERATION o " +
|
||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ? OFFSET ?";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
@ -72,7 +72,7 @@ public class PostgreSQLOperationDAOImpl extends GenericOperationDAOImpl {
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
||||
"available for the device'" + enrolmentId + "' with status '", e);
|
||||
"available for the device'" + enrolmentId, e);
|
||||
} finally {
|
||||
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class PostgreSQLOperationDAOImpl extends GenericOperationDAOImpl {
|
||||
List<Operation> operations = new ArrayList<Operation>();
|
||||
try {
|
||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
|
||||
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE " +
|
||||
"FROM DM_OPERATION o " +
|
||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " +
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public class EvaluationContext {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public class PolicyEvaluationException extends Exception {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public interface PolicyEvaluationStrategy {
|
||||
|
||||
Profile execute(EvaluationContext ctx) throws PolicyEvaluationException;
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public class PolicyManagementException extends Exception {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.core.policy.mgt.policy.Policy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PolicyManager {
|
||||
|
||||
public enum Type {
|
||||
USER_BASED, ROLE_BASED, PLATFORM_BASED
|
||||
}
|
||||
|
||||
boolean addPolicy(Policy policy) throws PolicyManagementException;
|
||||
|
||||
boolean removePolicy(String policyId) throws PolicyManagementException;
|
||||
|
||||
boolean updatePolicy(Policy policy) throws PolicyManagementException;
|
||||
|
||||
Policy getPolicy(String policyId) throws PolicyManagementException;
|
||||
|
||||
List<Policy> getPolicies() throws PolicyManagementException;
|
||||
|
||||
List<Policy> getUserBasedPolicies(String user) throws PolicyManagementException;
|
||||
|
||||
List<Policy> getRoleBasedPolicies(String role) throws PolicyManagementException;
|
||||
|
||||
List<Policy> getPlatformBasedPolicies(String platform) throws PolicyManagementException;
|
||||
|
||||
boolean assignRoleBasedPolicy(String policyId, String role) throws PolicyManagementException;
|
||||
|
||||
boolean assignRoleBasedPolicy(String policyId, List<String> roles) throws PolicyManagementException;
|
||||
|
||||
boolean assignUserBasedPolicy(String policyId, String user) throws PolicyManagementException;
|
||||
|
||||
boolean assignUserBasedPolicy(String policyId, List<String> users) throws PolicyManagementException;
|
||||
|
||||
boolean assignPlatformBasedPolicy(String policyId, String platform) throws PolicyManagementException;
|
||||
|
||||
Profile getEffectiveProfile(DeviceIdentifier deviceId) throws PolicyManagementException;
|
||||
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
import org.wso2.carbon.device.mgt.core.policy.mgt.policy.Policy;
|
||||
|
||||
public interface PolicyRepository {
|
||||
|
||||
public enum Type {
|
||||
USER_BASED, ROLE_BASED, PLATFORM_BASED
|
||||
}
|
||||
|
||||
void addPolicy(Policy policy) throws PolicyManagementException;
|
||||
|
||||
void remotePolicy(Policy policy) throws PolicyManagementException;
|
||||
|
||||
void getPolicy(String id) throws PolicyManagementException;
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public class Profile {
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public class Rule {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt;
|
||||
|
||||
public interface RuleCombiningStrategy {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.dao;
|
||||
|
||||
public interface PolicyDAO {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.dao;
|
||||
|
||||
public class PolicyDAOFactory {
|
||||
|
||||
public static PolicyDAO getPolicyDAO() {
|
||||
return new PolicyDAOImpl();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.dao;
|
||||
|
||||
public class PolicyDAOImpl implements PolicyDAO {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.policy;
|
||||
|
||||
public class PlatformBasedPolicy extends Policy {
|
||||
|
||||
private String platform;
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.policy;
|
||||
|
||||
public class Policy {
|
||||
|
||||
private String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.policy;
|
||||
|
||||
public class RoleBasedPolicy extends Policy {
|
||||
|
||||
private String role;
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.core.policy.mgt.policy;
|
||||
|
||||
public class UsedBasedPolicy extends Policy {
|
||||
|
||||
private String username;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,7 +2,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
||||
ID BIGSERIAL PRIMARY KEY,
|
||||
NAME VARCHAR(300) DEFAULT NULL,
|
||||
PROVIDER_TENANT_ID INTEGER DEFAULT 0,
|
||||
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE
|
||||
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
UNIQUE(NAME)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
||||
@ -272,7 +273,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
||||
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
POLICY_ID INTEGER NOT NULL,
|
||||
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL
|
||||
);
|
||||
|
||||
@ -289,18 +290,11 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
|
||||
ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
DEVICE_GROUP_ID INT NOT NULL,
|
||||
POLICY_ID INT NOT NULL,
|
||||
TENANT_ID INT NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
|
||||
FOREIGN KEY (DEVICE_GROUP_ID)
|
||||
REFERENCES DM_GROUP (ID)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
||||
FOREIGN KEY (POLICY_ID)
|
||||
REFERENCES DM_POLICY (ID)
|
||||
@ -350,6 +344,52 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
||||
|
||||
-- POLICY RELATED TABLES FINISHED --
|
||||
|
||||
-- DEVICE GROUP TABLES --
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_GROUP (
|
||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
||||
DESCRIPTION BYTEA DEFAULT NULL,
|
||||
DATE_OF_CREATE INTEGER DEFAULT NULL,
|
||||
DATE_OF_LAST_UPDATE INTEGER DEFAULT NULL,
|
||||
OWNER VARCHAR(45) DEFAULT NULL,
|
||||
TENANT_ID INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
|
||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
DEVICE_ID INTEGER DEFAULT NULL,
|
||||
GROUP_ID INTEGER DEFAULT NULL,
|
||||
TENANT_ID INTEGER DEFAULT 0,
|
||||
CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
|
||||
REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
||||
REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
-- END OF DEVICE GROUP TABLES --
|
||||
|
||||
-- POLICY AND DEVICE GROUP MAPPING --
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
||||
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
DEVICE_GROUP_ID INTEGER NOT NULL,
|
||||
POLICY_ID INTEGER NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
|
||||
FOREIGN KEY (DEVICE_GROUP_ID)
|
||||
REFERENCES DM_GROUP (ID)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
||||
FOREIGN KEY (POLICY_ID)
|
||||
REFERENCES DM_POLICY (ID)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
||||
|
||||
-- NOTIFICATION TABLE --
|
||||
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
||||
NOTIFICATION_ID BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
@ -420,7 +460,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
||||
CPU_USAGE DECIMAL(5) NULL,
|
||||
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
|
||||
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
|
||||
PLUGGED_IN INT NULL,
|
||||
PLUGGED_IN BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
UPDATE_TIMESTAMP BIGINT NOT NULL,
|
||||
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user