Skip to content

Commit

Permalink
Merge pull request #29 from linyows/support-slug
Browse files Browse the repository at this point in the history
Support slug for github team API
  • Loading branch information
linyows authored Oct 2, 2018
2 parents c1d888e + 16b2108 commit 2153a6d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
octopass (0.5.0-1) bionic; urgency=medium

* Support slug for GitHub team API

-- linyows <[email protected]> Thu, 02 Oct 2018 14:40:00 +0900
octopass (0.4.1-1) xenial; urgency=medium

* Page size changes to 100 from 30 on Github organization API
Expand Down
9 changes: 9 additions & 0 deletions octopass.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ int octopass_github_team_id(char *team_name, char *data)
const json_int_t id = json_integer_value(json_object_get(team, "id"));
return id;
}
const char *slug = json_string_value(json_object_get(team, "slug"));
if (name != NULL && strcmp(team_name, slug) == 0) {
const json_int_t id = json_integer_value(json_object_get(team, "id"));
return id;
}
}

return -1;
Expand Down Expand Up @@ -520,6 +525,7 @@ int octopass_team_id(struct config *con)

int id = octopass_github_team_id(con->team, res.data);
free(res.data);

return id;
}

Expand All @@ -545,6 +551,9 @@ int octopass_team_members(struct config *con, struct response *res)
{
int team_id = octopass_team_id(con);
if (team_id == -1) {
if (con->syslog) {
syslog(LOG_INFO, "team not found: %s", con->team);
}
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion octopass.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <sys/stat.h>
#include <regex.h>

#define OCTOPASS_VERSION "0.4.1"
#define OCTOPASS_VERSION "0.5.0"
#define OCTOPASS_VERSION_WITH_NAME "octopass/" OCTOPASS_VERSION
#ifndef OCTOPASS_CONFIG_FILE
#define OCTOPASS_CONFIG_FILE "/etc/octopass.conf"
Expand Down
4 changes: 3 additions & 1 deletion rpm/octopass.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary: Management linux user and authentication with team or collaborator on Github.
Name: octopass
Version: 0.4.1
Version: 0.5.0
Release: 1
License: GPLv3
URL: https://github.com/linyows/octopass
Expand Down Expand Up @@ -56,6 +56,8 @@ install -m 644 octopass.conf.example %{buildroot}%{_sysconfdir}/octopass.conf.ex
/etc/octopass.conf.example

%changelog
* Thu Oct 02 2018 linyows <[email protected]> - 0.5.0-1
- Support slug for GitHub team API
* Mon Apr 02 2018 linyows <[email protected]> - 0.4.1-1
- Page size changes to 100 from 30 on Github organization API
* Mon Sep 25 2017 linyows <[email protected]> - 0.4.0-1
Expand Down

0 comments on commit 2153a6d

Please sign in to comment.