diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/css/bootstrap-datepicker.min.css b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/css/bootstrap-datepicker.min.css new file mode 100644 index 000000000..679e25cc4 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/css/bootstrap-datepicker.min.css @@ -0,0 +1,8 @@ +/*! + * Datepicker for Bootstrap v1.4.0 (https://github.com/eternicode/bootstrap-datepicker) + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) + */ +.datepicker{padding:4px;border-radius:4px;direction:ltr}.datepicker-inline{width:220px}.datepicker.datepicker-rtl{direction:rtl}.datepicker.datepicker-rtl table tr td span{float:right}.datepicker-dropdown{top:0;left:0}.datepicker-dropdown:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-top:0;border-bottom-color:rgba(0,0,0,.2);position:absolute}.datepicker-dropdown:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;border-top:0;position:absolute}.datepicker-dropdown.datepicker-orient-left:before{left:6px}.datepicker-dropdown.datepicker-orient-left:after{left:7px}.datepicker-dropdown.datepicker-orient-right:before{right:6px}.datepicker-dropdown.datepicker-orient-right:after{right:7px}.datepicker-dropdown.datepicker-orient-top:before{top:-7px}.datepicker-dropdown.datepicker-orient-top:after{top:-6px}.datepicker-dropdown.datepicker-orient-bottom:before{bottom:-7px;border-bottom:0;border-top:7px solid #999}.datepicker-dropdown.datepicker-orient-bottom:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.datepicker>div{display:none}.datepicker.days .datepicker-days,.datepicker.months .datepicker-months,.datepicker.years .datepicker-years{display:block}.datepicker table{margin:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker table tr td,.datepicker table tr th{text-align:center;width:30px;height:30px;border-radius:4px;border:none}.table-striped .datepicker table tr td,.table-striped .datepicker table tr th{background-color:transparent}.datepicker table tr td.day:hover,.datepicker table tr td.day.focused{background:#eee;cursor:pointer}.datepicker table tr td.old,.datepicker table tr td.new{color:#999}.datepicker table tr td.disabled,.datepicker table tr td.disabled:hover{background:0 0;color:#999;cursor:default}.datepicker table tr td.today,.datepicker table tr td.today:hover,.datepicker table tr td.today.disabled,.datepicker table tr td.today.disabled:hover{color:#000;background-color:#ffdb99;border-color:#ffb733}.datepicker table tr td.today:hover,.datepicker table tr td.today:hover:hover,.datepicker table tr td.today.disabled:hover,.datepicker table tr td.today.disabled:hover:hover,.datepicker table tr td.today:focus,.datepicker table tr td.today:hover:focus,.datepicker table tr td.today.disabled:focus,.datepicker table tr td.today.disabled:hover:focus,.datepicker table tr td.today:active,.datepicker table tr td.today:hover:active,.datepicker table tr td.today.disabled:active,.datepicker table tr td.today.disabled:hover:active,.datepicker table tr td.today.active,.datepicker table tr td.today:hover.active,.datepicker table tr td.today.disabled.active,.datepicker table tr td.today.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.today,.open .dropdown-toggle.datepicker table tr td.today:hover,.open .dropdown-toggle.datepicker table tr td.today.disabled,.open .dropdown-toggle.datepicker table tr td.today.disabled:hover{color:#000;background-color:#ffcd70;border-color:#f59e00}.datepicker table tr td.today:active,.datepicker table tr td.today:hover:active,.datepicker table tr td.today.disabled:active,.datepicker table tr td.today.disabled:hover:active,.datepicker table tr td.today.active,.datepicker table tr td.today:hover.active,.datepicker table tr td.today.disabled.active,.datepicker table tr td.today.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.today,.open .dropdown-toggle.datepicker table tr td.today:hover,.open .dropdown-toggle.datepicker table tr td.today.disabled,.open .dropdown-toggle.datepicker table tr td.today.disabled:hover{background-image:none}.datepicker table tr td.today.disabled,.datepicker table tr td.today:hover.disabled,.datepicker table tr td.today.disabled.disabled,.datepicker table tr td.today.disabled:hover.disabled,.datepicker table tr td.today[disabled],.datepicker table tr td.today:hover[disabled],.datepicker table tr td.today.disabled[disabled],.datepicker table tr td.today.disabled:hover[disabled],fieldset[disabled] .datepicker table tr td.today,fieldset[disabled] .datepicker table tr td.today:hover,fieldset[disabled] .datepicker table tr td.today.disabled,fieldset[disabled] .datepicker table tr td.today.disabled:hover,.datepicker table tr td.today.disabled:hover,.datepicker table tr td.today:hover.disabled:hover,.datepicker table tr td.today.disabled.disabled:hover,.datepicker table tr td.today.disabled:hover.disabled:hover,.datepicker table tr td.today[disabled]:hover,.datepicker table tr td.today:hover[disabled]:hover,.datepicker table tr td.today.disabled[disabled]:hover,.datepicker table tr td.today.disabled:hover[disabled]:hover,fieldset[disabled] .datepicker table tr td.today:hover,fieldset[disabled] .datepicker table tr td.today:hover:hover,fieldset[disabled] .datepicker table tr td.today.disabled:hover,fieldset[disabled] .datepicker table tr td.today.disabled:hover:hover,.datepicker table tr td.today.disabled:focus,.datepicker table tr td.today:hover.disabled:focus,.datepicker table tr td.today.disabled.disabled:focus,.datepicker table tr td.today.disabled:hover.disabled:focus,.datepicker table tr td.today[disabled]:focus,.datepicker table tr td.today:hover[disabled]:focus,.datepicker table tr td.today.disabled[disabled]:focus,.datepicker table tr td.today.disabled:hover[disabled]:focus,fieldset[disabled] .datepicker table tr td.today:focus,fieldset[disabled] .datepicker table tr td.today:hover:focus,fieldset[disabled] .datepicker table tr td.today.disabled:focus,fieldset[disabled] .datepicker table tr td.today.disabled:hover:focus,.datepicker table tr td.today.disabled:active,.datepicker table tr td.today:hover.disabled:active,.datepicker table tr td.today.disabled.disabled:active,.datepicker table tr td.today.disabled:hover.disabled:active,.datepicker table tr td.today[disabled]:active,.datepicker table tr td.today:hover[disabled]:active,.datepicker table tr td.today.disabled[disabled]:active,.datepicker table tr td.today.disabled:hover[disabled]:active,fieldset[disabled] .datepicker table tr td.today:active,fieldset[disabled] .datepicker table tr td.today:hover:active,fieldset[disabled] .datepicker table tr td.today.disabled:active,fieldset[disabled] .datepicker table tr td.today.disabled:hover:active,.datepicker table tr td.today.disabled.active,.datepicker table tr td.today:hover.disabled.active,.datepicker table tr td.today.disabled.disabled.active,.datepicker table tr td.today.disabled:hover.disabled.active,.datepicker table tr td.today[disabled].active,.datepicker table tr td.today:hover[disabled].active,.datepicker table tr td.today.disabled[disabled].active,.datepicker table tr td.today.disabled:hover[disabled].active,fieldset[disabled] .datepicker table tr td.today.active,fieldset[disabled] .datepicker table tr td.today:hover.active,fieldset[disabled] .datepicker table tr td.today.disabled.active,fieldset[disabled] .datepicker table tr td.today.disabled:hover.active{background-color:#ffdb99;border-color:#ffb733}.datepicker table tr td.today:hover:hover{color:#000}.datepicker table tr td.today.active:hover{color:#fff}.datepicker table tr td.range,.datepicker table tr td.range:hover,.datepicker table tr td.range.disabled,.datepicker table tr td.range.disabled:hover{background:#eee;border-radius:0}.datepicker table tr td.range.today,.datepicker table tr td.range.today:hover,.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today.disabled:hover{color:#000;background-color:#f7ca77;border-color:#f1a417;border-radius:0}.datepicker table tr td.range.today:hover,.datepicker table tr td.range.today:hover:hover,.datepicker table tr td.range.today.disabled:hover,.datepicker table tr td.range.today.disabled:hover:hover,.datepicker table tr td.range.today:focus,.datepicker table tr td.range.today:hover:focus,.datepicker table tr td.range.today.disabled:focus,.datepicker table tr td.range.today.disabled:hover:focus,.datepicker table tr td.range.today:active,.datepicker table tr td.range.today:hover:active,.datepicker table tr td.range.today.disabled:active,.datepicker table tr td.range.today.disabled:hover:active,.datepicker table tr td.range.today.active,.datepicker table tr td.range.today:hover.active,.datepicker table tr td.range.today.disabled.active,.datepicker table tr td.range.today.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.range.today,.open .dropdown-toggle.datepicker table tr td.range.today:hover,.open .dropdown-toggle.datepicker table tr td.range.today.disabled,.open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover{color:#000;background-color:#f4bb51;border-color:#bf800c}.datepicker table tr td.range.today:active,.datepicker table tr td.range.today:hover:active,.datepicker table tr td.range.today.disabled:active,.datepicker table tr td.range.today.disabled:hover:active,.datepicker table tr td.range.today.active,.datepicker table tr td.range.today:hover.active,.datepicker table tr td.range.today.disabled.active,.datepicker table tr td.range.today.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.range.today,.open .dropdown-toggle.datepicker table tr td.range.today:hover,.open .dropdown-toggle.datepicker table tr td.range.today.disabled,.open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover{background-image:none}.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today:hover.disabled,.datepicker table tr td.range.today.disabled.disabled,.datepicker table tr td.range.today.disabled:hover.disabled,.datepicker table tr td.range.today[disabled],.datepicker table tr td.range.today:hover[disabled],.datepicker table tr td.range.today.disabled[disabled],.datepicker table tr td.range.today.disabled:hover[disabled],fieldset[disabled] .datepicker table tr td.range.today,fieldset[disabled] .datepicker table tr td.range.today:hover,fieldset[disabled] .datepicker table tr td.range.today.disabled,fieldset[disabled] .datepicker table tr td.range.today.disabled:hover,.datepicker table tr td.range.today.disabled:hover,.datepicker table tr td.range.today:hover.disabled:hover,.datepicker table tr td.range.today.disabled.disabled:hover,.datepicker table tr td.range.today.disabled:hover.disabled:hover,.datepicker table tr td.range.today[disabled]:hover,.datepicker table tr td.range.today:hover[disabled]:hover,.datepicker table tr td.range.today.disabled[disabled]:hover,.datepicker table tr td.range.today.disabled:hover[disabled]:hover,fieldset[disabled] .datepicker table tr td.range.today:hover,fieldset[disabled] .datepicker table tr td.range.today:hover:hover,fieldset[disabled] .datepicker table tr td.range.today.disabled:hover,fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:hover,.datepicker table tr td.range.today.disabled:focus,.datepicker table tr td.range.today:hover.disabled:focus,.datepicker table tr td.range.today.disabled.disabled:focus,.datepicker table tr td.range.today.disabled:hover.disabled:focus,.datepicker table tr td.range.today[disabled]:focus,.datepicker table tr td.range.today:hover[disabled]:focus,.datepicker table tr td.range.today.disabled[disabled]:focus,.datepicker table tr td.range.today.disabled:hover[disabled]:focus,fieldset[disabled] .datepicker table tr td.range.today:focus,fieldset[disabled] .datepicker table tr td.range.today:hover:focus,fieldset[disabled] .datepicker table tr td.range.today.disabled:focus,fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:focus,.datepicker table tr td.range.today.disabled:active,.datepicker table tr td.range.today:hover.disabled:active,.datepicker table tr td.range.today.disabled.disabled:active,.datepicker table tr td.range.today.disabled:hover.disabled:active,.datepicker table tr td.range.today[disabled]:active,.datepicker table tr td.range.today:hover[disabled]:active,.datepicker table tr td.range.today.disabled[disabled]:active,.datepicker table tr td.range.today.disabled:hover[disabled]:active,fieldset[disabled] .datepicker table tr td.range.today:active,fieldset[disabled] .datepicker table tr td.range.today:hover:active,fieldset[disabled] .datepicker table tr td.range.today.disabled:active,fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:active,.datepicker table tr td.range.today.disabled.active,.datepicker table tr td.range.today:hover.disabled.active,.datepicker table tr td.range.today.disabled.disabled.active,.datepicker table tr td.range.today.disabled:hover.disabled.active,.datepicker table tr td.range.today[disabled].active,.datepicker table tr td.range.today:hover[disabled].active,.datepicker table tr td.range.today.disabled[disabled].active,.datepicker table tr td.range.today.disabled:hover[disabled].active,fieldset[disabled] .datepicker table tr td.range.today.active,fieldset[disabled] .datepicker table tr td.range.today:hover.active,fieldset[disabled] .datepicker table tr td.range.today.disabled.active,fieldset[disabled] .datepicker table tr td.range.today.disabled:hover.active{background-color:#f7ca77;border-color:#f1a417}.datepicker table tr td.selected,.datepicker table tr td.selected:hover,.datepicker table tr td.selected.disabled,.datepicker table tr td.selected.disabled:hover{color:#fff;background-color:#999;border-color:#555;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td.selected:hover,.datepicker table tr td.selected:hover:hover,.datepicker table tr td.selected.disabled:hover,.datepicker table tr td.selected.disabled:hover:hover,.datepicker table tr td.selected:focus,.datepicker table tr td.selected:hover:focus,.datepicker table tr td.selected.disabled:focus,.datepicker table tr td.selected.disabled:hover:focus,.datepicker table tr td.selected:active,.datepicker table tr td.selected:hover:active,.datepicker table tr td.selected.disabled:active,.datepicker table tr td.selected.disabled:hover:active,.datepicker table tr td.selected.active,.datepicker table tr td.selected:hover.active,.datepicker table tr td.selected.disabled.active,.datepicker table tr td.selected.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.selected,.open .dropdown-toggle.datepicker table tr td.selected:hover,.open .dropdown-toggle.datepicker table tr td.selected.disabled,.open .dropdown-toggle.datepicker table tr td.selected.disabled:hover{color:#fff;background-color:#858585;border-color:#373737}.datepicker table tr td.selected:active,.datepicker table tr td.selected:hover:active,.datepicker table tr td.selected.disabled:active,.datepicker table tr td.selected.disabled:hover:active,.datepicker table tr td.selected.active,.datepicker table tr td.selected:hover.active,.datepicker table tr td.selected.disabled.active,.datepicker table tr td.selected.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.selected,.open .dropdown-toggle.datepicker table tr td.selected:hover,.open .dropdown-toggle.datepicker table tr td.selected.disabled,.open .dropdown-toggle.datepicker table tr td.selected.disabled:hover{background-image:none}.datepicker table tr td.selected.disabled,.datepicker table tr td.selected:hover.disabled,.datepicker table tr td.selected.disabled.disabled,.datepicker table tr td.selected.disabled:hover.disabled,.datepicker table tr td.selected[disabled],.datepicker table tr td.selected:hover[disabled],.datepicker table tr td.selected.disabled[disabled],.datepicker table tr td.selected.disabled:hover[disabled],fieldset[disabled] .datepicker table tr td.selected,fieldset[disabled] .datepicker table tr td.selected:hover,fieldset[disabled] .datepicker table tr td.selected.disabled,fieldset[disabled] .datepicker table tr td.selected.disabled:hover,.datepicker table tr td.selected.disabled:hover,.datepicker table tr td.selected:hover.disabled:hover,.datepicker table tr td.selected.disabled.disabled:hover,.datepicker table tr td.selected.disabled:hover.disabled:hover,.datepicker table tr td.selected[disabled]:hover,.datepicker table tr td.selected:hover[disabled]:hover,.datepicker table tr td.selected.disabled[disabled]:hover,.datepicker table tr td.selected.disabled:hover[disabled]:hover,fieldset[disabled] .datepicker table tr td.selected:hover,fieldset[disabled] .datepicker table tr td.selected:hover:hover,fieldset[disabled] .datepicker table tr td.selected.disabled:hover,fieldset[disabled] .datepicker table tr td.selected.disabled:hover:hover,.datepicker table tr td.selected.disabled:focus,.datepicker table tr td.selected:hover.disabled:focus,.datepicker table tr td.selected.disabled.disabled:focus,.datepicker table tr td.selected.disabled:hover.disabled:focus,.datepicker table tr td.selected[disabled]:focus,.datepicker table tr td.selected:hover[disabled]:focus,.datepicker table tr td.selected.disabled[disabled]:focus,.datepicker table tr td.selected.disabled:hover[disabled]:focus,fieldset[disabled] .datepicker table tr td.selected:focus,fieldset[disabled] .datepicker table tr td.selected:hover:focus,fieldset[disabled] .datepicker table tr td.selected.disabled:focus,fieldset[disabled] .datepicker table tr td.selected.disabled:hover:focus,.datepicker table tr td.selected.disabled:active,.datepicker table tr td.selected:hover.disabled:active,.datepicker table tr td.selected.disabled.disabled:active,.datepicker table tr td.selected.disabled:hover.disabled:active,.datepicker table tr td.selected[disabled]:active,.datepicker table tr td.selected:hover[disabled]:active,.datepicker table tr td.selected.disabled[disabled]:active,.datepicker table tr td.selected.disabled:hover[disabled]:active,fieldset[disabled] .datepicker table tr td.selected:active,fieldset[disabled] .datepicker table tr td.selected:hover:active,fieldset[disabled] .datepicker table tr td.selected.disabled:active,fieldset[disabled] .datepicker table tr td.selected.disabled:hover:active,.datepicker table tr td.selected.disabled.active,.datepicker table tr td.selected:hover.disabled.active,.datepicker table tr td.selected.disabled.disabled.active,.datepicker table tr td.selected.disabled:hover.disabled.active,.datepicker table tr td.selected[disabled].active,.datepicker table tr td.selected:hover[disabled].active,.datepicker table tr td.selected.disabled[disabled].active,.datepicker table tr td.selected.disabled:hover[disabled].active,fieldset[disabled] .datepicker table tr td.selected.active,fieldset[disabled] .datepicker table tr td.selected:hover.active,fieldset[disabled] .datepicker table tr td.selected.disabled.active,fieldset[disabled] .datepicker table tr td.selected.disabled:hover.active{background-color:#999;border-color:#555}.datepicker table tr td.active,.datepicker table tr td.active:hover,.datepicker table tr td.active.disabled,.datepicker table tr td.active.disabled:hover{color:#fff;background-color:#428bca;border-color:#357ebd;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td.active:hover,.datepicker table tr td.active:hover:hover,.datepicker table tr td.active.disabled:hover,.datepicker table tr td.active.disabled:hover:hover,.datepicker table tr td.active:focus,.datepicker table tr td.active:hover:focus,.datepicker table tr td.active.disabled:focus,.datepicker table tr td.active.disabled:hover:focus,.datepicker table tr td.active:active,.datepicker table tr td.active:hover:active,.datepicker table tr td.active.disabled:active,.datepicker table tr td.active.disabled:hover:active,.datepicker table tr td.active.active,.datepicker table tr td.active:hover.active,.datepicker table tr td.active.disabled.active,.datepicker table tr td.active.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.active,.open .dropdown-toggle.datepicker table tr td.active:hover,.open .dropdown-toggle.datepicker table tr td.active.disabled,.open .dropdown-toggle.datepicker table tr td.active.disabled:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.datepicker table tr td.active:active,.datepicker table tr td.active:hover:active,.datepicker table tr td.active.disabled:active,.datepicker table tr td.active.disabled:hover:active,.datepicker table tr td.active.active,.datepicker table tr td.active:hover.active,.datepicker table tr td.active.disabled.active,.datepicker table tr td.active.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td.active,.open .dropdown-toggle.datepicker table tr td.active:hover,.open .dropdown-toggle.datepicker table tr td.active.disabled,.open .dropdown-toggle.datepicker table tr td.active.disabled:hover{background-image:none}.datepicker table tr td.active.disabled,.datepicker table tr td.active:hover.disabled,.datepicker table tr td.active.disabled.disabled,.datepicker table tr td.active.disabled:hover.disabled,.datepicker table tr td.active[disabled],.datepicker table tr td.active:hover[disabled],.datepicker table tr td.active.disabled[disabled],.datepicker table tr td.active.disabled:hover[disabled],fieldset[disabled] .datepicker table tr td.active,fieldset[disabled] .datepicker table tr td.active:hover,fieldset[disabled] .datepicker table tr td.active.disabled,fieldset[disabled] .datepicker table tr td.active.disabled:hover,.datepicker table tr td.active.disabled:hover,.datepicker table tr td.active:hover.disabled:hover,.datepicker table tr td.active.disabled.disabled:hover,.datepicker table tr td.active.disabled:hover.disabled:hover,.datepicker table tr td.active[disabled]:hover,.datepicker table tr td.active:hover[disabled]:hover,.datepicker table tr td.active.disabled[disabled]:hover,.datepicker table tr td.active.disabled:hover[disabled]:hover,fieldset[disabled] .datepicker table tr td.active:hover,fieldset[disabled] .datepicker table tr td.active:hover:hover,fieldset[disabled] .datepicker table tr td.active.disabled:hover,fieldset[disabled] .datepicker table tr td.active.disabled:hover:hover,.datepicker table tr td.active.disabled:focus,.datepicker table tr td.active:hover.disabled:focus,.datepicker table tr td.active.disabled.disabled:focus,.datepicker table tr td.active.disabled:hover.disabled:focus,.datepicker table tr td.active[disabled]:focus,.datepicker table tr td.active:hover[disabled]:focus,.datepicker table tr td.active.disabled[disabled]:focus,.datepicker table tr td.active.disabled:hover[disabled]:focus,fieldset[disabled] .datepicker table tr td.active:focus,fieldset[disabled] .datepicker table tr td.active:hover:focus,fieldset[disabled] .datepicker table tr td.active.disabled:focus,fieldset[disabled] .datepicker table tr td.active.disabled:hover:focus,.datepicker table tr td.active.disabled:active,.datepicker table tr td.active:hover.disabled:active,.datepicker table tr td.active.disabled.disabled:active,.datepicker table tr td.active.disabled:hover.disabled:active,.datepicker table tr td.active[disabled]:active,.datepicker table tr td.active:hover[disabled]:active,.datepicker table tr td.active.disabled[disabled]:active,.datepicker table tr td.active.disabled:hover[disabled]:active,fieldset[disabled] .datepicker table tr td.active:active,fieldset[disabled] .datepicker table tr td.active:hover:active,fieldset[disabled] .datepicker table tr td.active.disabled:active,fieldset[disabled] .datepicker table tr td.active.disabled:hover:active,.datepicker table tr td.active.disabled.active,.datepicker table tr td.active:hover.disabled.active,.datepicker table tr td.active.disabled.disabled.active,.datepicker table tr td.active.disabled:hover.disabled.active,.datepicker table tr td.active[disabled].active,.datepicker table tr td.active:hover[disabled].active,.datepicker table tr td.active.disabled[disabled].active,.datepicker table tr td.active.disabled:hover[disabled].active,fieldset[disabled] .datepicker table tr td.active.active,fieldset[disabled] .datepicker table tr td.active:hover.active,fieldset[disabled] .datepicker table tr td.active.disabled.active,fieldset[disabled] .datepicker table tr td.active.disabled:hover.active{background-color:#428bca;border-color:#357ebd}.datepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.datepicker table tr td span:hover{background:#eee}.datepicker table tr td span.disabled,.datepicker table tr td span.disabled:hover{background:0 0;color:#999;cursor:default}.datepicker table tr td span.active,.datepicker table tr td span.active:hover,.datepicker table tr td span.active.disabled,.datepicker table tr td span.active.disabled:hover{color:#fff;background-color:#428bca;border-color:#357ebd;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td span.active:hover,.datepicker table tr td span.active:hover:hover,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active.disabled:hover:hover,.datepicker table tr td span.active:focus,.datepicker table tr td span.active:hover:focus,.datepicker table tr td span.active.disabled:focus,.datepicker table tr td span.active.disabled:hover:focus,.datepicker table tr td span.active:active,.datepicker table tr td span.active:hover:active,.datepicker table tr td span.active.disabled:active,.datepicker table tr td span.active.disabled:hover:active,.datepicker table tr td span.active.active,.datepicker table tr td span.active:hover.active,.datepicker table tr td span.active.disabled.active,.datepicker table tr td span.active.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td span.active,.open .dropdown-toggle.datepicker table tr td span.active:hover,.open .dropdown-toggle.datepicker table tr td span.active.disabled,.open .dropdown-toggle.datepicker table tr td span.active.disabled:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.datepicker table tr td span.active:active,.datepicker table tr td span.active:hover:active,.datepicker table tr td span.active.disabled:active,.datepicker table tr td span.active.disabled:hover:active,.datepicker table tr td span.active.active,.datepicker table tr td span.active:hover.active,.datepicker table tr td span.active.disabled.active,.datepicker table tr td span.active.disabled:hover.active,.open .dropdown-toggle.datepicker table tr td span.active,.open .dropdown-toggle.datepicker table tr td span.active:hover,.open .dropdown-toggle.datepicker table tr td span.active.disabled,.open .dropdown-toggle.datepicker table tr td span.active.disabled:hover{background-image:none}.datepicker table tr td span.active.disabled,.datepicker table tr td span.active:hover.disabled,.datepicker table tr td span.active.disabled.disabled,.datepicker table tr td span.active.disabled:hover.disabled,.datepicker table tr td span.active[disabled],.datepicker table tr td span.active:hover[disabled],.datepicker table tr td span.active.disabled[disabled],.datepicker table tr td span.active.disabled:hover[disabled],fieldset[disabled] .datepicker table tr td span.active,fieldset[disabled] .datepicker table tr td span.active:hover,fieldset[disabled] .datepicker table tr td span.active.disabled,fieldset[disabled] .datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active:hover.disabled:hover,.datepicker table tr td span.active.disabled.disabled:hover,.datepicker table tr td span.active.disabled:hover.disabled:hover,.datepicker table tr td span.active[disabled]:hover,.datepicker table tr td span.active:hover[disabled]:hover,.datepicker table tr td span.active.disabled[disabled]:hover,.datepicker table tr td span.active.disabled:hover[disabled]:hover,fieldset[disabled] .datepicker table tr td span.active:hover,fieldset[disabled] .datepicker table tr td span.active:hover:hover,fieldset[disabled] .datepicker table tr td span.active.disabled:hover,fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover,.datepicker table tr td span.active.disabled:focus,.datepicker table tr td span.active:hover.disabled:focus,.datepicker table tr td span.active.disabled.disabled:focus,.datepicker table tr td span.active.disabled:hover.disabled:focus,.datepicker table tr td span.active[disabled]:focus,.datepicker table tr td span.active:hover[disabled]:focus,.datepicker table tr td span.active.disabled[disabled]:focus,.datepicker table tr td span.active.disabled:hover[disabled]:focus,fieldset[disabled] .datepicker table tr td span.active:focus,fieldset[disabled] .datepicker table tr td span.active:hover:focus,fieldset[disabled] .datepicker table tr td span.active.disabled:focus,fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus,.datepicker table tr td span.active.disabled:active,.datepicker table tr td span.active:hover.disabled:active,.datepicker table tr td span.active.disabled.disabled:active,.datepicker table tr td span.active.disabled:hover.disabled:active,.datepicker table tr td span.active[disabled]:active,.datepicker table tr td span.active:hover[disabled]:active,.datepicker table tr td span.active.disabled[disabled]:active,.datepicker table tr td span.active.disabled:hover[disabled]:active,fieldset[disabled] .datepicker table tr td span.active:active,fieldset[disabled] .datepicker table tr td span.active:hover:active,fieldset[disabled] .datepicker table tr td span.active.disabled:active,fieldset[disabled] .datepicker table tr td span.active.disabled:hover:active,.datepicker table tr td span.active.disabled.active,.datepicker table tr td span.active:hover.disabled.active,.datepicker table tr td span.active.disabled.disabled.active,.datepicker table tr td span.active.disabled:hover.disabled.active,.datepicker table tr td span.active[disabled].active,.datepicker table tr td span.active:hover[disabled].active,.datepicker table tr td span.active.disabled[disabled].active,.datepicker table tr td span.active.disabled:hover[disabled].active,fieldset[disabled] .datepicker table tr td span.active.active,fieldset[disabled] .datepicker table tr td span.active:hover.active,fieldset[disabled] .datepicker table tr td span.active.disabled.active,fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active{background-color:#428bca;border-color:#357ebd}.datepicker table tr td span.old,.datepicker table tr td span.new{color:#999}.datepicker .datepicker-switch{width:145px}.datepicker thead tr:first-child th,.datepicker tfoot tr th{cursor:pointer}.datepicker thead tr:first-child th:hover,.datepicker tfoot tr th:hover{background:#eee}.datepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.datepicker thead tr:first-child .cw{cursor:default;background-color:transparent}.input-group.date .input-group-addon{cursor:pointer}.input-daterange{width:100%}.input-daterange input{text-align:center}.input-daterange input:first-child{border-radius:3px 0 0 3px}.input-daterange input:last-child{border-radius:0 3px 3px 0}.input-daterange .input-group-addon{width:auto;min-width:16px;padding:4px 5px;font-weight:400;line-height:1.42857143;text-align:center;text-shadow:0 1px 0 #fff;vertical-align:middle;background-color:#eee;border:solid #ccc;border-width:1px 0;margin-left:-5px;margin-right:-5px} \ No newline at end of file diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/index.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/index.xml index 35449da59..6f1ca0906 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/index.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/index.xml @@ -69,6 +69,12 @@ + + @@ -85,7 +91,17 @@ - + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js index 9ea1b8d4e..5d4bfab3d 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js @@ -327,25 +327,31 @@ function notifyError(message) { function enableRealTime() { document.getElementById('realTimeShow').style.display = 'none'; spatialObject = currentSpatialObjects[selectedSpatialObject]; - spatialObject.removePath(); - spatialObject.marker.closePopup(); + if (spatialObject) { + spatialObject.removePath(); + spatialObject.marker.closePopup(); + } selectedSpatialObject = null; clearFocus(); clearMap(); document.getElementById('objectInfo').style.display = 'none'; isBatchModeOn = false; } + function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) { if (!timeFrom) { notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom); } else if (!timeTo) { notifyError('No end time provided to show history. Please provide a suitable value' + timeTo); } else { + $('#dateRangePopup').dialog('close'); document.getElementById('realTimeShow').style.display = 'block'; isBatchModeOn = true; clearFocus(); // Clear current focus if any clearMap(); - var tableData = getProviderData(timeFrom, timeTo); + var fromDate = new Date(timeFrom); + var toDate = new Date(timeTo); + var tableData = getProviderData(fromDate.valueOf() / 1000, toDate.valueOf() / 1000); for (var i = 0; i < tableData.length; i++) { var data = tableData[i]; var geoMessage = { @@ -401,7 +407,6 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) { createChart(); chart.load({columns: [spatialObject.speedHistory.getArray()]}); }, 100); - $('#dateRangePopup').dialog('close'); } } diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/jquery/bootstrap-datepicker.min.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/jquery/bootstrap-datepicker.min.js new file mode 100644 index 000000000..f26d0d867 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/jquery/bootstrap-datepicker.min.js @@ -0,0 +1,8 @@ +/*! + * Datepicker for Bootstrap v1.4.0 (https://github.com/eternicode/bootstrap-datepicker) + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) + */ +!function(a,b){function c(){return new Date(Date.UTC.apply(Date,arguments))}function d(){var a=new Date;return c(a.getFullYear(),a.getMonth(),a.getDate())}function e(a,b){return a.getUTCFullYear()===b.getUTCFullYear()&&a.getUTCMonth()===b.getUTCMonth()&&a.getUTCDate()===b.getUTCDate()}function f(a){return function(){return this[a].apply(this,arguments)}}function g(b,c){function d(a,b){return b.toLowerCase()}var e,f=a(b).data(),g={},h=new RegExp("^"+c.toLowerCase()+"([A-Z])");c=new RegExp("^"+c.toLowerCase());for(var i in f)c.test(i)&&(e=i.replace(h,d),g[e]=f[i]);return g}function h(b){var c={};if(p[b]||(b=b.split("-")[0],p[b])){var d=p[b];return a.each(o,function(a,b){b in d&&(c[b]=d[b])}),c}}var i=function(){var b={get:function(a){return this.slice(a)[0]},contains:function(a){for(var b=a&&a.valueOf(),c=0,d=this.length;d>c;c++)if(this[c].valueOf()===b)return c;return-1},remove:function(a){this.splice(a,1)},replace:function(b){b&&(a.isArray(b)||(b=[b]),this.clear(),this.push.apply(this,b))},clear:function(){this.length=0},copy:function(){var a=new i;return a.replace(this),a}};return function(){var c=[];return c.push.apply(c,arguments),a.extend(c,b),c}}(),j=function(b,c){this._process_options(c),this.dates=new i,this.viewDate=this.o.defaultViewDate,this.focusDate=null,this.element=a(b),this.isInline=!1,this.isInput=this.element.is("input"),this.component=this.element.hasClass("date")?this.element.find(".add-on, .input-group-addon, .btn"):!1,this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=a(q.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker-inline").appendTo(this.element):this.picker.addClass("datepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("datepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot .today, tfoot .clear").attr("colspan",function(a,b){return parseInt(b)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.setDatesDisabled(this.o.datesDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};j.prototype={constructor:j,_process_options:function(e){this._o=a.extend({},this._o,e);var f=this.o=a.extend({},this._o),g=f.language;switch(p[g]||(g=g.split("-")[0],p[g]||(g=n.language)),f.language=g,f.startView){case 2:case"decade":f.startView=2;break;case 1:case"year":f.startView=1;break;default:f.startView=0}switch(f.minViewMode){case 1:case"months":f.minViewMode=1;break;case 2:case"years":f.minViewMode=2;break;default:f.minViewMode=0}f.startView=Math.max(f.startView,f.minViewMode),f.multidate!==!0&&(f.multidate=Number(f.multidate)||!1,f.multidate!==!1&&(f.multidate=Math.max(0,f.multidate))),f.multidateSeparator=String(f.multidateSeparator),f.weekStart%=7,f.weekEnd=(f.weekStart+6)%7;var h=q.parseFormat(f.format);if(f.startDate!==-1/0&&(f.startDate=f.startDate?f.startDate instanceof Date?this._local_to_utc(this._zero_time(f.startDate)):q.parseDate(f.startDate,h,f.language):-1/0),1/0!==f.endDate&&(f.endDate=f.endDate?f.endDate instanceof Date?this._local_to_utc(this._zero_time(f.endDate)):q.parseDate(f.endDate,h,f.language):1/0),f.daysOfWeekDisabled=f.daysOfWeekDisabled||[],a.isArray(f.daysOfWeekDisabled)||(f.daysOfWeekDisabled=f.daysOfWeekDisabled.split(/[,\s]*/)),f.daysOfWeekDisabled=a.map(f.daysOfWeekDisabled,function(a){return parseInt(a,10)}),f.datesDisabled=f.datesDisabled||[],!a.isArray(f.datesDisabled)){var i=[];i.push(q.parseDate(f.datesDisabled,h,f.language)),f.datesDisabled=i}f.datesDisabled=a.map(f.datesDisabled,function(a){return q.parseDate(a,h,f.language)});var j=String(f.orientation).toLowerCase().split(/\s+/g),k=f.orientation.toLowerCase();if(j=a.grep(j,function(a){return/^auto|left|right|top|bottom$/.test(a)}),f.orientation={x:"auto",y:"auto"},k&&"auto"!==k)if(1===j.length)switch(j[0]){case"top":case"bottom":f.orientation.y=j[0];break;case"left":case"right":f.orientation.x=j[0]}else k=a.grep(j,function(a){return/^left|right$/.test(a)}),f.orientation.x=k[0]||"auto",k=a.grep(j,function(a){return/^top|bottom$/.test(a)}),f.orientation.y=k[0]||"auto";else;if(f.defaultViewDate){var l=f.defaultViewDate.year||(new Date).getFullYear(),m=f.defaultViewDate.month||0,o=f.defaultViewDate.day||1;f.defaultViewDate=c(l,m,o)}else f.defaultViewDate=d();f.showOnFocus=f.showOnFocus!==b?f.showOnFocus:!0},_events:[],_secondaryEvents:[],_applyEvents:function(a){for(var c,d,e,f=0;fe?(this.picker.addClass("datepicker-orient-right"),n=k.left+m-b):this.picker.addClass("datepicker-orient-left");var p,q,r=this.o.orientation.y;if("auto"===r&&(p=-g+o-c,q=g+f-(o+l+c),r=Math.max(p,q)===q?"top":"bottom"),this.picker.addClass("datepicker-orient-"+r),"top"===r?o+=l:o-=c+parseInt(this.picker.css("padding-top")),this.o.rtl){var s=e-(n+m);this.picker.css({top:o,right:s,zIndex:j})}else this.picker.css({top:o,left:n,zIndex:j});return this},_allow_update:!0,update:function(){if(!this._allow_update)return this;var b=this.dates.copy(),c=[],d=!1;return arguments.length?(a.each(arguments,a.proxy(function(a,b){b instanceof Date&&(b=this._local_to_utc(b)),c.push(b)},this)),d=!0):(c=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),c=c&&this.o.multidate?c.split(this.o.multidateSeparator):[c],delete this.element.data().date),c=a.map(c,a.proxy(function(a){return q.parseDate(a,this.o.format,this.o.language)},this)),c=a.grep(c,a.proxy(function(a){return athis.o.endDate||!a},this),!0),this.dates.replace(c),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDatethis.o.endDate&&(this.viewDate=new Date(this.o.endDate)),d?this.setValue():c.length&&String(b)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&b.length&&this._trigger("clearDate"),this.fill(),this},fillDow:function(){var a=this.o.weekStart,b="";if(this.o.calendarWeeks){this.picker.find(".datepicker-days thead tr:first-child .datepicker-switch").attr("colspan",function(a,b){return parseInt(b)+1});var c=' ';b+=c}for(;a'+p[this.o.language].daysMin[a++%7]+"";b+="",this.picker.find(".datepicker-days thead").append(b)},fillMonths:function(){for(var a="",b=0;12>b;)a+=''+p[this.o.language].monthsShort[b++]+"";this.picker.find(".datepicker-months td").html(a)},setRange:function(b){b&&b.length?this.range=a.map(b,function(a){return a.valueOf()}):delete this.range,this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),f=this.viewDate.getUTCMonth(),g=new Date;return b.getUTCFullYear()d||b.getUTCFullYear()===d&&b.getUTCMonth()>f)&&c.push("new"),this.focusDate&&b.valueOf()===this.focusDate.valueOf()&&c.push("focused"),this.o.todayHighlight&&b.getUTCFullYear()===g.getFullYear()&&b.getUTCMonth()===g.getMonth()&&b.getUTCDate()===g.getDate()&&c.push("today"),-1!==this.dates.contains(b)&&c.push("active"),(b.valueOf()this.o.endDate||-1!==a.inArray(b.getUTCDay(),this.o.daysOfWeekDisabled))&&c.push("disabled"),this.o.datesDisabled.length>0&&a.grep(this.o.datesDisabled,function(a){return e(b,a)}).length>0&&c.push("disabled","disabled-date"),this.range&&(b>this.range[0]&&b"),this.o.calendarWeeks)){var u=new Date(+n+(this.o.weekStart-n.getUTCDay()-7)%7*864e5),v=new Date(Number(u)+(11-u.getUTCDay())%7*864e5),w=new Date(Number(w=c(v.getUTCFullYear(),0,1))+(11-w.getUTCDay())%7*864e5),x=(v-w)/864e5/7+1;t.push(''+x+"")}if(s=this.getClassNames(n),s.push("day"),this.o.beforeShowDay!==a.noop){var y=this.o.beforeShowDay(this._utc_to_local(n));y===b?y={}:"boolean"==typeof y?y={enabled:y}:"string"==typeof y&&(y={classes:y}),y.enabled===!1&&s.push("disabled"),y.classes&&(s=s.concat(y.classes.split(/\s+/))),y.tooltip&&(d=y.tooltip)}s=a.unique(s),t.push('"+n.getUTCDate()+""),d=null,n.getUTCDay()===this.o.weekEnd&&t.push(""),n.setUTCDate(n.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(t.join(""));var z=this.picker.find(".datepicker-months").find("th:eq(1)").text(f).end().find("span").removeClass("active");if(a.each(this.dates,function(a,b){b.getUTCFullYear()===f&&z.eq(b.getUTCMonth()).addClass("active")}),(h>f||f>j)&&z.addClass("disabled"),f===h&&z.slice(0,i).addClass("disabled"),f===j&&z.slice(k+1).addClass("disabled"),this.o.beforeShowMonth!==a.noop){var A=this;a.each(z,function(b,c){if(!a(c).hasClass("disabled")){var d=new Date(f,b,1),e=A.o.beforeShowMonth(d);e===!1&&a(c).addClass("disabled")}})}t="",f=10*parseInt(f/10,10);var B=this.picker.find(".datepicker-years").find("th:eq(1)").text(f+"-"+(f+9)).end().find("td");f-=1;for(var C,D=a.map(this.dates,function(a){return a.getUTCFullYear()}),E=-1;11>E;E++)C=["year"],-1===E?C.push("old"):10===E&&C.push("new"),-1!==a.inArray(f,D)&&C.push("active"),(h>f||f>j)&&C.push("disabled"),t+=''+f+"",f+=1;B.html(t)}},updateNavArrows:function(){if(this._allow_update){var a=new Date(this.viewDate),b=a.getUTCFullYear(),c=a.getUTCMonth();switch(this.viewMode){case 0:this.picker.find(".prev").css(this.o.startDate!==-1/0&&b<=this.o.startDate.getUTCFullYear()&&c<=this.o.startDate.getUTCMonth()?{visibility:"hidden"}:{visibility:"visible"}),this.picker.find(".next").css(1/0!==this.o.endDate&&b>=this.o.endDate.getUTCFullYear()&&c>=this.o.endDate.getUTCMonth()?{visibility:"hidden"}:{visibility:"visible"});break;case 1:case 2:this.picker.find(".prev").css(this.o.startDate!==-1/0&&b<=this.o.startDate.getUTCFullYear()?{visibility:"hidden"}:{visibility:"visible"}),this.picker.find(".next").css(1/0!==this.o.endDate&&b>=this.o.endDate.getUTCFullYear()?{visibility:"hidden"}:{visibility:"visible"})}}},click:function(b){b.preventDefault();var d,e,f,g=a(b.target).closest("span, td, th");if(1===g.length)switch(g[0].nodeName.toLowerCase()){case"th":switch(g[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var h=q.modes[this.viewMode].navStep*("prev"===g[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,h),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,h),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":var i=new Date;i=c(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0),this.showMode(-2);var j="linked"===this.o.todayBtn?null:"view";this._setDate(i,j);break;case"clear":this.clearDates()}break;case"span":g.hasClass("disabled")||(this.viewDate.setUTCDate(1),g.hasClass("month")?(f=1,e=g.parent().find("span").index(g),d=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(e),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(c(d,e,f))):(f=1,e=0,d=parseInt(g.text(),10)||0,this.viewDate.setUTCFullYear(d),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(c(d,e,f))),this.showMode(-1),this.fill());break;case"td":g.hasClass("day")&&!g.hasClass("disabled")&&(f=parseInt(g.text(),10)||1,d=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth(),g.hasClass("old")?0===e?(e=11,d-=1):e-=1:g.hasClass("new")&&(11===e?(e=0,d+=1):e+=1),this._setDate(c(d,e,f)))}this.picker.is(":visible")&&this._focused_from&&a(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(a){var b=this.dates.contains(a);if(a||this.dates.clear(),-1!==b?(this.o.multidate===!0||this.o.multidate>1||this.o.toggleActive)&&this.dates.remove(b):this.o.multidate===!1?(this.dates.clear(),this.dates.push(a)):this.dates.push(a),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(a,b){b&&"date"!==b||this._toggle_multidate(a&&new Date(a)),b&&"view"!==b||(this.viewDate=a&&new Date(a)),this.fill(),this.setValue(),b&&"view"===b||this._trigger("changeDate");var c;this.isInput?c=this.element:this.component&&(c=this.element.find("input")),c&&c.change(),!this.o.autoclose||b&&"date"!==b||this.hide()},moveMonth:function(a,c){if(!a)return b;if(!c)return a;var d,e,f=new Date(a.valueOf()),g=f.getUTCDate(),h=f.getUTCMonth(),i=Math.abs(c);if(c=c>0?1:-1,1===i)e=-1===c?function(){return f.getUTCMonth()===h}:function(){return f.getUTCMonth()!==d},d=h+c,f.setUTCMonth(d),(0>d||d>11)&&(d=(d+12)%12);else{for(var j=0;i>j;j++)f=this.moveMonth(f,c);d=f.getUTCMonth(),f.setUTCDate(g),e=function(){return d!==f.getUTCMonth()}}for(;e();)f.setUTCDate(--g),f.setUTCMonth(d);return f},moveYear:function(a,b){return this.moveMonth(a,12*b)},dateWithinRange:function(a){return a>=this.o.startDate&&a<=this.o.endDate},keydown:function(a){if(!this.picker.is(":visible"))return void(27===a.keyCode&&this.show());var b,c,e,f=!1,g=this.focusDate||this.viewDate;switch(a.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),a.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;b=37===a.keyCode?-1:1,a.ctrlKey?(c=this.moveYear(this.dates.get(-1)||d(),b),e=this.moveYear(g,b),this._trigger("changeYear",this.viewDate)):a.shiftKey?(c=this.moveMonth(this.dates.get(-1)||d(),b),e=this.moveMonth(g,b),this._trigger("changeMonth",this.viewDate)):(c=new Date(this.dates.get(-1)||d()),c.setUTCDate(c.getUTCDate()+b),e=new Date(g),e.setUTCDate(g.getUTCDate()+b)),this.dateWithinRange(e)&&(this.focusDate=this.viewDate=e,this.setValue(),this.fill(),a.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;b=38===a.keyCode?-1:1,a.ctrlKey?(c=this.moveYear(this.dates.get(-1)||d(),b),e=this.moveYear(g,b),this._trigger("changeYear",this.viewDate)):a.shiftKey?(c=this.moveMonth(this.dates.get(-1)||d(),b),e=this.moveMonth(g,b),this._trigger("changeMonth",this.viewDate)):(c=new Date(this.dates.get(-1)||d()),c.setUTCDate(c.getUTCDate()+7*b),e=new Date(g),e.setUTCDate(g.getUTCDate()+7*b)),this.dateWithinRange(e)&&(this.focusDate=this.viewDate=e,this.setValue(),this.fill(),a.preventDefault());break;case 32:break;case 13:g=this.focusDate||this.dates.get(-1)||this.viewDate,this.o.keyboardNavigation&&(this._toggle_multidate(g),f=!0),this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(a.preventDefault(),"function"==typeof a.stopPropagation?a.stopPropagation():a.cancelBubble=!0,this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(f){this._trigger(this.dates.length?"changeDate":"clearDate");var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.change()}},showMode:function(a){a&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+a))),this.picker.children("div").hide().filter(".datepicker-"+q.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var k=function(b,c){this.element=a(b),this.inputs=a.map(c.inputs,function(a){return a.jquery?a[0]:a}),delete c.inputs,m.call(a(this.inputs),c).bind("changeDate",a.proxy(this.dateUpdated,this)),this.pickers=a.map(this.inputs,function(b){return a(b).data("datepicker")}),this.updateDates()};k.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.getUTCDate()}),this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(a,c){c.setRange(b)})},dateUpdated:function(b){if(!this.updating){this.updating=!0;var c=a(b.target).data("datepicker"),d=c.getUTCDate(),e=a.inArray(b.target,this.inputs),f=e-1,g=e+1,h=this.inputs.length;if(-1!==e){if(a.each(this.pickers,function(a,b){b.getUTCDate()||b.setUTCDate(d)}),d=0&&dthis.dates[g])for(;h>g&&d>this.dates[g];)this.pickers[g++].setUTCDate(d);this.updateDates(),delete this.updating}}},remove:function(){a.map(this.pickers,function(a){a.remove()}),delete this.element.data().datepicker}};var l=a.fn.datepicker,m=function(c){var d=Array.apply(null,arguments);d.shift();var e;return this.each(function(){var f=a(this),i=f.data("datepicker"),l="object"==typeof c&&c;if(!i){var m=g(this,"date"),o=a.extend({},n,m,l),p=h(o.language),q=a.extend({},n,p,m,l);if(f.hasClass("input-daterange")||q.inputs){var r={inputs:q.inputs||f.find("input").toArray()};f.data("datepicker",i=new k(this,a.extend(q,r)))}else f.data("datepicker",i=new j(this,q))}return"string"==typeof c&&"function"==typeof i[c]&&(e=i[c].apply(i,d),e!==b)?!1:void 0}),e!==b?e:this};a.fn.datepicker=m;var n=a.fn.datepicker.defaults={autoclose:!1,beforeShowDay:a.noop,beforeShowMonth:a.noop,calendarWeeks:!1,clearBtn:!1,toggleActive:!1,daysOfWeekDisabled:[],datesDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0,disableTouchKeyboard:!1,enableOnReadonly:!0,container:"body"},o=a.fn.datepicker.locale_opts=["format","rtl","weekStart"];a.fn.datepicker.Constructor=j;var p=a.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},q={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return a%4===0&&a%100!==0||a%400===0},getDaysInMonth:function(a,b){return[31,q.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(a){var b=a.replace(this.validParts,"\x00").split("\x00"),c=a.match(this.validParts);if(!b||!b.length||!c||0===c.length)throw new Error("Invalid date format.");return{separators:b,parts:c}},parseDate:function(d,e,f){function g(){var a=this.slice(0,m[k].length),b=m[k].slice(0,a.length);return a.toLowerCase()===b.toLowerCase()}if(!d)return b;if(d instanceof Date)return d;"string"==typeof e&&(e=q.parseFormat(e));var h,i,k,l=/([\-+]\d+)([dmwy])/,m=d.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(d)){for(d=new Date,k=0;kb;)b+=12;for(b%=12,a.setUTCMonth(b);a.getUTCMonth()!==b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)}};t.M=t.MM=t.mm=t.m,t.dd=t.d,d=c(d.getFullYear(),d.getMonth(),d.getDate(),0,0,0);var u=e.parts.slice();if(m.length!==u.length&&(u=a(u).filter(function(b,c){return-1!==a.inArray(c,s)}).toArray()),m.length===u.length){var v;for(k=0,v=u.length;v>k;k++){if(n=parseInt(m[k],10),h=u[k],isNaN(n))switch(h){case"MM":o=a(p[f].months).filter(g),n=a.inArray(o[0],p[f].months)+1;break;case"M":o=a(p[f].monthsShort).filter(g),n=a.inArray(o[0],p[f].monthsShort)+1}r[h]=n}var w,x;for(k=0;k=g;g++)f.length&&b.push(f.shift()),b.push(e[c.parts[g]]);return b.join("")},headTemplate:'«»',contTemplate:'',footTemplate:''};q.template=''+q.headTemplate+""+q.footTemplate+''+q.headTemplate+q.contTemplate+q.footTemplate+''+q.headTemplate+q.contTemplate+q.footTemplate+"",a.fn.datepicker.DPGlobal=q,a.fn.datepicker.noConflict=function(){return a.fn.datepicker=l,this},a.fn.datepicker.version="1.4.0",a(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(b){var c=a(this);c.data("datepicker")||(b.preventDefault(),m.call(c,"show"))}),a(function(){m.call(a('[data-provide="datepicker-inline"]'))})}(window.jQuery); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 1cf3ce06a..4a4a2f845 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -153,6 +153,10 @@ org.wso2.carbon.device.mgt.extensions provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 2c60c0b4d..dab39be0a 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -19,14 +19,13 @@ package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.constants.AndroidSenseConstants; import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @SwaggerDefinition( @@ -44,6 +43,16 @@ import javax.ws.rs.core.Response; @Tag(name = "android_sense", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Enroll device", + description = "", + key = "perm:android-sense:enroll", + permissions = {"/device-mgt/devices/enroll/android-sense"} + ) + } +) public interface AndroidSenseService { /** @@ -54,7 +63,19 @@ public interface AndroidSenseService { */ @Path("device/{deviceId}/words") @POST - @Scope(key = "device:android-sense:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Send the key words to the device", + notes = "", + response = Response.class, + tags = "android_sense", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") + }) + } + ) Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords); /** @@ -65,12 +86,36 @@ public interface AndroidSenseService { */ @Path("device/{deviceId}/words/threshold") @POST - @Scope(key = "device:android-sense:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Send threshold value to the device", + notes = "", + response = Response.class, + tags = "android_sense", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") + }) + } + ) Response sendThreshold(@PathParam("deviceId") String deviceId, @QueryParam("threshold") String threshold); @Path("device/{deviceId}/words") @DELETE - @Scope(key = "device:android-sense:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "DELETE", + value = "Remove key words from the device", + notes = "", + response = Response.class, + tags = "android_sense", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") + }) + } + ) Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words); /** @@ -79,8 +124,20 @@ public interface AndroidSenseService { @Path("stats/{deviceId}/sensors/{sensorName}") @GET @Consumes("application/json") - @Scope(key = "device:android-sense:enroll", name = "", description = "") @Produces("application/json") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Retrieve Sensor data for the device type", + notes = "", + response = Response.class, + tags = "android_sense", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") + }) + } + ) Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, @QueryParam("from") long from, @QueryParam("to") long to); @@ -89,7 +146,19 @@ public interface AndroidSenseService { */ @Path("device/{device_id}/register") @POST - @Scope(key = "device:android-sense:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Enroll device", + notes = "", + response = Response.class, + tags = "android_sense", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") + }) + } + ) Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java index e1419844c..68678d000 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java @@ -42,4 +42,6 @@ public class AndroidSenseConstants { public static final String CONFIG_TYPE = "general"; public static final String DEFAULT_ENDPOINT = "tcp://localhost:1886"; + public static final String SCOPE = "scope"; + } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs index ce3f71d7c..952d78878 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs @@ -43,6 +43,8 @@ Operations Log + Map {{/zone}} {{#zone "device-view-tab-contents"}} diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index 55154f46a..9b2465e21 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -141,6 +141,10 @@ org.wso2.carbon.analytics.api provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java index cd0ef710b..3ed382479 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java @@ -18,15 +18,14 @@ package org.wso2.carbon.device.mgt.iot.arduino.service.impl; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.iot.arduino.service.impl.constants.ArduinoConstants; import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @SwaggerDefinition( @@ -44,26 +43,72 @@ import javax.ws.rs.core.Response; @Tag(name = "arduino", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Enroll device", + description = "", + key = "perm:arduino:enroll", + permissions = {"/device-mgt/devices/enroll/arduino"} + ) + } +) public interface ArduinoService { @Path("device/{deviceId}/bulb") @POST - @Scope(key = "device:arduino:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Switch bulb", + notes = "", + response = Response.class, + tags = "arduino", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll") + }) + } + ) Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); @Path("device/{deviceId}/controls") @GET - @Scope(key = "device:arduino:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Read controls", + notes = "", + response = Response.class, + tags = "arduino", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll") + }) + } + ) Response readControls(@PathParam("deviceId") String deviceId); /** - * Retreive Sensor data for the device type + * Retrieve Sensor data for the device type */ @Path("device/stats/{deviceId}") @GET @Consumes("application/json") @Produces("application/json") - @Scope(key = "device:arduino:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Retrieve Sensor data for the device type", + notes = "", + response = Response.class, + tags = "arduino", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll") + }) + } + ) Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @QueryParam("to") long to); @@ -73,7 +118,19 @@ public interface ArduinoService { @Path("device/download") @GET @Produces("application/octet-stream") - @Scope(key = "device:arduino:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Download device agent", + notes = "", + response = Response.class, + tags = "arduino", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll") + }) + } + ) Response downloadSketch(@QueryParam("deviceName") String customDeviceName); } diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/constants/ArduinoConstants.java b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/constants/ArduinoConstants.java index ebf84d9ea..4f3a042c9 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/constants/ArduinoConstants.java +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/constants/ArduinoConstants.java @@ -27,4 +27,6 @@ public class ArduinoConstants { public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600"; + public static final String SCOPE = "scope"; + } diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.device-view/device-view.hbs b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.device-view/device-view.hbs index 8911ee748..23aaa135e 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.device-view/device-view.hbs +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.device-view/device-view.hbs @@ -44,6 +44,8 @@ Operations Log + Map {{/zone}} {{#zone "device-view-tab-contents"}} diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index 8df74b2f2..ddae87c22 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -121,7 +121,11 @@ org.wso2.carbon.device.mgt.extensions provided - + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java index 812c58439..1f227e630 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java @@ -18,12 +18,10 @@ package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl.constants.RaspberrypiConstants; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -44,11 +42,33 @@ import javax.ws.rs.core.Response; @Tag(name = "raspberrypi", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Enroll device", + description = "", + key = "perm:raspberrypi:enroll", + permissions = {"/device-mgt/devices/enroll/raspberrypi"} + ) + } +) public interface RaspberryPiService { @Path("device/{deviceId}/bulb") @POST - @Scope(key = "device:raspberrypi:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Switch bulb", + notes = "", + response = Response.class, + tags = "raspberrypi", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll") + }) + } + ) Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); /** @@ -58,7 +78,19 @@ public interface RaspberryPiService { @GET @Consumes("application/json") @Produces("application/json") - @Scope(key = "device:raspberrypi:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Retreive Sensor data for the device type", + notes = "", + response = Response.class, + tags = "raspberrypi", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll") + }) + } + ) Response getRaspberryPiTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @QueryParam("to") long to); @@ -68,7 +100,19 @@ public interface RaspberryPiService { @Path("device/download") @GET @Produces(MediaType.APPLICATION_JSON) - @Scope(key = "device:raspberrypi:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Download the agent.", + notes = "", + response = Response.class, + tags = "raspberrypi", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll") + }) + } + ) Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType); } diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java index 168cb7d6d..00919d6f6 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java @@ -33,4 +33,6 @@ public class RaspberrypiConstants { public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600"; + public static final String SCOPE = "scope"; + } diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs index 62d9e2d9d..42ad0d173 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs @@ -44,6 +44,8 @@ Operations Log + Map {{/zone}} {{#zone "device-view-tab-contents"}} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 59ccc4a79..6c9cc0636 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -240,7 +240,11 @@ org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin provided - + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java index 75db835b7..6585280f0 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java @@ -18,14 +18,12 @@ package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** @@ -50,8 +48,20 @@ import javax.ws.rs.core.Response; @Tag(name = "virtual_firealarm", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Enroll device", + description = "", + key = "perm:firealarm:enroll", + permissions = {"/device-mgt/devices/enroll/firealarm"} + ) + } +) public interface VirtualFireAlarmService { + String SCOPE = "scope"; + /** * This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to * the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used @@ -63,7 +73,19 @@ public interface VirtualFireAlarmService { */ @POST @Path("device/{deviceId}/buzz") - @Scope(key = "device:firealarm:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Switch Buzzer", + notes = "", + response = Response.class, + tags = "virtual_firealarm", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll") + }) + } + ) Response switchBuzzer(@PathParam("deviceId") String deviceId, @FormParam("state") String state); @@ -72,7 +94,19 @@ public interface VirtualFireAlarmService { */ @Path("device/stats/{deviceId}") @GET - @Scope(key = "device:firealarm:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Retrieve Sensor data for the device type", + notes = "", + response = Response.class, + tags = "virtual_firealarm", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll") + }) + } + ) @Consumes("application/json") @Produces("application/json") Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @@ -81,7 +115,19 @@ public interface VirtualFireAlarmService { @Path("device/download") @GET @Produces("application/zip") - @Scope(key = "device:firealarm:enroll", name = "", description = "") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Download agent", + notes = "", + response = Response.class, + tags = "virtual_firealarm", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll") + }) + } + ) Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 017ff5400..c2ea04177 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -143,6 +143,11 @@ org.wso2.carbon.device.mgt.common provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + provided + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.core diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index 4386ca5cc..db795dcd8 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.mdm.services.android.bean.wrapper.*; +import org.wso2.carbon.mdm.services.android.util.AndroidConstants; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -64,6 +65,160 @@ import java.util.List; @Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Lock Device", + description = "Hard lock own device", + key = "perm:android:lock-devices", + permissions = {"/device-mgt/devices/owning-device/operations/android/lock"} + ), + @Scope( + name = "Unlock Device", + description = "Unlock permanently locked device", + key = "perm:android:unlock-devices", + permissions = {"/device-mgt/devices/owning-device/operations/android/unlock"} + ), + @Scope( + name = "Get Location", + description = "Request device location coordinates", + key = "perm:android:location", + permissions = {"/device-mgt/devices/owning-device/operations/android/location"} + ), + @Scope( + name = "Clear Password", + description = "Clear the password on Android devices", + key = "perm:android:clear-password", + permissions = {"/device-mgt/devices/owning-device/operations/android/clear-password"} + ), + @Scope( + name = "Control Camera", + description = "Enabling or Disabling the Camera on Android Devices", + key = "perm:android:control-camera", + permissions = {"/device-mgt/devices/owning-device/operations/android/camera"} + ), + @Scope( + name = "Get Info", + description = "Requesting device information from Android Devices", + key = "perm:android:info", + permissions = {"/device-mgt/devices/owning-device/operations/android/info"} + ), + @Scope( + name = "Get Logs", + description = "Requesting Logcat Details from Android Devices", + key = "perm:android:logcat", + permissions = {"/device-mgt/devices/owning-device/operations/android/logcat"} + ), + @Scope( + name = "Enterprise Wipe", + description = "Enterprise Wiping Android Devices", + key = "perm:android:enterprise-wipe", + permissions = {"/device-mgt/devices/owning-device/operations/android/enterprise-wipe"} + ), + @Scope( + name = "Factory Reset", + description = "Factory Resetting Android Devices", + key = "perm:android:wipe", + permissions = {"/device-mgt/devices/owning-device/operations/android/wipe"} + ), + @Scope( + name = "Get Installed Applications", + description = "Get list of installed applications", + key = "perm:android:applications", + permissions = {"/device-mgt/devices/owning-device/operations/android/applications"} + ), + @Scope( + name = "Ring Device", + description = "Ring Android devices", + key = "perm:android:ring", + permissions = {"/device-mgt/devices/owning-device/operations/android/ring"} + ), + @Scope( + name = "Reboot Device", + description = "Reboot Android devices", + key = "perm:android:reboot", + permissions = {"/device-mgt/devices/owning-device/operations/android/reboot"} + ), + @Scope( + name = "Mute Device", + description = "Mute Android devices", + key = "perm:android:mute", + permissions = {"/device-mgt/devices/owning-device/operations/android/mute"} + ), + @Scope( + name = "Install Applications", + description = "Installing an Application on Android Devices", + key = "perm:android:install-application", + permissions = {"/device-mgt/devices/owning-device/operations/android/install-app"} + ), + @Scope( + name = "Update Applications", + description = "Updating an Application on Android Devices", + key = "perm:android:update-application", + permissions = {"/device-mgt/devices/owning-device/operations/android/update-app"} + ), + @Scope( + name = "Uninstall Applications", + description = "Uninstalling an Application on Android Devices", + key = "perm:android:uninstall-application", + permissions = {"/device-mgt/devices/owning-device/operations/android/uninstall-app"} + ), + @Scope( + name = "Blacklist Applications", + description = "Blacklisting applications on Android Devices", + key = "perm:android:blacklist-applications", + permissions = {"/device-mgt/devices/owning-device/operations/android/blacklist-app"} + ), + @Scope( + name = "Upgrade Firmware", + description = "Upgrading Firmware of Android Devices", + key = "perm:android:upgrade-firmware", + permissions = {"/device-mgt/devices/owning-device/operations/android/upgrade"} + ), + @Scope( + name = "Configure VPN", + description = "Configure VPN on Android Device", + key = "perm:android:configure-vpn", + permissions = {"/device-mgt/devices/owning-device/operations/android/vpn"} + ), + @Scope( + name = "Send Notification", + description = "Sending a notification to Android Device", + key = "perm:android:send-notification", + permissions = {"/device-mgt/devices/owning-device/operations/android/send-notification"} + ), + @Scope( + name = "Configure Wi-Fi", + description = "Configure Wi-Fi on Android Device", + key = "perm:android:configure-wifi", + permissions = {"/device-mgt/devices/owning-device/operations/android/wifi"} + ), + @Scope( + name = "Encrypt Storage", + description = "Encrypting storage on Android Device", + key = "perm:android:encrypt-storage", + permissions = {"/device-mgt/devices/owning-device/operations/android/encrypt"} + ), + @Scope( + name = "Change Password", + description = "Changing the lock code of an Android Device", + key = "perm:android:change-lock-code", + permissions = {"/device-mgt/devices/owning-device/operations/android/change-lock-code"} + ), + @Scope( + name = "Password Policy", + description = "Set password policy of an Android Device", + key = "perm:android:set-password-policy", + permissions = {"/device-mgt/devices/owning-device/operations/android/password-policy"} + ), + @Scope( + name = "Add Web clip", + description = "Setting a Web Clip on Android Devices", + key = "perm:android:set-webclip", + permissions = {"/device-mgt/devices/owning-device/operations/android/webclip"} + ) + } +) public interface DeviceManagementAdminService { @POST @@ -76,13 +231,10 @@ public interface DeviceManagementAdminService { "permanently locks the device or screen locking an Android device.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/lock", - description = "Lock Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:lock-devices") + }) } ) @ApiResponses(value = { @@ -142,13 +294,10 @@ public interface DeviceManagementAdminService { notes = "Unlock devices that were locked permanently using the hard lock operation. Devices that are hard locked can only be unlocked by the EMM administrator.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/unlock", - description = "Unlock Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:unlock-devices") + }) } ) @ApiResponses(value = { @@ -208,13 +357,10 @@ public interface DeviceManagementAdminService { "Example: In situations where you have lost your device and need to find out where it is, you can use this REST API to get the location of the device.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/location", - description = "Get Device Location") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:location") + }) } ) @ApiResponses(value = { @@ -270,13 +416,10 @@ public interface DeviceManagementAdminService { notes = "Clear the password on Android devices", response = Activity.class, tags = "Android Device Management Administrative Service.", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/clear-password", - description = "Clear Password of Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:clear-password") + }) } ) @ApiResponses(value = { @@ -331,13 +474,11 @@ public interface DeviceManagementAdminService { notes = "Enable or disable the camera on Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/operations/android/camera", description = "Manage Camera") } - ) - } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:control-camera") + }) + } ) @ApiResponses(value = { @ApiResponse( code = 201, @@ -398,13 +539,10 @@ public interface DeviceManagementAdminService { "the list of operations that needs to be executed on the device", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/info", - description = "Get Device Information") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:info") + }) } ) @ApiResponses(value = { @@ -464,13 +602,10 @@ public interface DeviceManagementAdminService { "the list of operations that needs to be executed on the device.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/logcat", - description = "Get Logs") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:logcat") + }) } ) @ApiResponses(value = { @@ -529,13 +664,10 @@ public interface DeviceManagementAdminService { "personal data intact. You are able to enterprise wipe Android devices using this REST API.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe", - description = "Enterprise Wipe") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enterprise-wipe") + }) } ) @ApiResponses(value = { @@ -592,13 +724,10 @@ public interface DeviceManagementAdminService { "to restore them back to the original system.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/wipe", - description = "Factory Reset") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:wipe") + }) } ) @ApiResponses(value = { @@ -659,13 +788,10 @@ public interface DeviceManagementAdminService { "on the device.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/applications", - description = "Get Installed Application") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:applications") + }) } ) @ApiResponses(value = { @@ -722,13 +848,10 @@ public interface DeviceManagementAdminService { notes = "Ring Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/ring", - description = "Ring Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:ring") + }) } ) @ApiResponses(value = { @@ -785,13 +908,10 @@ public interface DeviceManagementAdminService { notes = "Reboot or restart your Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/reboot", - description = "Reboot Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:reboot") + }) } ) @ApiResponses(value = { @@ -840,6 +960,7 @@ public interface DeviceManagementAdminService { List deviceIDs); @POST + @Path("/mute") @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", @@ -847,13 +968,10 @@ public interface DeviceManagementAdminService { notes = "Mute or enable a silent profile for Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/mute", - description = "Mute Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:mute") + }) } ) @ApiResponses(value = { @@ -894,7 +1012,6 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device mute operation.") }) - @Path("/mute") Response muteDevice( @ApiParam( name = "deviceIDs", @@ -913,13 +1030,10 @@ public interface DeviceManagementAdminService { " the application installation will happen in silent mode, else the device user's consent will be required.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/install-app", - description = "Install Applications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:install-application") + }) } ) @ApiResponses(value = { @@ -981,13 +1095,10 @@ public interface DeviceManagementAdminService { "mode, else the device user's consent is required.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/update-app", - description = "Update installed applications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:update-application") + }) } ) @ApiResponses(value = { @@ -1046,13 +1157,10 @@ public interface DeviceManagementAdminService { notes = "Uninstall an application from Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/uninstall-app", - description = "Uninstall Applications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:uninstall-application") + }) } ) @ApiResponses(value = { @@ -1115,13 +1223,10 @@ public interface DeviceManagementAdminService { "COPE devices. Applications can be blacklisted via the application restriction policy too.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/blacklist-app", - description = "Blacklist Applications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:blacklist-applications") + }) } ) @ApiResponses(value = { @@ -1176,17 +1281,14 @@ public interface DeviceManagementAdminService { consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "POST", - value = "UUpgrading Firmware of Android Devices", + value = "Upgrading Firmware of Android Devices", notes = "Upgrade the firmware of Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/upgrade", - description = "Upgrade Firmware") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:upgrade-firmware") + }) } ) @ApiResponses(value = { @@ -1247,13 +1349,10 @@ public interface DeviceManagementAdminService { notes = "Configure VPN on Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/vpn", - description = "Add VPN") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-vpn") + }) } ) @ApiResponses(value = { @@ -1310,13 +1409,10 @@ public interface DeviceManagementAdminService { notes = "Send a notification or message to Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/send-notification", - description = "Send Notifications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:send-notification") + }) } ) @ApiResponses(value = { @@ -1374,13 +1470,10 @@ public interface DeviceManagementAdminService { notes = "Configure Wi-Fi on Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/wifi", - description = "Add Wifi Configuration") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-wifi") + }) } ) @ApiResponses(value = { @@ -1439,13 +1532,10 @@ public interface DeviceManagementAdminService { notes = "Encrypt the data stored on Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/encrypt", - description = "Encrypt Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:encrypt-storage") + }) } ) @ApiResponses(value = { @@ -1504,13 +1594,10 @@ public interface DeviceManagementAdminService { notes = "Change the lock code on Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/change-lock-code", - description = "Change Password of Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:change-lock-code") + }) } ) @ApiResponses(value = { @@ -1569,13 +1656,10 @@ public interface DeviceManagementAdminService { notes = "Set a password policy on Android devices.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/password-policy", - description = "Set Password Policy") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-password-policy") + }) } ) @ApiResponses(value = { @@ -1624,7 +1708,7 @@ public interface DeviceManagementAdminService { PasswordPolicyBeanWrapper passwordPolicyBeanWrapper); @POST - @Path("set-webclip") + @Path("/set-webclip") @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", @@ -1632,13 +1716,10 @@ public interface DeviceManagementAdminService { notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application.", response = Activity.class, tags = "Android Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/android/webclip", - description = "Add Webclips") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-webclip") + }) } ) @ApiResponses(value = { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index cf1ba2431..5c7df5f1f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -18,22 +18,14 @@ */ package org.wso2.carbon.mdm.services.android.services; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Info; -import io.swagger.annotations.ResponseHeader; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.annotations.*; + +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; +import org.wso2.carbon.mdm.services.android.util.AndroidConstants; import javax.validation.Valid; import javax.validation.constraints.NotNull; @@ -72,6 +64,22 @@ import java.util.List; @Path("/devices") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Enroll Device", + description = "Register an Android device", + key = "perm:android:enroll", + permissions = {"/device-mgt/devices/enroll/android"} + ), + @Scope( + name = "Un-enroll Device", + description = "Unregister an Android device", + key = "perm:android:disenroll", + permissions = {"/device-mgt/devices/disenroll/android"} + ) + } +) public interface DeviceManagementService { @PUT @@ -83,12 +91,10 @@ public interface DeviceManagementService { value = "Updating the Application Details on Android Devices", notes = "Update the details of the applications that are installed on Android devices.", tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Enroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses(value = { @@ -150,12 +156,10 @@ public interface DeviceManagementService { "The server then updates the status of the operations that were carried out on the device.", response = Operation.class, tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Enroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses(value = { @@ -216,12 +220,10 @@ public interface DeviceManagementService { " you can use this REST API to register an Android device with WSO2 EMM, without having to install" + " an Android Agent. This API can be mainly used to test the device enrollment process.", tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Enroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses(value = { @@ -273,12 +275,10 @@ public interface DeviceManagementService { value = "Getting the Registration Status of an Android Device", notes = "Use this REST API to retrieve the registration status of an Android device.", tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Enroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses(value = { @@ -328,12 +328,10 @@ public interface DeviceManagementService { value = "Updating the Registration Details of an Android Device", notes = "Use this REST API to update the registration details of an Android device.", tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Enroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses( @@ -386,11 +384,10 @@ public interface DeviceManagementService { value = "Unregistering an Android Device", notes = "Use this REST API to unregister an Android device.", tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/disenroll/android", description = "Disenroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:disenroll") + }) } ) @ApiResponses(value = { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java index 9b005bab7..9e91213cc 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; +import org.wso2.carbon.mdm.services.android.util.AndroidConstants; import javax.validation.Valid; import javax.ws.rs.*; @@ -61,6 +62,28 @@ import javax.ws.rs.core.Response; @Path("/configuration") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Enroll Device", + description = "Register an Android device", + key = "perm:android:enroll", + permissions = {"/device-mgt/devices/enroll/android"} + ), + @Scope( + name = "View Configurations", + description = "Getting Android Platform Configurations", + key = "perm:android:view-configuration", + permissions = {"/device-mgt/platform-configurations/view"} + ), + @Scope( + name = "Manage Configurations", + description = "Updating Android Platform Configurations", + key = "perm:android:manage-configuration", + permissions = {"/device-mgt/platform-configurations/manage"} + ) + } +) public interface DeviceTypeConfigurationService { @GET @@ -71,12 +94,10 @@ public interface DeviceTypeConfigurationService { notes = "Get the Android platform configuration details using this REST API.", response = PlatformConfiguration.class, tags = "Android Configuration Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view", - description = "View Configurations") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:view-configuration") + }) } ) @ApiResponses(value = { @@ -127,12 +148,10 @@ public interface DeviceTypeConfigurationService { value = "Updating Android Platform Configurations", notes = "Update the Android platform configurations using this REST API.", tags = "Android Configuration Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/manage", - description = "Manage Configurations") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:manage-configuration") + }) } ) @ApiResponses(value = { @@ -184,12 +203,10 @@ public interface DeviceTypeConfigurationService { "registration process.", response = String.class, tags = "Android Configuration Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Enroll Device") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses(value = { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java index c2278ffa5..86a6df265 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java @@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; +import org.wso2.carbon.mdm.services.android.util.AndroidConstants; import javax.validation.Valid; import javax.validation.constraints.Size; @@ -61,6 +62,16 @@ import javax.ws.rs.core.Response; @Path("/events") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Enroll Device", + description = "Register an Android device", + key = "perm:android:enroll", + permissions = {"/device-mgt/devices/enroll/android"} + ) + } +) public interface EventReceiverService { @POST @@ -72,12 +83,10 @@ public interface EventReceiverService { value = "Publishing Events", notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.", tags = "Event Receiver", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Publish Events to DAS") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses( @@ -137,12 +146,10 @@ public interface EventReceiverService { response = DeviceState.class, responseContainer = "List", tags = "Event Receiver", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", - description = "Publish Events to DAS") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll") + }) } ) @ApiResponses( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java index 62ed8afe0..c1e09b4c0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java @@ -26,6 +26,7 @@ public final class AndroidConstants { public static final String DEVICE_TYPE_ANDROID = "android"; public static final String HEADER_CONTENT_TYPE = "Content-Type"; public static final String APPLICATION_JSON = "application/json"; + public static final String SCOPE = "scope"; public final class DeviceProperties { private DeviceProperties() { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/download-agent.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/download-agent.hbs index 26f32fefb..8173c413a 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/download-agent.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/download-agent.hbs @@ -38,9 +38,9 @@ under the License. --}} If you have not already enrolled this device with {{companyName}}, - Download and install following EMM Agent to continue. + Download and install following IoT Server Agent to continue. - Download EMM Agent + Download IoT Server Agent diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs index 7e3708ed9..5ace32cb3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs @@ -28,7 +28,7 @@ Type of Communication - + @@ -42,7 +42,7 @@ Polling Interval* - + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs index d1854284c..d99897ea7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs @@ -1137,7 +1137,7 @@ Profile Name - + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs index 3cca932a8..984bc21af 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs @@ -1243,7 +1243,7 @@ Profile Name - + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs index 61c351954..00fdac102 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs @@ -1137,7 +1137,7 @@ Profile Name - + diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/Constants.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/Constants.java index b68bca44c..b20f31baa 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/Constants.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/Constants.java @@ -79,6 +79,8 @@ public class Constants { public static final String META_FORMAT_INT = "int"; public static final String META_FORMAT_CHARACTER = "chr"; + public static final String SCOPE = "scope"; + /** * SynclML service related constants. */ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java index 4d57e80a3..cbc7132d6 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java @@ -32,9 +32,12 @@ import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; +import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; import javax.jws.WebService; import javax.ws.rs.*; @@ -66,8 +69,30 @@ import javax.ws.rs.core.Response; description = "This carries all the resources related to Windows configurations management functionality") @WebService @Path("/configuration") -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) +@Produces({"application/json", "application/xml"}) +@Consumes({"application/json", "application/xml"}) +@Scopes( + scopes = { + @Scope( + name = "Enroll Device", + description = "Register an Windows device", + key = "perm:windows:enroll", + permissions = {"/device-mgt/devices/enroll/windows"} + ), + @Scope( + name = "View Configurations", + description = "Getting Windows Platform Configurations", + key = "perm:windows:view-configuration", + permissions = {"/device-mgt/platform-configurations/view"} + ), + @Scope( + name = "Manage Configurations", + description = "Updating Windows Platform Configurations", + key = "perm:windows:manage-configuration", + permissions = {"/device-mgt/platform-configurations/manage"} + ) + } +) public interface ConfigurationMgtService { @GET @@ -78,12 +103,10 @@ public interface ConfigurationMgtService { notes = "Get the Windows platform configuration details using this REST API.", response = PlatformConfiguration.class, tags = "Windows Configuration Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/platform-configurations/view", - description = "View Configurations")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:view-configuration") + }) } ) @ApiResponses(value = { @@ -139,12 +162,10 @@ public interface ConfigurationMgtService { value = "Updating Windows Platform Configurations", notes = "Update the Windows platform configurations using this REST API.", tags = "Windows Configuration Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/configurations/manage", - description = "Manage Configurations")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:manage-configuration") + }) } ) @ApiResponses(value = { @@ -197,12 +218,10 @@ public interface ConfigurationMgtService { "registration process.", response = String.class, tags = "Windows Configuration Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", - description = "Enroll Device")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll") + }) } ) @ApiResponses(value = { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java index 0652953f4..cdb12d8c7 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java @@ -19,9 +19,12 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services; import io.swagger.annotations.*; -import org.wso2.carbon.apimgt.annotations.api.Permission; + +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; +import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; import javax.jws.WebService; import javax.ws.rs.Consumes; @@ -52,231 +55,388 @@ import java.util.List; } ), tags = { - @Tag(name = "windows", description = "") + @Tag(name = "devicemgt_windows", description = "") } ) @Api(value = "Windows Device Management Administrative Service", description = "Device management related admin APIs.") @WebService -@Path("/operation/admin/devices") -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) +@Path("/admin/devices") +@Consumes(MediaType.APPLICATION_JSON) +@Produces(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Lock Device", + description = "Adding a Device Lock on Windows devices.", + key = "perm:windows:lock-devices", + permissions = {"/device-mgt/devices/owning-device/operations/windows/lock"} + ), + @Scope( + name = "Un-enroll Device", + description = "Unregister an Windows device", + key = "perm:windows:disenroll", + permissions = {"/device-mgt/devices/disenroll/windows"} + ), + @Scope( + name = "Factory Reset", + description = "Factory Resetting Windows Devices", + key = "perm:windows:wipe", + permissions = {"/device-mgt/devices/owning-device/operations/windows/wipe"} + ), + @Scope( + name = "Ring Device", + description = "Ring Windows devices", + key = "perm:windows:ring", + permissions = {"/device-mgt/devices/owning-device/operations/windows/ring"} + ), + @Scope( + name = "Lock Reset", + description = "Lock reset on Windows devices", + key = "perm:windows:lock-reset", + permissions = {"/device-mgt/devices/owning-device/operations/windows/lock-reset"} + ), + @Scope( + name = "Reboot", + description = "Lock reset on Windows devices", + key = "perm:windows:reboot", + permissions = {"/device-mgt/devices/owning-device/operations/windows/reboot"} + ), + @Scope( + name = "Device Location", + description = "Lock reset on Windows devices", + key = "perm:windows:location", + permissions = {"/device-mgt/devices/owning-device/operations/windows/location"} + ) + } +) public interface DeviceManagementAdminService { - @POST - @Path("/lock-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Adding a Device Lock on Windows devices.", - notes = "Using this API you have the option of Device Windows device.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/windows/lock", - description = "Lock Device")} - ) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the device lock operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified. \n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while locking the device.") - }) - Response lock(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the AWindows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; + @POST + @Path("/lock-devices") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Adding a Device Lock on Windows devices.", + notes = "Using this API you have the option of Device Windows device.", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-devices") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the device lock operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified. \n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while locking the device.") + }) + Response lock(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the AWindows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - @POST - @Path("/disenroll-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Dis-enrol the windows Devices", - notes = "Dis-enroll on Android devices", - response = Activity.class, - tags = "Windows Device Management Administrative Service.", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope( - scope = "/device-mgt/devices/disenroll/windows", - description = "Dis-enroll the windows devices ")} - ) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the Dis-enroll operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified the last time.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding a Dis-enroll operation.") - }) - Response disenroll(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; + @POST + @Path("/disenroll-devices") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Dis-enrol the windows Devices", + notes = "Dis-enroll on Android devices", + response = Activity.class, + tags = "Windows Device Management Administrative Service.", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:disenroll") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the Dis-enroll operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a Dis-enroll operation.") + }) + Response disenroll(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - @POST - @Path("/wipe-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Factory Resetting an Windows Device", - notes = "Factory rest or erase all the data stored on the Windows devices" + - "to restore them back to the original system.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/windows/wipe", - description = "DeviceWipe")} - ) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the Data wipe operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified." + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding the Data wipe operation.")}) - Response wipe(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; + @POST + @Path("/wipe-devices") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Factory Resetting an Windows Device", + notes = "Factory rest or erase all the data stored on the Windows devices" + + "to restore them back to the original system.", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:wipe") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the Data wipe operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified." + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding the Data wipe operation.")}) + Response wipe(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; + + @POST + @Path("/ring-devices") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Ringing Windows Devices", + notes = "Ring Windows devices.", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:ring") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the device ring operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device ring operation.") + }) + Response ring(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; + + @POST + @Path("/lock-reset-devices") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Lock reset on Windows devices", + notes = "Lock reset on Windows devices.Its use to reset the device pass code", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-reset") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the lock-reset operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding adding a lock-reset operation.") + }) + Response lockReset(@HeaderParam("Accept") String acceptHeader, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; @POST - @Path("/ring-devices") + @Path("/location") @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", - value = "Ringing Windows Devices", - notes = "Ring Windows devices.", + value = "Requesting Location Coordinates", + responseContainer = "List", + notes = "Request location coordinates of Windows devices. \n" + + "Example: In situations where you have lost your device and need to find out where it is, " + + "you can use this REST API to get the location of the device.", response = Activity.class, tags = "Windows Device Management Administrative Service", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/windows/ring", - description = "Ring Device")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:location") + }) + } ) @ApiResponses(value = { @ApiResponse( code = 201, - message = "Created. \n Successfully scheduled the device ring operation.", + message = "Created. \n Get-location operation has successfully been scheduled", response = Activity.class, responseHeaders = { @ResponseHeader( name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), + description = "URL of the activity instance that refers to the " + + "scheduled operation."), @ResponseHeader( name = "Content-Type", description = "Content type of the body"), @@ -290,7 +450,8 @@ public interface DeviceManagementAdminService { "Used by caches, or in conditional requests.")}), @ApiResponse( code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + message = "See Other. \n The source can be retrieved from the URL specified in the" + + " location header.", responseHeaders = { @ResponseHeader( name = "Content-Location", @@ -300,40 +461,40 @@ public interface DeviceManagementAdminService { message = "Bad Request. \n Invalid request or validation error."), @ApiResponse( code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + message = "Unsupported media type. \n The format of the requested entity was not supported."), @ApiResponse( code = 500, message = "Internal Server Error. \n " + - "Server error occurred while adding a new device ring operation.") - }) - Response ring(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; + "Server error occurred while adding a new get-location operation.")}) + Response getDeviceLocation( + @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) + List deviceIDs); @POST - @Path("/lock-reset-devices") + @Path("/reboot") @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", - value = "Lock reset on Windows devices", - notes = "Lock reset on Windows devices.Its use to reset the device pass code", + value = "Rebooting Windows Devices", + notes = "Reboot or restart your Windows devices.", response = Activity.class, tags = "Windows Device Management Administrative Service", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/windows/lock-reset", - description = "Lock reset")} - ) + + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:reboot") + }) + } ) @ApiResponses(value = { @ApiResponse( code = 201, - message = "Created. \n Successfully scheduled the lock-reset operation.", + message = "Created. \n Successfully scheduled the device reboot operation.", response = Activity.class, responseHeaders = { @ResponseHeader( @@ -362,146 +523,18 @@ public interface DeviceManagementAdminService { message = "Bad Request. \n Invalid request or validation error."), @ApiResponse( code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), @ApiResponse( code = 500, message = "Internal Server Error. \n " + - "Server error occurred while adding adding a lock-reset operation.") + "Server error occurred while adding the new device reboot operation.") }) - Response lockReset(@HeaderParam("Accept") String acceptHeader, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - - @POST - @Path("/location") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Requesting Location Coordinates", - responseContainer = "List", - notes = "Request location coordinates of Windows devices. \n" + - "Example: In situations where you have lost your device and need to find out where it is, " + - "you can use this REST API to get the location of the device.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/windows/location", - description = "Get Device Location")} - ) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Get-location operation has successfully been scheduled", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the " + - "scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the" + - " location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding a new get-location operation.")}) - Response getDeviceLocation( + Response rebootDevice( @ApiParam( name = "deviceIDs", - value = "Provide the ID of the Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", + value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", required = true) List deviceIDs); - @POST - @Path("/reboot") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Rebooting Windows Devices", - notes = "Reboot or restart your Windows devices.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope( - scope = "/device-mgt/devices/owning-device/operations/windows/reboot", - description = "Reboot Device") } - ) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the device reboot operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding the new device reboot operation.") - }) - Response rebootDevice( - @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", - required = true) - List deviceIDs); } + diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java index fd2478668..bb9e568f8 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java @@ -19,8 +19,11 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst; import io.swagger.annotations.*; -import org.wso2.carbon.apimgt.annotations.api.Permission; + +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; +import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; import javax.jws.WebService; @@ -57,12 +60,21 @@ import javax.ws.rs.core.Response; @Path("/bst") @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) +@Scopes( + scopes = { + @Scope( + name = "Enroll Device", + description = "Register Windows device", + key = "perm:windows:enroll", + permissions = {"/device-mgt/devices/enroll/windows"} + ) + } +) public interface BSTProvider { @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/authentication") - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows") @ApiOperation( produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, @@ -70,13 +82,10 @@ public interface BSTProvider { value = "Getting Binary security token.", notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.", tags = "BST Provider", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", - description = "Getting Binary security token for Windows enrollment " + - "and policy endpoints.")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll") + }) } ) @ApiResponses( diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs index 3ca1c1dca..fe54ae367 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs @@ -29,7 +29,7 @@ Polling Interval* - + diff --git a/pom.xml b/pom.xml index 096152ebf..4dc0057f0 100644 --- a/pom.xml +++ b/pom.xml @@ -1217,7 +1217,7 @@ 1.7 - 4.4.10 + 4.4.11 [4.4.0, 4.5.0) 1.5.4 @@ -1267,7 +1267,7 @@ 5.6.89 - 5.2.33 + 5.3.1 [5.2.0, 6.0.0) @@ -1280,7 +1280,7 @@ 4.7.0 - 6.1.2 + 6.1.35 3.0.4.wso2v1