* Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ try { require_once dirname(__FILE__) . '/../../core/php/core.inc.php'; include_file('core', 'authentification', 'php'); if (!isConnect('admin')) { throw new Exception(__('401 - Accès non autorisé', __FILE__)); } if (init('action') == 'byUserId') { ajax::success(utils::o2a(rights::byUserId(init('user_id')))); } if (init('action') == 'save') { $rights_json = json_decode(init('rights'), true); foreach ($rights_json as $right_json) { $rights = rights::byId($right_json['id']); if (!is_object($rights)) { $rights = new rights(); } utils::a2o($rights, $right_json); $rights->save(); } ajax::success(); } throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action')); /* * *********Catch exeption*************** */