@Override public String getName() { return tAuthorizable.getName(); } });
public Object getFieldValue(_Fields field) { switch (field) { case TYPE: return getType(); case NAME: return getName(); } throw new IllegalStateException(); }
public String toString(TSentryPrivilege tSentryPrivilege) { List<String> privileges = Lists.newArrayList(); if (tSentryPrivilege != null) { List<TAuthorizable> authorizables = tSentryPrivilege.getAuthorizables(); String action = tSentryPrivilege.getAction(); String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true" : "false"); Iterator<TAuthorizable> it = authorizables.iterator(); if (it != null) { while (it.hasNext()) { TAuthorizable tAuthorizable = it.next(); privileges.add(SentryConstants.KV_JOINER.join( tAuthorizable.getType(), tAuthorizable.getName())); } } if (!authorizables.isEmpty()) { privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_ACTION_NAME, action)); } // only append the grant option to privilege string if it's true if ("true".equals(grantOption)) { privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, grantOption)); } } return SentryConstants.AUTHORIZABLE_JOINER.join(privileges); }
public String toString(TSentryPrivilege tSentryPrivilege) { List<String> privileges = Lists.newArrayList(); if (tSentryPrivilege != null) { List<TAuthorizable> authorizables = tSentryPrivilege.getAuthorizables(); String action = tSentryPrivilege.getAction(); String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true" : "false"); Iterator<TAuthorizable> it = authorizables.iterator(); if (it != null) { while (it.hasNext()) { TAuthorizable tAuthorizable = it.next(); privileges.add(SentryConstants.KV_JOINER.join( tAuthorizable.getType(), tAuthorizable.getName())); } } if (!authorizables.isEmpty()) { privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_ACTION_NAME, action)); } // only append the grant option to privilege string if it's true if ("true".equals(grantOption)) { privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, grantOption)); } } return SentryConstants.AUTHORIZABLE_JOINER.join(privileges); }
if (authorizables != null) { for (TAuthorizable authorizable : authorizables) { sb.append(" ").append(authorizable.getType()).append(" ").append(authorizable.getName());
public JsonLogEntity createJsonLogEntity( org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest request, org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeResponse response, Configuration conf) { GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName(), request.getComponent()); if (request.getPrivilege() != null) { List<TAuthorizable> authorizables = request.getPrivilege().getAuthorizables(); Map<String, String> privilegesMap = new LinkedHashMap<String, String>(); if (authorizables != null) { for (TAuthorizable authorizable : authorizables) { privilegesMap.put(authorizable.getType(), authorizable.getName()); } } gmamle.setPrivilegesMap(privilegesMap); } gmamle.setOperationText(CommandUtil.createCmdForRevokeGMPrivilege(request)); return gmamle; }
public JsonLogEntity createJsonLogEntity( org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest request, org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeResponse response, Configuration conf) { GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName(), request.getComponent()); if (request.getPrivilege() != null) { List<TAuthorizable> authorizables = request.getPrivilege().getAuthorizables(); Map<String, String> privilegesMap = new LinkedHashMap<String, String>(); if (authorizables != null) { for (TAuthorizable authorizable : authorizables) { privilegesMap.put(authorizable.getType(), authorizable.getName()); } } gmamle.setPrivilegesMap(privilegesMap); } gmamle.setOperationText(CommandUtil.createCmdForGrantGMPrivilege(request)); return gmamle; }